From 08bf86d1b7b03cc6829f2488d9adcb0502e84b97 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Fri, 22 May 2015 12:41:05 -0700 Subject: Revert of Store context options on caps. (patchset #3 id:40001 of https://codereview.chromium.org/1158433006/) Reason for revert: breaking chromeos build (???) Original issue's description: > Store context options on caps. > > Committed: https://skia.googlesource.com/skia/+/f28cff71db2cbb1ff18a8fbf1e80ca761d1f69bc TBR=joshualitt@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1151603005 --- bench/nanobench.cpp | 4 +--- gyp/gpu.gypi | 1 - include/gpu/GrCaps.h | 12 +----------- include/gpu/GrContext.h | 26 +++++++++++++++++++++----- include/gpu/GrContextOptions.h | 24 ------------------------ include/gpu/GrTypesPriv.h | 10 +++++----- src/gpu/GrContext.cpp | 24 +++++++++++------------- src/gpu/GrContextFactory.cpp | 2 +- src/gpu/GrContextFactory.h | 7 +++---- src/gpu/GrDrawTarget.cpp | 10 +++------- src/gpu/GrGpu.h | 2 +- src/gpu/GrGpuFactory.cpp | 7 ++----- src/gpu/GrGpuFactory.h | 3 +-- src/gpu/GrSWMaskHelper.cpp | 2 +- src/gpu/GrTest.cpp | 10 +++------- src/gpu/gl/GrGLCaps.cpp | 4 +--- src/gpu/gl/GrGLCaps.h | 3 +-- src/gpu/gl/GrGLContext.cpp | 7 ++----- src/gpu/gl/GrGLContext.h | 5 ++--- src/gpu/gl/GrGLGpu.cpp | 7 +++---- src/gpu/gl/GrGLGpu.h | 3 +-- src/gpu/gl/GrGLProgramDataManager.cpp | 2 +- src/gpu/gl/builders/GrGLProgramBuilder.cpp | 2 +- tests/GLProgramsTest.cpp | 2 +- tools/CopyTilesRenderer.cpp | 2 +- tools/CopyTilesRenderer.h | 3 +-- tools/PictureRenderer.cpp | 2 +- tools/PictureRenderer.h | 17 ++++++++--------- tools/PictureRenderingFlags.cpp | 3 +-- 29 files changed, 79 insertions(+), 127 deletions(-) delete mode 100644 include/gpu/GrContextOptions.h diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 2fba1f0533..85685fb3bc 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -47,8 +47,6 @@ SkAutoTDelete gGrFactory; #endif - struct GrContextOptions; - __SK_FORCE_IMAGE_DECODER_LINKING; static const int kAutoTuneLoops = 0; @@ -846,7 +844,7 @@ int nanobench_main() { SkTaskGroup::Enabler enabled; #if SK_SUPPORT_GPU - GrContextOptions grContextOpts; + GrContext::Options grContextOpts; grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts))); #endif diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index e56175b58e..9f8ab72736 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -16,7 +16,6 @@ '<(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 be62d8a851..580017a9fe 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -14,8 +14,6 @@ #include "SkRefCnt.h" #include "SkString.h" -struct GrContextOptions; - class GrShaderCaps : public SkRefCnt { public: SK_DECLARE_INST_COUNT(GrShaderCaps) @@ -105,7 +103,7 @@ class GrCaps : public SkRefCnt { public: SK_DECLARE_INST_COUNT(GrCaps) - GrCaps(const GrContextOptions&); + GrCaps(); virtual SkString dump() const; @@ -188,11 +186,6 @@ public: return fConfigTextureSupport[config]; } - bool suppressPrints() const { return fSupressPrints; } - - bool drawPathMasksToCompressedTexturesSupport() const { - return fDrawPathMasksToCompressedTextureSupport; } - protected: SkAutoTUnref fShaderCaps; @@ -221,9 +214,6 @@ 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 b6fef3d80c..a6fdf75d89 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -20,7 +20,6 @@ class GrAARectRenderer; class GrBatchFontCache; -struct GrContextOptions; class GrDrawTarget; class GrFragmentProcessor; class GrGpu; @@ -47,11 +46,20 @@ 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 GrContextOptions& options); - static GrContext* Create(GrBackend, GrBackendContext); + static GrContext* Create(GrBackend, GrBackendContext, const Options* opts = NULL); /** * Only defined in test apps. @@ -522,6 +530,7 @@ 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*); @@ -539,6 +548,12 @@ 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; @@ -584,10 +599,11 @@ private: int fMaxTextureSizeOverride; + const Options fOptions; const uint32_t fUniqueID; - GrContext(); // init must be called after the constructor. - bool init(GrBackend, GrBackendContext, const GrContextOptions& options); + GrContext(const Options&); // init must be called after the constructor. + bool init(GrBackend, GrBackendContext); void initMockContext(); void initCommon(); diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h deleted file mode 100644 index a2b2d2d9d7..0000000000 --- a/include/gpu/GrContextOptions.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 "GrTypes.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 9202742df9..eaf1aa4050 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -265,13 +265,13 @@ private: }; #ifdef SK_DEBUG -// Takes a pointer to a GrCaps, and will suppress prints if required -#define GrCapsDebugf(caps, ...) \ - if (!caps->suppressPrints()) { \ - SkDebugf(__VA_ARGS__); \ +// Takes a pointer to a GrContext, and will suppress prints if required +#define GrContextDebugf(context, ...) \ + if (!context->suppressPrints()) { \ + SkDebugf(__VA_ARGS__); \ } #else -#define GrCapsDebugf(caps, ...) +#define GrContextDebugf(context, ...) #endif #endif diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 3ed0b6baa2..f4ca6c480e 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -15,7 +15,6 @@ #include "GrBatchTarget.h" #include "GrBatchTest.h" #include "GrCaps.h" -#include "GrContextOptions.h" #include "GrDefaultGeoProcFactory.h" #include "GrGpuResource.h" #include "GrGpuResourcePriv.h" @@ -71,16 +70,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 GrContextOptions& options) { - GrContext* context = SkNEW(GrContext); + const Options* opts) { + GrContext* context; + if (NULL == opts) { + context = SkNEW_ARGS(GrContext, (Options())); + } else { + context = SkNEW_ARGS(GrContext, (*opts)); + } - if (context->init(backend, backendContext, options)) { + if (context->init(backend, backendContext)) { return context; } else { context->unref(); @@ -97,7 +96,7 @@ static int32_t next_id() { return id; } -GrContext::GrContext() : fUniqueID(next_id()) { +GrContext::GrContext(const Options& opts) : fOptions(opts), fUniqueID(next_id()) { fGpu = NULL; fResourceCache = NULL; fResourceProvider = NULL; @@ -111,11 +110,10 @@ GrContext::GrContext() : fUniqueID(next_id()) { fMaxTextureSizeOverride = 1 << 20; } -bool GrContext::init(GrBackend backend, GrBackendContext backendContext, - const GrContextOptions& options) { +bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { SkASSERT(NULL == fGpu); - fGpu = GrGpu::Create(backend, backendContext, options, this); + fGpu = GrGpu::Create(backend, backendContext, this); if (NULL == fGpu) { return false; } diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp index 7df19177eb..1a3864ac14 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(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 7fd4b77ce0..353e3d9c96 100644 --- a/src/gpu/GrContextFactory.h +++ b/src/gpu/GrContextFactory.h @@ -9,7 +9,6 @@ #define GrContextFactory_DEFINED #include "GrContext.h" -#include "GrContextOptions.h" #include "gl/SkGLContext.h" #include "SkTArray.h" @@ -81,7 +80,7 @@ public: } } - explicit GrContextFactory(const GrContextOptions& opts) : fGlobalOptions(opts) { } + explicit GrContextFactory(const GrContext::Options& opts) : fGlobalOptions(opts) { } GrContextFactory() { } ~GrContextFactory() { this->destroyContexts(); } @@ -127,7 +126,7 @@ public: return NULL; } - const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; } + const GrContext::Options& getGlobalOptions() const { return fGlobalOptions; } private: struct GPUContext { @@ -136,7 +135,7 @@ private: GrContext* fGrContext; }; SkTArray fContexts; - const GrContextOptions fGlobalOptions; + const GrContext::Options fGlobalOptions; }; #endif diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index e5baaa7404..2d5d0b8ee6 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -11,7 +11,6 @@ #include "GrBatch.h" #include "GrCaps.h" #include "GrContext.h" -#include "GrContextOptions.h" #include "GrPath.h" #include "GrPipeline.h" #include "GrMemoryPool.h" @@ -69,8 +68,8 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil drawBounds->roundOut(&drawIBounds); if (!copyRect.intersect(drawIBounds)) { #ifdef SK_DEBUG - GrCapsDebugf(fCaps, "Missed an early reject. " - "Bailing on draw from setupDstReadIfNecessary.\n"); + GrContextDebugf(fContext, "Missed an early reject. " + "Bailing on draw from setupDstReadIfNecessary.\n"); #endif return false; } @@ -599,7 +598,7 @@ SkString GrShaderCaps::dump() const { /////////////////////////////////////////////////////////////////////////////// -GrCaps::GrCaps(const GrContextOptions& options) { +GrCaps::GrCaps() { fMipMapSupport = false; fNPOTTextureTileSupport = false; fTwoSidedStencilSupport = false; @@ -622,9 +621,6 @@ GrCaps::GrCaps(const GrContextOptions& options) { 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 5b5be1b69b..6e8dc43f75 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, const GrContextOptions&, GrContext* context); + static GrGpu* Create(GrBackend, GrBackendContext, GrContext* context); //////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GrGpuFactory.cpp b/src/gpu/GrGpuFactory.cpp index 3001a0d41a..bd572e6860 100644 --- a/src/gpu/GrGpuFactory.cpp +++ b/src/gpu/GrGpuFactory.cpp @@ -20,13 +20,10 @@ GrGpuFactoryRegistrar::GrGpuFactoryRegistrar(int i, CreateGpuProc proc) { gGpuFactories[i] = proc; } -GrGpu* GrGpu::Create(GrBackend backend, - GrBackendContext backendContext, - const GrContextOptions& options, - GrContext* context) { +GrGpu* GrGpu::Create(GrBackend backend, GrBackendContext backendContext, GrContext* context) { SkASSERT((int)backend < kMaxNumBackends); if (!gGpuFactories[backend]) { return NULL; } - return (gGpuFactories[backend])(backendContext, options, context); + return (gGpuFactories[backend])(backendContext, context); } diff --git a/src/gpu/GrGpuFactory.h b/src/gpu/GrGpuFactory.h index aecc2c1705..180f264d96 100644 --- a/src/gpu/GrGpuFactory.h +++ b/src/gpu/GrGpuFactory.h @@ -12,9 +12,8 @@ class GrGpu; class GrContext; -struct GrContextOptions; -typedef GrGpu* (*CreateGpuProc)(GrBackendContext, const GrContextOptions& options, GrContext*); +typedef GrGpu* (*CreateGpuProc)(GrBackendContext, GrContext*); class GrGpuFactoryRegistrar { public: diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index 25911866cb..aa922ca170 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->getGpu()->caps()->drawPathMasksToCompressedTexturesSupport() && + fContext->getOptions().fDrawPathToCompressedTexture && choose_compressed_fmt(fContext->getGpu()->caps(), &fCompressedFormat)) { fCompressionMode = kCompress_CompressionMode; } diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp index 8580661fd3..0801d03a6c 100644 --- a/src/gpu/GrTest.cpp +++ b/src/gpu/GrTest.cpp @@ -7,7 +7,6 @@ */ #include "GrTest.h" -#include "GrContextOptions.h" #include "GrGpuResourceCacheAccess.h" #include "GrInOrderDrawBuffer.h" @@ -139,9 +138,7 @@ class GrPipeline; class MockGpu : public GrGpu { public: - MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(context) { - fCaps.reset(SkNEW_ARGS(GrCaps, (options))); - } + MockGpu(GrContext* context) : INHERITED(context) { fCaps.reset(SkNEW(GrCaps)); } ~MockGpu() override {} bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const override { return true; @@ -252,16 +249,15 @@ private: }; GrContext* GrContext::CreateMockContext() { - GrContext* context = SkNEW(GrContext); + GrContext* context = SkNEW_ARGS(GrContext, (Options())); context->initMockContext(); return context; } void GrContext::initMockContext() { - GrContextOptions options; SkASSERT(NULL == fGpu); - fGpu = SkNEW_ARGS(MockGpu, (this, options)); + fGpu = SkNEW_ARGS(MockGpu, (this)); SkASSERT(fGpu); this->initCommon(); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 6f272b7b8e..2a97137f12 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -12,9 +12,7 @@ #include "SkTSearch.h" #include "SkTSort.h" -GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, - const GrGLContextInfo& ctxInfo, - const GrGLInterface* glInterface) : INHERITED(contextOptions) { +GrGLCaps::GrGLCaps(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface) { fVerifiedColorConfigs.reset(); fStencilFormats.reset(); fStencilVerifiedColorConfigs.reset(); diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 9d38c82ced..cd84242292 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -91,8 +91,7 @@ public: * Initializes the GrGLCaps to the set of features supported in the current * OpenGL context accessible via ctxInfo. */ - GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxInfo, - const GrGLInterface* glInterface); + GrGLCaps(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 335986508d..8115687093 100644 --- a/src/gpu/gl/GrGLContext.cpp +++ b/src/gpu/gl/GrGLContext.cpp @@ -9,7 +9,7 @@ //////////////////////////////////////////////////////////////////////////////// -GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContextOptions& options) { +GrGLContext* GrGLContext::Create(const GrGLInterface* interface) { // We haven't validated the GrGLInterface yet, so check for GetString function pointer if (!interface->fFunctions.fGetString) { return NULL; @@ -55,9 +55,6 @@ GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext args.fIsMesa = GrGLIsMesaFromVersionString(ver); args.fIsChromium = GrGLIsChromiumFromRendererString(renderer); - - args.fContextOptions = &options; - return SkNEW_ARGS(GrGLContext, (args)); } @@ -70,5 +67,5 @@ GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) { fIsMesa = args.fIsMesa; fIsChromium = args.fIsChromium; - fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*args.fContextOptions, *this, fInterface))); + fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*this, fInterface))); } diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h index 50262cf44a..e84c8ecffc 100644 --- a/src/gpu/gl/GrGLContext.h +++ b/src/gpu/gl/GrGLContext.h @@ -15,7 +15,7 @@ #include "GrGLSL.h" #include "GrGLUtil.h" -struct GrContextOptions; +#include "SkString.h" /** * Encapsulates information about an OpenGL context including the OpenGL @@ -51,7 +51,6 @@ protected: GrGLRenderer fRenderer; bool fIsMesa; bool fIsChromium; - const GrContextOptions* fContextOptions; }; GrGLContextInfo(const ConstructorArgs& args); @@ -75,7 +74,7 @@ public: * Creates a GrGLContext from a GrGLInterface and the currently * bound OpenGL context accessible by the GrGLInterface. */ - static GrGLContext* Create(const GrGLInterface* interface, const GrContextOptions& options); + static GrGLContext* Create(const GrGLInterface* interface); const GrGLInterface* interface() const { return fInterface; } diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 3a3b833a8f..07aaaae26b 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -157,8 +157,7 @@ bool GrGLGpu::BlendCoeffReferencesConstant(GrBlendCoeff coeff) { /////////////////////////////////////////////////////////////////////////////// -GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& options, - GrContext* context) { +GrGpu* GrGLGpu::Create(GrBackendContext backendContext, GrContext* context) { SkAutoTUnref glInterface( reinterpret_cast(backendContext)); if (!glInterface) { @@ -169,7 +168,7 @@ GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& if (!glInterface) { return NULL; } - GrGLContext* glContext = GrGLContext::Create(glInterface, options); + GrGLContext* glContext = GrGLContext::Create(glInterface); if (glContext) { return SkNEW_ARGS(GrGLGpu, (glContext, context)); } @@ -1437,7 +1436,7 @@ bool GrGLGpu::flushGLState(const DrawArgs& args) { fCurrentProgram.reset(fProgramCache->getProgram(args)); if (NULL == fCurrentProgram.get()) { - GrCapsDebugf(this->caps(), "Failed to create program!\n"); + GrContextDebugf(this->getContext(), "Failed to create program!\n"); return false; } diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index c777f7792a..d7b11026f5 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -32,8 +32,7 @@ class GrNonInstancedVertices; class GrGLGpu : public GrGpu { public: - static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions& options, - GrContext* context); + static GrGpu* Create(GrBackendContext backendContext, GrContext* context); ~GrGLGpu() override; void contextAbandoned() override; diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp index ce2598e246..ef2f59e664 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) { - GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); + GrContextDebugf(fGpu->getContext(), "Unused uniform in shader\n"); } } #endif diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index a3b0d686a4..28e1fba20c 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) { - GrCapsDebugf(fGpu->caps(), "Program would use too many texture units\n"); + GrContextDebugf(fGpu->getContext(), "Program would use too many texture units\n"); return false; } } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index ca801f9bd0..90aac8b86d 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 - GrContextOptions opts; + GrContext::Options 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 bc1e32ec11..6f95da758b 100644 --- a/tools/CopyTilesRenderer.cpp +++ b/tools/CopyTilesRenderer.cpp @@ -18,7 +18,7 @@ namespace sk_tools { #if SK_SUPPORT_GPU - CopyTilesRenderer::CopyTilesRenderer(const GrContextOptions& opts, int x, int y) + CopyTilesRenderer::CopyTilesRenderer(const GrContext::Options& opts, int x, int y) : INHERITED(opts) , fXTilesPerLargeTile(x) , fYTilesPerLargeTile(y) { } diff --git a/tools/CopyTilesRenderer.h b/tools/CopyTilesRenderer.h index 5ff4175eed..3d9a1eb18c 100644 --- a/tools/CopyTilesRenderer.h +++ b/tools/CopyTilesRenderer.h @@ -11,7 +11,6 @@ #include "PictureRenderer.h" #include "SkTypes.h" -struct GrContextOptions; class SkPicture; class SkString; @@ -24,7 +23,7 @@ namespace sk_tools { public: #if SK_SUPPORT_GPU - CopyTilesRenderer(const GrContextOptions &opts, int x, int y); + CopyTilesRenderer(const GrContext::Options &opts, int x, int y); #else CopyTilesRenderer(int x, int y); #endif diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index 0875c5ab65..93701baed9 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -465,7 +465,7 @@ SkString SimplePictureRenderer::getConfigNameInternal() { /////////////////////////////////////////////////////////////////////////////////////////////// #if SK_SUPPORT_GPU -TiledPictureRenderer::TiledPictureRenderer(const GrContextOptions& opts) +TiledPictureRenderer::TiledPictureRenderer(const GrContext::Options& opts) : INHERITED(opts) , fTileWidth(kDefaultTileWidth) #else diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h index fadf97085f..e1434686c6 100644 --- a/tools/PictureRenderer.h +++ b/tools/PictureRenderer.h @@ -28,7 +28,6 @@ #include "image_expectations.h" -struct GrContextOptions; class SkBitmap; class SkCanvas; class SkGLContext; @@ -393,7 +392,7 @@ public: return fGrContext; } - const GrContextOptions& getGrContextOptions() { + const GrContext::Options& getGrContextOptions() { return fGrContextFactory.getGlobalOptions(); } #endif @@ -407,7 +406,7 @@ public: } #if SK_SUPPORT_GPU - explicit PictureRenderer(const GrContextOptions &opts) + explicit PictureRenderer(const GrContext::Options &opts) #else PictureRenderer() #endif @@ -499,7 +498,7 @@ private: class RecordPictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - RecordPictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { } + RecordPictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } #endif bool render(SkBitmap** out = NULL) override; @@ -520,7 +519,7 @@ private: class PipePictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - PipePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { } + PipePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } #endif bool render(SkBitmap** out = NULL) override; @@ -534,7 +533,7 @@ private: class SimplePictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - SimplePictureRenderer(const GrContextOptions &opts) : INHERITED(opts) { } + SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } #endif virtual void init(const SkPicture* pict, @@ -555,7 +554,7 @@ private: class TiledPictureRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - TiledPictureRenderer(const GrContextOptions &opts); + TiledPictureRenderer(const GrContext::Options &opts); #else TiledPictureRenderer(); #endif @@ -690,7 +689,7 @@ private: class PlaybackCreationRenderer : public PictureRenderer { public: #if SK_SUPPORT_GPU - PlaybackCreationRenderer(const GrContextOptions &opts) : INHERITED(opts) { } + PlaybackCreationRenderer(const GrContext::Options &opts) : INHERITED(opts) { } #endif void setup() override; @@ -710,7 +709,7 @@ private: }; #if SK_SUPPORT_GPU -extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& opts); +extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts); #else extern PictureRenderer* CreateGatherPixelRefsRenderer(); #endif diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp index 0cec3e17be..82097e9819 100644 --- a/tools/PictureRenderingFlags.cpp +++ b/tools/PictureRenderingFlags.cpp @@ -8,7 +8,6 @@ #include "PictureRenderingFlags.h" #include "CopyTilesRenderer.h" -#include "GrContextOptions.h" #include "PictureRenderer.h" #include "picture_utils.h" #include "SkCommandLineFlags.h" @@ -95,7 +94,7 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { const char* mode = NULL; #if SK_SUPPORT_GPU - GrContextOptions grContextOpts; + GrContext::Options grContextOpts; grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; #define RENDERER_ARGS (grContextOpts) #else -- cgit v1.2.3