On 8 October 2013 00:27, Stefan Dösinger stefan@codeweavers.com wrote:
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 52eac16..eb8ca7e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -5608,8 +5608,6 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c } }
if (location == SFLAG_INSRGBTEX && gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
location = SFLAG_INTEXTURE;
if (surface->flags & location) {
@@ -5671,12 +5669,6 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c surface_evict_sysmem(surface); }
- if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)
&& gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
- {
surface->flags |= (SFLAG_INTEXTURE | SFLAG_INSRGBTEX);
- }
- return WINED3D_OK;
}
This change seems good on its own, as far as I can tell all callers already handle this correctly. I'm less sure about the other changes, the texture code seems like the right place to handle EXT_texture_sRGB_decode.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2013-10-08 12:06, schrieb Henri Verbeet:
On 8 October 2013 00:27, Stefan Dösinger stefan@codeweavers.com wrote:
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 52eac16..eb8ca7e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -5608,8 +5608,6 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c } }
- if (location == SFLAG_INSRGBTEX &&
gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) - location = SFLAG_INTEXTURE;
if (surface->flags & location) { @@ -5671,12 +5669,6 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location, c surface_evict_sysmem(surface); }
- if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX) -
&& gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) - { - surface->flags |= (SFLAG_INTEXTURE | SFLAG_INSRGBTEX); - } - return WINED3D_OK; }
This change seems good on its own, as far as I can tell all callers already handle this correctly.
Are you sure? E.g. if a texture is used with srgb=true and sRGB_decode is supported, wined3d_texture_bind sets WINED3D_TEXTURE_IS_SRGB. If the application later calls PreLoad manually, texture2d_preload is called with SRGB_ANY. Because of the set IS_SRGB flag it chooses to load the srgb copy. It correctly uses the rgb texture structure and binds the rgb GL texture, but still passes srgb=true to surface_load(), which results in SFLAG_INSRGBTEX being passed to surface_load_location, even though we want to load the RGB copy.
I'll see if I can simplify the sRGB_decode handling while still keeping it in the texture.
Patches 4 and 5 should apply without this one by the way.
On 8 October 2013 13:44, Stefan Dösinger stefandoesinger@gmail.com wrote:
Are you sure? E.g. if a texture is used with srgb=true and sRGB_decode is supported, wined3d_texture_bind sets WINED3D_TEXTURE_IS_SRGB. If the application later calls PreLoad manually, texture2d_preload is called with SRGB_ANY. Because of the set IS_SRGB flag it chooses to load the srgb copy. It correctly uses the rgb texture structure and binds the rgb GL texture, but still passes srgb=true to surface_load(), which results in SFLAG_INSRGBTEX being passed to surface_load_location, even though we want to load the RGB copy.
Right. It should be pretty easy to fix that by taking EXT_TEXTURE_SRGB_DECODE into account in texture_srgb_mode() though.