Add GrContext::setMaxTextureSizeOverride

https://codereview.chromium.org/20325002/



git-svn-id: http://skia.googlecode.com/svn/trunk@10358 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-07-25 15:32:06 +00:00
parent a9b7936a72
commit 44a91dcf25
2 changed files with 14 additions and 2 deletions

View File

@ -253,6 +253,15 @@ public:
*/ */
int getMaxTextureSize() const; 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 // Render targets
@ -871,7 +880,9 @@ private:
void* fInfo; void* fInfo;
}; };
SkTDArray<CleanUpData> fCleanUpData; SkTDArray<CleanUpData> fCleanUpData;
int fMaxTextureSizeOverride;
GrContext(); // init must be called after the constructor. GrContext(); // init must be called after the constructor.
bool init(GrBackend, GrBackendContext); bool init(GrBackend, GrBackendContext);

View File

@ -102,6 +102,7 @@ GrContext::GrContext() {
fAARectRenderer = NULL; fAARectRenderer = NULL;
fOvalRenderer = NULL; fOvalRenderer = NULL;
fViewMatrix.reset(); fViewMatrix.reset();
fMaxTextureSizeOverride = 1 << 20;
} }
bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { bool GrContext::init(GrBackend backend, GrBackendContext backendContext) {
@ -554,7 +555,7 @@ void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) {
} }
int GrContext::getMaxTextureSize() const { int GrContext::getMaxTextureSize() const {
return fGpu->caps()->maxTextureSize(); return GrMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
} }
int GrContext::getMaxRenderTargetSize() const { int GrContext::getMaxRenderTargetSize() const {