[Mesa-dev] [PATCH 1/5] mesa: add gl_driver_flags::NewFramebufferSRGB

Marek Olšák maraeo at gmail.com
Mon Jun 5 16:50:22 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

_NEW_BUFFERS updates too much stuff.
---
 src/mesa/main/enable.c | 5 ++++-
 src/mesa/main/mtypes.h | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index ef278a3..0e07f4c 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -251,21 +251,24 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state)
 
 /**
  * Helper function to enable or disable GL_FRAMEBUFFER_SRGB, skipping the
  * check for whether the API supports it (GLES doesn't).
  */
 void
 _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state)
 {
    if (ctx->Color.sRGBEnabled == state)
       return;
-   FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
+   /* TODO: Switch i965 to the new flag and remove the conditional */
+   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewFramebufferSRGB ? 0 : _NEW_BUFFERS);
+   ctx->NewDriverState |= ctx->DriverFlags.NewFramebufferSRGB;
    ctx->Color.sRGBEnabled = state;
 
    if (ctx->Driver.Enable) {
       ctx->Driver.Enable(ctx, GL_FRAMEBUFFER_SRGB, state);
    }
 }
 
 /**
  * Helper function to enable or disable state.
  *
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9ef1b18..b7e7612 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4390,20 +4390,23 @@ struct gl_driver_flags
 
    /**
     * gl_context::TessCtrlProgram::patch_default_*
     */
    uint64_t NewDefaultTessLevels;
 
    /**
     * gl_context::IntelConservativeRasterization
     */
    uint64_t NewIntelConservativeRasterization;
+
+   /** gl_context::Color::sRGBEnabled */
+   uint64_t NewFramebufferSRGB;
 };
 
 struct gl_uniform_buffer_binding
 {
    struct gl_buffer_object *BufferObject;
    /** Start of uniform block data in the buffer */
    GLintptr Offset;
    /** Size of data allowed to be referenced from the buffer (in bytes) */
    GLsizeiptr Size;
    /**
-- 
2.7.4



More information about the mesa-dev mailing list