diff options
author | 2016-06-02 05:49:21 -0700 | |
---|---|---|
committer | 2016-06-02 05:49:21 -0700 | |
commit | 33f6b3f6ee4de24282f5e7f2dc31a5f538bcf40c (patch) | |
tree | a42a432cb1d2460a2de870f4506271c720d5b0e7 /src/gpu/gl/GrGLProgram.h | |
parent | 0851d2d04716ad4a7c7a646a5846a81db3d5b925 (diff) |
Manually generated sRGB mipmaps, with successively smaller draws.
Dirty GL-generated mipmaps whenever an sRGB texture is used with a new
value for TEXTURE_SRGB_DECODE. Add a new test rectangle to the gamma GM
that tests that textures are correctly converted to linear before
filtering when generating mipmaps.
Added a new unit test that alternates how a texture is interpreted (sRGB
or not), to verify that we rebuild mipmaps when needed, and that we get
the correct results out in both modes.
This test originally failed on four of our bots producing incorrect mips
in three different ways. I'm not real surprised, but it looks like
we can't rely on glGenerateMipmap to do the right thing, in conjunction
with TEXTURE_SRGB_DECODE.
Instead, actually create mip-chains using a series of draw calls.
(My first attempt used glBlitFramebuffer, and that still had bugs on
several bots). This approach appears to work correctly on any device
that fully supports sRGB.
Because the mipmap draws are fairly destructive to state, I had to
hoist them out of bindTexture. That means adding a second pass over
the texture accesses in the processor, at the very beginning of flush.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1840473002
Review-Url: https://codereview.chromium.org/2007973002
Diffstat (limited to 'src/gpu/gl/GrGLProgram.h')
-rw-r--r-- | src/gpu/gl/GrGLProgram.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 7487a1e900..9f2b2e9b74 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -96,6 +96,12 @@ public: */ void setData(const GrPrimitiveProcessor&, const GrPipeline&); + /** + * This function retrieves the textures that need to be used by each GrGL*Processor, and + * ensures that any textures requiring mipmaps have their mipmaps correctly built. + */ + void generateMipmaps(const GrPrimitiveProcessor&, const GrPipeline&); + protected: typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; @@ -122,6 +128,9 @@ protected: // Helper for setData() that binds textures and texel buffers to the appropriate texture units void bindTextures(const GrProcessor&, bool allowSRGBInputs, int* nextSamplerIdx); + // Helper for generateMipmaps() that ensures mipmaps are up to date + void generateMipmaps(const GrProcessor&, bool allowSRGBInputs); + // these reflect the current values of uniforms (GL uniform values travel with program) RenderTargetState fRenderTargetState; BuiltinUniformHandles fBuiltinUniformHandles; |