[Piglit] [PATCH - Mesa 08/10] i965: Make BLORP's BlitFramebuffer follow the GL 4.4 sRGB rules.

Kenneth Graunke kenneth at whitecape.org
Thu Aug 4 23:14:49 UTC 2016


OpenGL 4.4 specifies that BlitFramebuffer should perform sRGB encode
and decode like ES 3.x does, but only when GL_FRAMEBUFFER_SRGB is
enabled.  This is technically incompatible in certain cases, but is
more consistent across GL, ES, and WebGL, and more flexible.

The NVIDIA 367.35 drivers appear to follow this behavior.

For the awful spec analysis, please read Piglit's
tests/spec/arb_framebuffer_srgb/blit.c, which explains the differences
between GL 4.1, 4.2, 4.3 (2012), 4.3 (2013), and 4.4, and why this
is the right rule to implement.

Note that ctx->Color.sRGBEnabled is initialized to _mesa_is_gles(ctx),
and ES doesn't have enable/disable flags for GL_FRAMEBUFFER_SRGB, so
it's effectively on all the time.  This means the ES behavior should
be unchanged.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 20bbe7f..b903de1 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -61,11 +61,14 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit,
               GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1,
               GLenum filter, bool mirror_x, bool mirror_y)
 {
+   const struct gl_context *ctx = &brw->ctx;
+
    /* Find source/dst miptrees */
    struct intel_mipmap_tree *src_mt = find_miptree(buffer_bit, src_irb);
    struct intel_mipmap_tree *dst_mt = find_miptree(buffer_bit, dst_irb);
 
-   const bool es = _mesa_is_gles(&brw->ctx);
+   const bool do_srgb = ctx->Color.sRGBEnabled;
+
    /* Do the blit */
    brw_blorp_blit_miptrees(brw,
                            src_mt, src_irb->mt_level, src_irb->mt_layer,
@@ -75,7 +78,7 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit,
                            srcX0, srcY0, srcX1, srcY1,
                            dstX0, dstY0, dstX1, dstY1,
                            filter, mirror_x, mirror_y,
-                           es, es);
+                           do_srgb, do_srgb);
 
    dst_irb->need_downsample = true;
 }
-- 
2.9.2



More information about the Piglit mailing list