Module: wine Branch: master Commit: 74dc66ca576b741d405e20b457e7a509baba7973 URL: https://source.winehq.org/git/wine.git/?a=commit;h=74dc66ca576b741d405e20b45...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Sep 20 18:26:27 2019 +0430
wined3d: More accurately determine whether a separate sRGB texture is required.
Read control is irrelevant without WINED3D_BIND_SHADER_RESOURCE, write control is irrelevant without WINED3D_BIND_RENDER_TARGET.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 1d30cb315c..58977f8cd1 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,