wined3d: Add sRGB writes to the shader backend and fragment pipe caps.

This commit is contained in:
Henri Verbeet 2013-01-22 11:34:07 +01:00 committed by Alexandre Julliard
parent bb163ef0b9
commit 5ce220eb2f
4 changed files with 19 additions and 8 deletions

View file

@ -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 |

View file

@ -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;

View file

@ -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

View file

@ -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
{