[PATCH 2/5] wined3d: More accurately determine whether a separate sRGB texture is required.
Henri Verbeet
hverbeet at codeweavers.com
Fri Sep 20 08:38:27 CDT 2019
Read control is irrelevant without WINED3D_BIND_SHADER_RESOURCE, write control
is irrelevant without WINED3D_BIND_RENDER_TARGET.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
dlls/wined3d/wined3d_private.h | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1d30cb315c2..58977f8cd12 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -5077,12 +5077,20 @@ static inline BOOL is_srgb_enabled(const DWORD *sampler_states)
static inline BOOL needs_separate_srgb_gl_texture(const struct wined3d_context *context,
const struct wined3d_texture *texture)
{
- unsigned int flags = texture->resource.format_flags
- & (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE);
+ if (!(context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
+ return FALSE;
+
+ if (!context->d3d_info->srgb_read_control
+ && (texture->resource.bind_flags & WINED3D_BIND_SHADER_RESOURCE)
+ && (texture->resource.format_flags & WINED3DFMT_FLAG_SRGB_READ))
+ return TRUE;
- return (!context->d3d_info->srgb_read_control
- || (flags && flags != (WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE)))
- && context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL;
+ if (!context->d3d_info->srgb_write_control
+ && (texture->resource.bind_flags & WINED3D_BIND_RENDER_TARGET)
+ && (texture->resource.format_flags & WINED3DFMT_FLAG_SRGB_WRITE))
+ return TRUE;
+
+ return FALSE;
}
static inline BOOL needs_srgb_write(const struct wined3d_context *context,
--
2.11.0
More information about the wine-devel
mailing list