[virglrenderer-devel] [PATCH 15/16] vrend: Warn on SRGB Framebuffers

Jakob Bornecrantz jakob.bornecrantz at collabora.com
Fri Dec 22 18:57:55 UTC 2017


Not supported in GLES, this silences lots of errors.

Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz at collabora.com>
---
 src/vrend_renderer.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index cb672fd..d28ffde 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -507,8 +507,9 @@ static void __report_core_warn(const char *fname, struct vrend_context *ctx, enu
 #define GLES_WARN_DEPTH_RANGE 3
 #define GLES_WARN_POINT_SIZE 4
 #define GLES_WARN_LOD_BIAS 5
+#define GLES_WARN_SRGB_FB 6
 
-static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode", "Depth Range", "Point Size", "Lod Bias" };
+static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode", "Depth Range", "Point Size", "Lod Bias", "SRGB Framebuffer" };
 
 static void __report_gles_warn(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value)
 {
@@ -1513,7 +1514,9 @@ static void vrend_hw_emit_framebuffer_state(struct vrend_context *ctx)
 
    if (ctx->sub->nr_cbufs == 0) {
       glReadBuffer(GL_NONE);
-      glDisable(GL_FRAMEBUFFER_SRGB_EXT);
+      if (!vrend_state.use_gles) {
+         glDisable(GL_FRAMEBUFFER_SRGB_EXT);
+      }
    } else {
       struct vrend_surface *surf = NULL;
       int i;
@@ -1523,9 +1526,15 @@ static void vrend_hw_emit_framebuffer_state(struct vrend_context *ctx)
          }
       }
       if (util_format_is_srgb(surf->format)) {
-         glEnable(GL_FRAMEBUFFER_SRGB_EXT);
+         if (!vrend_state.use_gles) {
+            glEnable(GL_FRAMEBUFFER_SRGB_EXT);
+         } else {
+            report_gles_warn(ctx, GLES_WARN_SRGB_FB, 0);
+         }
       } else {
-         glDisable(GL_FRAMEBUFFER_SRGB_EXT);
+         if (!vrend_state.use_gles) {
+            glDisable(GL_FRAMEBUFFER_SRGB_EXT);
+         }
       }
    }
    glDrawBuffers(ctx->sub->nr_cbufs, buffers);
-- 
2.11.0



More information about the virglrenderer-devel mailing list