diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 0d0db64e853..2df18cd6b89 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5062,7 +5062,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh caps->ps_1x_max_value = 0.0f; } - caps->wined3d_caps = 0; + caps->wined3d_caps = WINED3D_SHADER_CAP_SRGB_WRITE; if (use_nv_clip(gl_info)) caps->wined3d_caps |= WINED3D_SHADER_CAP_VS_CLIPPING; } @@ -5738,7 +5738,8 @@ static void arbfp_free(struct wined3d_device *device) static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { - caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL; + caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL + | WINED3D_FRAGMENT_CAP_SRGB_WRITE; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE | WINED3DTEXOPCAPS_SELECTARG1 | diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e44273492a3..18ea67d0181 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3539,11 +3539,14 @@ static BOOL CheckSrgbWriteCapability(const struct wined3d_adapter *adapter, cons * Note Windows drivers (at least on the Geforce 8800) also offer this on R5G6B5. */ if (format->flags & WINED3DFMT_FLAG_SRGB_WRITE) { - int vs_selected_mode; - int ps_selected_mode; - select_shader_mode(&adapter->gl_info, &ps_selected_mode, &vs_selected_mode); + struct fragment_caps fragment_caps; + struct shader_caps shader_caps; - if ((ps_selected_mode == SHADER_ARB) || (ps_selected_mode == SHADER_GLSL)) + adapter->fragment_pipe->get_caps(&adapter->gl_info, &fragment_caps); + adapter->shader_backend->shader_get_caps(&adapter->gl_info, &shader_caps); + + if ((fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_SRGB_WRITE) + && (shader_caps.wined3d_caps & WINED3D_SHADER_CAP_SRGB_WRITE)) { TRACE("[OK]\n"); return TRUE; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index a9ca2cdfef8..9b000b6b869 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -6205,7 +6205,11 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s */ caps->ps_1x_max_value = 8.0; - caps->wined3d_caps = WINED3D_SHADER_CAP_VS_CLIPPING; + /* Ideally we'd only set caps like sRGB writes here if supported by both + * the shader backend and the fragment pipe, but we can get called before + * shader_glsl_alloc(). */ + caps->wined3d_caps = WINED3D_SHADER_CAP_VS_CLIPPING + | WINED3D_SHADER_CAP_SRGB_WRITE; } static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup) @@ -6392,7 +6396,8 @@ static void glsl_fragment_pipe_enable(const struct wined3d_gl_info *gl_info, BOO static void glsl_fragment_pipe_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { - caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL; + caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL + | WINED3D_FRAGMENT_CAP_SRGB_WRITE; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE | WINED3DTEXOPCAPS_SELECTARG1 diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f59a736d7fe..c66374ab725 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -715,6 +715,7 @@ extern const struct wined3d_shader_frontend sm4_shader_frontend DECLSPEC_HIDDEN; typedef void (*SHADER_HANDLER)(const struct wined3d_shader_instruction *); #define WINED3D_SHADER_CAP_VS_CLIPPING 0x00000001 +#define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002 struct shader_caps { @@ -1175,6 +1176,7 @@ struct StateEntryTemplate }; #define WINED3D_FRAGMENT_CAP_PROJ_CONTROL 0x00000001 +#define WINED3D_FRAGMENT_CAP_SRGB_WRITE 0x00000002 struct fragment_caps {