diff options
-rw-r--r-- | include/gpu/GrContext.h | 13 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 53d479c3b0..90382fd97b 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -253,6 +253,15 @@ public: */ int getMaxTextureSize() const; + /** + * Temporarily override the true max texture size. Note: an override + * larger then the true max texture size will have no effect. + * This entry point is mainly meant for testing texture size dependent + * features and is only available if defined outside of Skia (see + * bleed GM. + */ + void setMaxTextureSizeOverride(int maxTextureSizeOverride); + /////////////////////////////////////////////////////////////////////////// // Render targets @@ -871,7 +880,9 @@ private: void* fInfo; }; - SkTDArray<CleanUpData> fCleanUpData; + SkTDArray<CleanUpData> fCleanUpData; + + int fMaxTextureSizeOverride; GrContext(); // init must be called after the constructor. bool init(GrBackend, GrBackendContext); diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 6eae95eced..3951d919e6 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -102,6 +102,7 @@ GrContext::GrContext() { fAARectRenderer = NULL; fOvalRenderer = NULL; fViewMatrix.reset(); + fMaxTextureSizeOverride = 1 << 20; } bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { @@ -554,7 +555,7 @@ void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) { } int GrContext::getMaxTextureSize() const { - return fGpu->caps()->maxTextureSize(); + return GrMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride); } int GrContext::getMaxRenderTargetSize() const { |