Only include SkJSONWriter when SK_ENABLE_DUMP_GPU defined

Also fix some missing includes in:
 - src/gpu/effects/GrPorterDuffXferProcessor.cpp
 - src/gpu/GrDirectContext.cpp
 - tools/DDLPromiseImageHelper.h

Change-Id: I1b30827e1442fd01534427b52549f8775300b365
Bug: skia:12584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466876
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2021-11-02 11:38:39 -04:00 committed by SkCQ
parent 524d73d10c
commit 3b9113f110
9 changed files with 24 additions and 6 deletions

View File

@ -7,7 +7,6 @@
#include "src/gpu/GrAuditTrail.h" #include "src/gpu/GrAuditTrail.h"
#include "src/gpu/ops/GrOp.h" #include "src/gpu/ops/GrOp.h"
#include "src/utils/SkJSONWriter.h"
const int GrAuditTrail::kGrAuditTrailInvalidID = -1; const int GrAuditTrail::kGrAuditTrailInvalidID = -1;
@ -136,6 +135,9 @@ void GrAuditTrail::fullReset() {
fOpPool.reset(); // must be last, frees all of the memory fOpPool.reset(); // must be last, frees all of the memory
} }
#ifdef SK_ENABLE_DUMP_GPU
#include "src/utils/SkJSONWriter.h"
template <typename T> template <typename T>
void GrAuditTrail::JsonifyTArray(SkJSONWriter& writer, const char* name, const T& array) { void GrAuditTrail::JsonifyTArray(SkJSONWriter& writer, const char* name, const T& array) {
if (array.count()) { if (array.count()) {
@ -198,3 +200,11 @@ void GrAuditTrail::OpNode::toJson(SkJSONWriter& writer) const {
JsonifyTArray(writer, "Ops", fChildren); JsonifyTArray(writer, "Ops", fChildren);
writer.endObject(); writer.endObject();
} }
#else
template <typename T>
void GrAuditTrail::JsonifyTArray(SkJSONWriter& writer, const char* name, const T& array) {}
void GrAuditTrail::toJson(SkJSONWriter& writer) const {}
void GrAuditTrail::toJson(SkJSONWriter& writer, int clientID) const {}
void GrAuditTrail::Op::toJson(SkJSONWriter& writer) const {}
void GrAuditTrail::OpNode::toJson(SkJSONWriter& writer) const {}
#endif // SK_ENABLE_DUMP_GPU

View File

@ -15,7 +15,6 @@
#include "src/gpu/GrSurface.h" #include "src/gpu/GrSurface.h"
#include "src/gpu/GrSurfaceProxy.h" #include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrWindowRectangles.h" #include "src/gpu/GrWindowRectangles.h"
#include "src/utils/SkJSONWriter.h"
GrCaps::GrCaps(const GrContextOptions& options) { GrCaps::GrCaps(const GrContextOptions& options) {
fMipmapSupport = false; fMipmapSupport = false;
@ -166,6 +165,7 @@ void GrCaps::applyOptionsOverrides(const GrContextOptions& options) {
#ifdef SK_ENABLE_DUMP_GPU #ifdef SK_ENABLE_DUMP_GPU
#include "src/gpu/GrTestUtils.h" #include "src/gpu/GrTestUtils.h"
#include "src/utils/SkJSONWriter.h"
static SkString map_flags_to_string(uint32_t flags) { static SkString map_flags_to_string(uint32_t flags) {
SkString str; SkString str;

View File

@ -9,6 +9,7 @@
#include "include/gpu/GrDirectContext.h" #include "include/gpu/GrDirectContext.h"
#include "include/core/SkTraceMemoryDump.h" #include "include/core/SkTraceMemoryDump.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrContextThreadSafeProxy.h" #include "include/gpu/GrContextThreadSafeProxy.h"
#include "src/core/SkAutoMalloc.h" #include "src/core/SkAutoMalloc.h"
#include "src/core/SkTaskGroup.h" #include "src/core/SkTaskGroup.h"
@ -20,6 +21,7 @@
#include "src/gpu/GrDrawingManager.h" #include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrGpu.h" #include "src/gpu/GrGpu.h"
#include "src/gpu/GrResourceProvider.h" #include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSemaphore.h"
#include "src/gpu/GrShaderUtils.h" #include "src/gpu/GrShaderUtils.h"
#include "src/gpu/GrThreadSafePipelineBuilder.h" #include "src/gpu/GrThreadSafePipelineBuilder.h"
#include "src/gpu/SurfaceContext.h" #include "src/gpu/SurfaceContext.h"

View File

@ -32,7 +32,6 @@
#include "src/gpu/GrTextureProxyPriv.h" #include "src/gpu/GrTextureProxyPriv.h"
#include "src/gpu/GrTracing.h" #include "src/gpu/GrTracing.h"
#include "src/sksl/SkSLCompiler.h" #include "src/sksl/SkSLCompiler.h"
#include "src/utils/SkJSONWriter.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -744,6 +743,8 @@ void GrGpu::callSubmittedProcs(bool success) {
} }
#ifdef SK_ENABLE_DUMP_GPU #ifdef SK_ENABLE_DUMP_GPU
#include "src/utils/SkJSONWriter.h"
void GrGpu::dumpJSON(SkJSONWriter* writer) const { void GrGpu::dumpJSON(SkJSONWriter* writer) const {
writer->beginObject(); writer->beginObject();

View File

@ -9,7 +9,6 @@
#include "src/gpu/GrShaderCaps.h" #include "src/gpu/GrShaderCaps.h"
#include "include/gpu/GrContextOptions.h" #include "include/gpu/GrContextOptions.h"
#include "src/utils/SkJSONWriter.h"
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
@ -83,6 +82,8 @@ GrShaderCaps::GrShaderCaps() {
} }
#ifdef SK_ENABLE_DUMP_GPU #ifdef SK_ENABLE_DUMP_GPU
#include "src/utils/SkJSONWriter.h"
void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
writer->beginObject(); writer->beginObject();

View File

@ -8,6 +8,7 @@
#include "src/gpu/effects/GrPorterDuffXferProcessor.h" #include "src/gpu/effects/GrPorterDuffXferProcessor.h"
#include "include/gpu/GrTypes.h" #include "include/gpu/GrTypes.h"
#include "include/private/SkMacros.h"
#include "include/private/SkTo.h" #include "include/private/SkTo.h"
#include "src/gpu/GrBlend.h" #include "src/gpu/GrBlend.h"
#include "src/gpu/GrCaps.h" #include "src/gpu/GrCaps.h"

View File

@ -22,7 +22,6 @@
#include "src/gpu/gl/GrGLContext.h" #include "src/gpu/gl/GrGLContext.h"
#include "src/gpu/gl/GrGLRenderTarget.h" #include "src/gpu/gl/GrGLRenderTarget.h"
#include "src/gpu/gl/GrGLTexture.h" #include "src/gpu/gl/GrGLTexture.h"
#include "src/utils/SkJSONWriter.h"
#if defined(SK_BUILD_FOR_IOS) #if defined(SK_BUILD_FOR_IOS)
#include <TargetConditionals.h> #include <TargetConditionals.h>
@ -1109,6 +1108,8 @@ void GrGLCaps::initStencilSupport(const GrGLContextInfo& ctxInfo) {
} }
#ifdef SK_ENABLE_DUMP_GPU #ifdef SK_ENABLE_DUMP_GPU
#include "src/utils/SkJSONWriter.h"
static const char* multi_draw_type_name(GrGLCaps::MultiDrawType multiDrawType) { static const char* multi_draw_type_name(GrGLCaps::MultiDrawType multiDrawType) {
switch (multiDrawType) { switch (multiDrawType) {
case GrGLCaps::MultiDrawType::kNone : return "kNone"; case GrGLCaps::MultiDrawType::kNone : return "kNone";

View File

@ -11,7 +11,6 @@
#include "src/core/SkTSearch.h" #include "src/core/SkTSearch.h"
#include "src/core/SkTSort.h" #include "src/core/SkTSort.h"
#include "src/utils/SkJSONWriter.h"
namespace { // This cannot be static because it is used as a template parameter. namespace { // This cannot be static because it is used as a template parameter.
inline bool extension_compare(const SkString& a, const SkString& b) { inline bool extension_compare(const SkString& a, const SkString& b) {
@ -155,6 +154,8 @@ void GrGLExtensions::add(const char ext[]) {
} }
#ifdef SK_ENABLE_DUMP_GPU #ifdef SK_ENABLE_DUMP_GPU
#include "src/utils/SkJSONWriter.h"
void GrGLExtensions::dumpJSON(SkJSONWriter* writer) const { void GrGLExtensions::dumpJSON(SkJSONWriter* writer) const {
writer->beginArray(); writer->beginArray();
for (int i = 0; i < fStrings.count(); ++i) { for (int i = 0; i < fStrings.count(); ++i) {

View File

@ -11,6 +11,7 @@
#include "include/core/SkBitmap.h" #include "include/core/SkBitmap.h"
#include "include/core/SkDeferredDisplayListRecorder.h" #include "include/core/SkDeferredDisplayListRecorder.h"
#include "include/core/SkPromiseImageTexture.h" #include "include/core/SkPromiseImageTexture.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkYUVAPixmaps.h" #include "include/core/SkYUVAPixmaps.h"
#include "include/gpu/GrBackendSurface.h" #include "include/gpu/GrBackendSurface.h"
#include "include/private/SkTArray.h" #include "include/private/SkTArray.h"