Henri Verbeet : wined3d: Filter sRGB capabilities during format initialization.

Alexandre Julliard julliard at winehq.org
Mon Feb 28 11:02:06 CST 2011


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

Author: Henri Verbeet <hverbeet at gmail.com>
Date:   Mon Feb 28 08:05:36 2011 +0100

wined3d: Filter sRGB capabilities during format initialization.

---

 dlls/wined3d/directx.c       |    2 +-
 dlls/wined3d/utils.c         |    8 ++++++++
 dlls/wined3d/volumetexture.c |    3 +--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 899011e..d80df10 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3159,7 +3159,7 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
 
 static BOOL CheckSrgbReadCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format)
 {
-    return adapter->gl_info.supported[EXT_TEXTURE_SRGB] && (format->flags & WINED3DFMT_FLAG_SRGB_READ);
+    return format->flags & WINED3DFMT_FLAG_SRGB_READ;
 }
 
 static BOOL CheckSrgbWriteCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 220e5fe..4c91644 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -1197,6 +1197,14 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
         format->flags |= format_texture_info[i].flags;
         format->heightscale = 1.0f;
 
+        /* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */
+        if (!gl_info->supported[EXT_TEXTURE_SRGB]
+                && format->glGammaInternal != format->glInternal)
+        {
+            format->glGammaInternal = format->glInternal;
+            format->flags &= ~(WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
+        }
+
         /* Texture conversion stuff */
         format->convert = format_texture_info[i].convert;
         format->conv_byte_count = format_texture_info[i].conv_byte_count;
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index 7da1cf1..37c51bb 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -40,7 +40,6 @@ static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
 static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
 {
     IWineD3DDeviceImpl *device = texture->resource.device;
-    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     struct wined3d_context *context = NULL;
     BOOL srgb_mode = texture->baseTexture.is_srgb;
     BOOL srgb_was_toggled = FALSE;
@@ -49,7 +48,7 @@ static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3D
     TRACE("texture %p, srgb %#x.\n", texture, srgb);
 
     if (!device->isInDraw) context = context_acquire(device, NULL);
-    else if (gl_info->supported[EXT_TEXTURE_SRGB] && texture->baseTexture.bindCount > 0)
+    else if (texture->baseTexture.bindCount > 0)
     {
         srgb_mode = device->stateBlock->state.sampler_states[texture->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE];
         srgb_was_toggled = texture->baseTexture.is_srgb != srgb_mode;




More information about the wine-cvs mailing list