diff options
29 files changed, 129 insertions, 79 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 85685fb3bc..2fba1f0533 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -47,6 +47,8 @@ SkAutoTDelete<GrContextFactory> gGrFactory; #endif + struct GrContextOptions; + __SK_FORCE_IMAGE_DECODER_LINKING; static const int kAutoTuneLoops = 0; @@ -844,7 +846,7 @@ int nanobench_main() { SkTaskGroup::Enabler enabled; #if SK_SUPPORT_GPU - GrContext::Options grContextOpts; + GrContextOptions grContextOpts; grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts))); #endif diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 9f8ab72736..e56175b58e 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -16,6 +16,7 @@ '<(skia_include_path)/gpu/GrClip.h', '<(skia_include_path)/gpu/GrColor.h', '<(skia_include_path)/gpu/GrConfig.h', + '<(skia_include_path)/gpu/GrContextOptions.h', '<(skia_include_path)/gpu/GrContext.h', '<(skia_include_path)/gpu/GrCoordTransform.h', '<(skia_include_path)/gpu/GrFragmentProcessor.h', diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 580017a9fe..be62d8a851 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -14,6 +14,8 @@ #include "SkRefCnt.h" #include "SkString.h" +struct GrContextOptions; + class GrShaderCaps : public SkRefCnt { public: SK_DECLARE_INST_COUNT(GrShaderCaps) @@ -103,7 +105,7 @@ class GrCaps : public SkRefCnt { public: SK_DECLARE_INST_COUNT(GrCaps) - GrCaps(); + GrCaps(const GrContextOptions&); virtual SkString dump() const; @@ -186,6 +188,11 @@ public: return fConfigTextureSupport[config]; } + bool suppressPrints() const { return fSupressPrints; } + + bool drawPathMasksToCompressedTexturesSupport() const { + return fDrawPathMasksToCompressedTextureSupport; } + protected: SkAutoTUnref<GrShaderCaps> fShaderCaps; @@ -214,6 +221,9 @@ protected: bool fConfigTextureSupport[kGrPixelConfigCnt]; private: + bool fSupressPrints : 1; + bool fDrawPathMasksToCompressedTextureSupport : 1; + typedef SkRefCnt INHERITED; }; diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index a6fdf75d89..b6fef3d80c 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -20,6 +20,7 @@ class GrAARectRenderer; class GrBatchFontCache; +struct GrContextOptions; class GrDrawTarget; class GrFragmentProcessor; class GrGpu; @@ -46,20 +47,11 @@ class SK_API GrContext : public SkRefCnt { public: SK_DECLARE_INST_COUNT(GrContext) - struct Options { - Options() : fDrawPathToCompressedTexture(false), fSuppressPrints(false) { } - - // EXPERIMENTAL - // May be removed in the future, or may become standard depending - // on the outcomes of a variety of internal tests. - bool fDrawPathToCompressedTexture; - bool fSuppressPrints; - }; - /** * Creates a GrContext for a backend context. */ - static GrContext* Create(GrBackend, GrBackendContext, const Options* opts = NULL); + static GrContext* Create(GrBackend, GrBackendContext, const GrContextOptions& options); + static GrContext* Create(GrBackend, GrBackendContext); /** * Only defined in test apps. @@ -530,7 +522,6 @@ public: GrResourceProvider* resourceProvider() { return fResourceProvider; } const GrResourceProvider* resourceProvider() const { return fResourceProvider; } GrResourceCache* getResourceCache() { return fResourceCache; } - bool suppressPrints() const { return fOptions.fSuppressPrints; } // Called by tests that draw directly to the context via GrDrawTarget void getTestTarget(GrTestTarget*); @@ -548,12 +539,6 @@ public: GrPathRendererChain::DrawType drawType = GrPathRendererChain::kColor_DrawType, GrPathRendererChain::StencilSupport* stencilSupport = NULL); - /** - * This returns a copy of the the GrContext::Options that was passed to the - * constructor of this class. - */ - const Options& getOptions() const { return fOptions; } - /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ void dumpCacheStats(SkString*) const; void printCacheStats() const; @@ -599,11 +584,10 @@ private: int fMaxTextureSizeOverride; - const Options fOptions; const uint32_t fUniqueID; - GrContext(const Options&); // init must be called after the constructor. - bool init(GrBackend, GrBackendContext); + GrContext(); // init must be called after the constructor. + bool init(GrBackend, GrBackendContext, const GrContextOptions& options); void initMockContext(); void initCommon(); diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h new file mode 100644 index 0000000000..d78ac6cc56 --- /dev/null +++ b/include/gpu/GrContextOptions.h @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrContextOptions_DEFINED +#define GrContextOptions_DEFINED + +#include "SkTypes.h" + +struct GrContextOptions { + GrContextOptions() : fDrawPathToCompressedTexture(false), fSuppressPrints(false) {} + + // EXPERIMENTAL + // May be removed in the future, or may become standard depending + // on the outcomes of a variety of internal tests. + bool fDrawPathToCompressedTexture; + // Suppress prints for the GrContext. + bool fSuppressPrints; +}; + +#endif diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h index eaf1aa4050..9202742df9 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -265,13 +265,13 @@ private: }; #ifdef SK_DEBUG -// Takes a pointer to a GrContext, and will suppress prints if required -#define GrContextDebugf(context, ...) \ - if (!context->suppressPrints()) { \ - SkDebugf(__VA_ARGS__); \ +// Takes a pointer to a GrCaps, and will suppress prints if required +#define GrCapsDebugf(caps, ...) \ + if (!caps->suppressPrints()) { \ + SkDebugf(__VA_ARGS__); \ } #else -#define GrContextDebugf(context, ...) +#define GrCapsDebugf(caps, ...) #endif #endif diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index f4ca6c480e..3ed0b6baa2 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -15,6 +15,7 @@ #include "GrBatchTarget.h" #include "GrBatchTest.h" #include "GrCaps.h" +#include "GrContextOptions.h" #include "GrDefaultGeoProcFactory.h" #include "GrGpuResource.h" #include "GrGpuResourcePriv.h" @@ -70,16 +71,16 @@ private: GrContext* fContext; }; +GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) { + GrContextOptions defaultOptions; + return Create(backend, backendContext, defaultOptions); +} + GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, - const Options* opts) { - GrContext* context; - if (NULL == opts) { - context = SkNEW_ARGS(GrContext, (Options())); - } else { - context = SkNEW_ARGS(GrContext, (*opts)); - } + const GrContextOptions& options) { + GrContext* context = SkNEW(GrContext); - if (context->init(backend, backendContext)) { + if (context->init(backend, backendContext, options)) { return context; } else { context->unref(); @@ -96,7 +97,7 @@ static int32_t next_id() { return id; } -GrContext::GrContext(const Options& opts) : fOptions(opts), fUniqueID(next_id()) { +GrContext::GrContext() : fUniqueID(next_id()) { fGpu = NULL; fResourceCache = NULL; fResourceProvider = NULL; @@ -110,10 +111,11 @@ GrContext::GrContext(const Options& opts) : fOptions(opts), fUniqueID(next_id()) fMaxTextureSizeOverride = 1 << 20; } -bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { +bool GrContext::init(GrBackend backend, GrBackendContext backendContext, + const GrContextOptions& options) { SkASSERT(NULL == fGpu); - fGpu = GrGpu::Create(backend, backendContext, this); + fGpu = GrGpu::Create(backend, backendContext, options, this); if (NULL == fGpu) { return false; } diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp index 1a3864ac14..7df19177eb 100755 --- a/src/gpu/GrContextFactory.cpp +++ b/src/gpu/GrContextFactory.cpp @@ -75,7 +75,7 @@ GrContext* GrContextFactory::get(GLContextType type, GrGLStandard forcedGpuAPI) glCtx->makeCurrent(); GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get()); - grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, &fGlobalOptions)); + grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx, fGlobalOptions)); if (!grCtx.get()) { return NULL; } diff --git a/src/gpu/GrContextFactory.h b/src/gpu/GrContextFactory.h index 353e3d9c96..7fd4b77ce0 100644 --- a/src/gpu/GrContextFactory.h +++ b/src/gpu/GrContextFactory.h @@ -9,6 +9,7 @@ #define GrContextFactory_DEFINED #include "GrContext.h" +#include "GrContextOptions.h" #include "gl/SkGLContext.h" #include "SkTArray.h" @@ -80,7 +81,7 @@ public: } } - explicit GrContextFactory(const GrContext::Options& opts) : fGlobalOptions(opts) { } + explicit GrContextFactory(const GrContextOptions& opts) : fGlobalOptions(opts) { } GrContextFactory() { } ~GrContextFactory() { this->destroyContexts(); } @@ -126,7 +127,7 @@ public: return NULL; } - const GrContext::Options& getGlobalOptions() const { return fGlobalOptions; } + const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; } private: struct GPUContext { @@ -135,7 +136,7 @@ private: GrContext* fGrContext; }; SkTArray<GPUContext, true> fContexts; - const GrContext::Options fGlobalOptions; + const GrContextOptions fGlobalOptions; }; #endif diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 2d5d0b8ee6..e5baaa7404 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -11,6 +11,7 @@ #include "GrBatch.h" #include "GrCaps.h" #include "GrContext.h" +#include "GrContextOptions.h" #include "GrPath.h" #include "GrPipeline.h" #include "GrMemoryPool.h" @@ -68,8 +69,8 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil drawBounds->roundOut(&drawIBounds); if (!copyRect.intersect(drawIBounds)) { #ifdef SK_DEBUG - GrContextDebugf(fContext, "Missed an early reject. " - "Bailing on draw from setupDstReadIfNecessary.\n"); + GrCapsDebugf(fCaps, "Missed an early reject. " + "Bailing on draw from setupDstReadIfNecessary.\n"); #endif return false; } @@ -598,7 +599,7 @@ SkString GrShaderCaps::dump() const { /////////////////////////////////////////////////////////////////////////////// -GrCaps::GrCaps() { +GrCaps::GrCaps(const GrContextOptions& options) { fMipMapSupport = false; fNPOTTextureTileSupport = false; fTwoSidedStencilSupport = false; @@ -621,6 +622,9 @@ GrCaps::GrCaps() { memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); + + fSupressPrints = options.fSuppressPrints; + fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedTexture; } static SkString map_flags_to_string(uint32_t flags) { diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 6e8dc43f75..5b5be1b69b 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -31,7 +31,7 @@ public: * not supported (at compile-time or run-time) this returns NULL. The context will not be * fully constructed and should not be used by GrGpu until after this function returns. */ - static GrGpu* Create(GrBackend, GrBackendContext, GrContext* context); + static GrGpu* Create(GrBackend, GrBackendContext, const GrContextOptions&, GrContext* context); //////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GrGpuFactory.cpp b/src/gpu/GrGpuFactory.cpp index bd572e6860..3001a0d41a 100644 --- a/src/gpu/GrGpuFactory.cpp +++ b/src/gpu/GrGpuFactory.cpp @@ -20,10 +20,13 @@ GrGpuFactoryRegistrar::GrGpuFactoryRegistrar(int i, CreateGpuProc proc) { gGpuFactories[i] = proc; } -GrGpu* GrGpu::Create(GrBackend backend, GrBackendContext backendContext, GrContext* context) { +GrGpu* GrGpu::Create(GrBackend backend, + GrBackendContext backendContext, + const GrContextOptions& options, + GrContext* context) { SkASSERT((int)backend < kMaxNumBackends); if (!gGpuFactories[backend]) { return NULL; } - return (gGpuFactories[backend])(backendContext, context); + return (gGpuFactories[backend])(backendContext, options, context); } diff --git a/src/gpu/GrGpuFactory.h b/src/gpu/GrGpuFactory.h index 180f264d96..aecc2c1705 100644 --- a/src/gpu/GrGpuFactory.h +++ b/src/gpu/GrGpuFactory.h @@ -12,8 +12,9 @@ class GrGpu; class GrContext; +struct GrContextOptions; -typedef GrGpu* (*CreateGpuProc)(GrBackendContext, GrContext*); +typedef GrGpu* (*CreateGpuProc)(GrBackendContext, const GrContextOptions& options, GrContext*); class GrGpuFactoryRegistrar { public: diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index aa922ca170..25911866cb 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -174,7 +174,7 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds, resultBounds.height()); if (allowCompression && - fContext->getOptions().fDrawPathToCompressedTexture && + fContext->getGpu()->caps()->drawPathMasksToCompressedTexturesSupport() && choose_compressed_fmt(fContext->getGpu()->caps(), &fCompressedFormat)) { fCompressionMode = kCompress_CompressionMode; } diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp index 0801d03a6c..8580661fd3 100644 --- a/src/gpu/GrTest.cpp +++ b/src/gpu/GrTest.cpp @@ -7,6 +7,7 @@ */ #include "GrTest.h" +#include "GrContextOptions.h" #include "GrGpuResourceCacheAccess.h" #include "GrInOrderDrawBuffer.h" @@ -138,7 +139,9 @@ class GrPipeline; class MockGpu : public GrGpu { public: - MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrCaps)); } + MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(context) { + fCaps.reset(SkNEW_ARGS(GrCaps, (options))); + } ~MockGpu() override {} bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override { return true; @@ -249,15 +252,16 @@ private: }; GrContext* GrContext::CreateMockContext() { - GrContext* context = SkNEW_ARGS(GrContext, (Options())); + GrContext* context = SkNEW(GrContext); context->initMockContext(); return context; } void GrContext::initMockContext() { + GrContextOptions options; SkASSERT(NULL == fGpu); - fGpu = SkNEW_ARGS(MockGpu, (this)); + fGpu = SkNEW_ARGS(MockGpu, (this, options)); SkASSERT(fGpu); this->initCommon(); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 2a97137f12..6f272b7b8e 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -12,7 +12,9 @@ #include "SkTSearch.h" #include "SkTSort.h" -GrGLCaps::GrGLCaps(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface) { +GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, + const GrGLContextInfo& ctxInfo, + const GrGLInterface* glInterface) : INHERITED(contextOptions) { fVerifiedColorConfigs.reset(); fStencilFormats.reset(); fStencilVerifiedColorConfigs.reset(); diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index cd84242292..9d38c82ced 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -91,7 +91,8 @@ public: * Initializes the GrGLCaps to the set of features supported in the current * OpenGL context accessible via ctxInfo. */ - GrGLCaps(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface); + GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxInfo, + const GrGLInterface* glInterface); /** * Call to note that a color config has been verified as a valid color diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp index 8115687093..335986508d 100644 --- a/src/gpu/gl/GrGLContext.cpp +++ b/src/gpu/gl/GrGLContext.cpp @@ -9,7 +9,7 @@ //////////////////////////////////////////////////////////////////////////////// -GrGLContext* GrGLContext::Create(const GrGLInterface* interface) { +GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContextOptions& options) { // We haven't validated the GrGLInterface yet, so check for GetString function pointer if (!interface->fFunctions.fGetString) { return NULL; @@ -55,6 +55,9 @@ GrGLContext* GrGLContext::Create(const GrGLInterface* interface) { args.fIsMesa = GrGLIsMesaFromVersionString(ver); args.fIsChromium = GrGLIsChromiumFromRendererString(renderer); + + args.fContextOptions = &options; + return SkNEW_ARGS(GrGLContext, (args)); } @@ -67,5 +70,5 @@ GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) { fIsMesa = args.fIsMesa; fIsChromium = args.fIsChromium; - fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*this, fInterface))); + fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*args.fContextOptions, *this, fInterface))); } diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h index e84c8ecffc..50262cf44a 100644 --- a/src/gpu/gl/GrGLContext.h +++ b/src/gpu/gl/GrGLContext.h @@ -15,7 +15,7 @@ #include "GrGLSL.h" #include "GrGLUtil.h" -#include "SkString.h" +struct GrContextOptions; /** * Encapsulates information about an OpenGL context including the OpenGL @@ -51,6 +51,7 @@ protected: GrGLRenderer fRenderer; bool fIsMesa; bool fIsChromium; + const GrContextOptions* fContextOptions; }; GrGLContextInfo(const ConstructorArgs& args); @@ -74,7 +75,7 @@ public: * Creates a GrGLContext from a GrGLInterface and the currently * bound OpenGL context accessible by the GrGLInterface. */ - static GrGLContext* Create(const GrGLInterface* interface); + static GrGLContext* Create(const GrGLInterface* interface, const GrContextOptions& options); const GrGLInterface* interface() const { return fInterface; } diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 07aaaae26b..3a3b833a8f 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -157,7 +157,8 @@ bool GrGLGpu::BlendCoeffReferencesConstant(GrBlendCoeff coeff) { /////////////////////////////////////////////////////////////////////////////// -GrGpu* GrGLGpu::Create(GrBackendContext backendContext, GrContext* context) { +GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& options, + GrContext* context) { SkAutoTUnref<const GrGLInterface> glInterface( reinterpret_cast<const GrGLInterface*>(backendContext)); if (!glInterface) { @@ -168,7 +169,7 @@ GrGpu* GrGLGpu::Create(GrBackendContext backendContext, GrContext* context) { if (!glInterface) { return NULL; } - GrGLContext* glContext = GrGLContext::Create(glInterface); + GrGLContext* glContext = GrGLContext::Create(glInterface, options); if (glContext) { return SkNEW_ARGS(GrGLGpu, (glContext, context)); } @@ -1436,7 +1437,7 @@ bool GrGLGpu::flushGLState(const DrawArgs& args) { fCurrentProgram.reset(fProgramCache->getProgram(args)); if (NULL == fCurrentProgram.get()) { - GrContextDebugf(this->getContext(), "Failed to create program!\n"); + GrCapsDebugf(this->caps(), "Failed to create program!\n"); return false; } diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index d7b11026f5..c777f7792a 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -32,7 +32,8 @@ class GrNonInstancedVertices; class GrGLGpu : public GrGpu { public: - static GrGpu* Create(GrBackendContext backendContext, GrContext* context); + static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions& options, + GrContext* context); ~GrGLGpu() override; void contextAbandoned() override; diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp index ef2f59e664..ce2598e246 100644 --- a/src/gpu/gl/GrGLProgramDataManager.cpp +++ b/src/gpu/gl/GrGLProgramDataManager.cpp @@ -261,7 +261,7 @@ void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix #ifdef SK_DEBUG void GrGLProgramDataManager::printUnused(const Uniform& uni) const { if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) { - GrContextDebugf(fGpu->getContext(), "Unused uniform in shader\n"); + GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); } } #endif diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 28e1fba20c..a3b0d686a4 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -207,7 +207,7 @@ bool GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr totalTextures += processor->numTextures(); if (totalTextures >= maxTextureUnits) { - GrContextDebugf(fGpu->getContext(), "Program would use too many texture units\n"); + GrCapsDebugf(fGpu->caps(), "Program would use too many texture units\n"); return false; } } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 90aac8b86d..ca801f9bd0 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -283,7 +283,7 @@ DEF_GPUTEST(GLPrograms, reporter, factory) { #endif // We suppress prints to avoid spew - GrContext::Options opts; + GrContextOptions opts; opts.fSuppressPrints = true; GrContextFactory debugFactory(opts); for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { diff --git a/tools/CopyTilesRenderer.cpp b/tools/CopyTilesRenderer.cpp index 6f95da758b..bc1e32ec11 100644 --- a/tools/CopyTilesRenderer.cpp +++ b/tools/CopyTilesRenderer.cpp @@ -18,7 +18,7 @@ namespace sk_tools { #if SK_SUPPORT_GPU - CopyTilesRenderer::CopyTilesRenderer(const GrContext::Options& opts, int x, int y) + CopyTilesRenderer::CopyTilesRenderer(const GrContextOptions& opts, int x, int y) : INHERITED(opts) , fXTilesPerLargeTile(x) , fYTilesPerLargeTile(y) { } diff --git a/tools/CopyTilesRenderer.h b/tools/CopyTilesRenderer.h index 3d9a1eb18c..5ff4175eed 100644 --- a/tools/CopyTilesRenderer.h +++ b/tools/CopyTilesRenderer.h @@ -11,6 +11,7 @@ #include "PictureRenderer.h" #include "SkTypes.h" +struct GrContextOptions; class SkPicture; class SkString; @@ -23,7 +24,7 @@ namespace sk_tools { public: #if SK_SUPPORT_GPU - CopyTilesRenderer(const GrContext::Options &opts, int x, int y); + CopyTilesRenderer(const GrContextOptions &opts, int x, int y); #else CopyTilesRenderer(int x, int y); #endif diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index 93701baed9..0875c5ab65 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -465,7 +465,7 @@ SkString SimplePictureRenderer::getConfigNameInternal() { /////////////////////////////////////////////////////////////////////////////////////////////// #if SK_SUPPORT_GPU -TiledPictureRenderer::TiledPictureRenderer(const GrContext::Options& opts) +TiledPictureRenderer::TiledPictureRenderer(const GrContextOptions& opts) : INHERITED(opts) , fTileWidth(kDefaultTileWidth) #else diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h index e1434686c6..fadf97085f 100644 --- a/tools/PictureRenderer.h +++ b/tools/PictureRenderer.h @@ -28,6 +28,7 @@ #include "image_expectations.h" +struct GrContextOptions; class SkBitmap; class SkCanvas; class SkGLContext; @@ -392,7 +393,7 @@ public: return fGrContext; } - const GrContext::Options& getGrContextOptions() { + const GrContextOptions& getGrContextOptions() { return fGrContextFactory.getGlobalOptions(); } #endif @@ -406,7 +407,7 @@ public: } #if SK_SUPPORT_GPU - explicit PictureRenderer(const GrContext::Options &opts) + explicit PictureRenderer(const GrContextOptions &opts) #else PictureRenderer() #endif @@ -498,7 +499,7 @@ private: class RecordPictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - RecordPictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } + RecordPictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { } #endif bool render(SkBitmap** out = NULL) override; @@ -519,7 +520,7 @@ private: class PipePictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - PipePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } + PipePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { } #endif bool render(SkBitmap** out = NULL) override; @@ -533,7 +534,7 @@ private: class SimplePictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } + SimplePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { } #endif virtual void init(const SkPicture* pict, @@ -554,7 +555,7 @@ private: class TiledPictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - TiledPictureRenderer(const GrContext::Options &opts); + TiledPictureRenderer(const GrContextOptions &opts); #else TiledPictureRenderer(); #endif @@ -689,7 +690,7 @@ private: class PlaybackCreationRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - PlaybackCreationRenderer(const GrContext::Options &opts) : INHERITED(opts) { } + PlaybackCreationRenderer(const GrContextOptions &opts) : INHERITED(opts) { } #endif void setup() override; @@ -709,7 +710,7 @@ private: }; #if SK_SUPPORT_GPU -extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts); +extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& opts); #else extern PictureRenderer* CreateGatherPixelRefsRenderer(); #endif diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp index 82097e9819..26d15911d1 100644 --- a/tools/PictureRenderingFlags.cpp +++ b/tools/PictureRenderingFlags.cpp @@ -8,6 +8,9 @@ #include "PictureRenderingFlags.h" #include "CopyTilesRenderer.h" +#if SK_SUPPORT_GPU +#include "GrContextOptions.h" +#endif #include "PictureRenderer.h" #include "picture_utils.h" #include "SkCommandLineFlags.h" @@ -94,7 +97,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { const char* mode = NULL; #if SK_SUPPORT_GPU - GrContext::Options grContextOpts; + GrContextOptions grContextOpts; grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; #define RENDERER_ARGS (grContextOpts) #else |