Matteo Bruni : wined3d: Correctly handle GL implementations not supporting sRGB FBO attachments.

Alexandre Julliard julliard at winehq.org
Mon Jan 30 15:39:17 CST 2017


Module: wine
Branch: master
Commit: 9fc3444d6ed8ad0e124a77d2faf1e2cc6639f40f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9fc3444d6ed8ad0e124a77d2faf1e2cc6639f40f

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Fri Jan 27 19:52:54 2017 +0100

wined3d: Correctly handle GL implementations not supporting sRGB FBO attachments.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/directx.c |  1 +
 dlls/wined3d/utils.c   | 14 +++++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 944a4a3..d456772 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3893,6 +3893,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
         /* Current wined3d sRGB infrastructure requires EXT_texture_sRGB_decode
          * for GL_ARB_framebuffer_sRGB support (without EXT_texture_sRGB_decode
          * we never render to sRGB surfaces). */
+        TRACE("EXT_texture_sRGB_decode is not supported, disabling ARB_framebuffer_sRGB.\n");
         gl_info->supported[ARB_FRAMEBUFFER_SRGB] = FALSE;
     }
     if (gl_info->supported[ARB_OCCLUSION_QUERY])
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index d7f2182..1976bc6 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -1220,7 +1220,7 @@ static const struct wined3d_format_texture_info format_texture_info[] =
             WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_RENDERTARGET,
             EXT_PACKED_FLOAT},
     /* Palettized formats */
-    {WINED3DFMT_P8_UINT,                GL_R8,                            GL_R8,                              0,
+    {WINED3DFMT_P8_UINT,                GL_R8,                            GL_R8,                                  0,
             GL_RED,                     GL_UNSIGNED_BYTE,                 0,
             0,
             ARB_TEXTURE_RG,             NULL},
@@ -2382,11 +2382,14 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
                 TRACE("Format %s's sRGB format is FBO attachable, type %u.\n",
                         debug_d3dformat(format->id), type);
                 format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
+                if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
+                    format->glInternal = format->glGammaInternal;
             }
             else
             {
                 WARN("Format %s's sRGB format is not FBO attachable, type %u.\n",
                         debug_d3dformat(format->id), type);
+                format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
             }
         }
         else if (status == GL_FRAMEBUFFER_COMPLETE)
@@ -2523,11 +2526,14 @@ static void init_format_fbo_compat_info(struct wined3d_caps_gl_ctx *ctx)
                         TRACE("Format %s's sRGB format is FBO attachable, resource type %u.\n",
                                 debug_d3dformat(format->id), type);
                         format->flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
+                        if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
+                            format->glInternal = format->glGammaInternal;
                     }
                     else
                     {
                         WARN("Format %s's sRGB format is not FBO attachable, resource type %u.\n",
                                 debug_d3dformat(format->id), type);
+                        format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
                     }
                 }
                 else if (format->flags[type] & WINED3DFMT_FLAG_FBO_ATTACHABLE)
@@ -2739,7 +2745,8 @@ static void query_internal_format(struct wined3d_adapter *adapter,
 
             if (!(format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE)))
                 format->glGammaInternal = format->glInternal;
-            else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
+            else if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
+                    && gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
                 format->glInternal = format->glGammaInternal;
         }
     }
@@ -2761,7 +2768,8 @@ static void query_internal_format(struct wined3d_adapter *adapter,
                 format->glGammaInternal = format->glInternal;
                 format_clear_flag(format, WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
             }
-            else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
+            else if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
+                    && gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
             {
                 format->glInternal = format->glGammaInternal;
             }




More information about the wine-cvs mailing list