wined3d: Properly check if sRGB writes should be enabled in context_apply_clear_state().

In particular, while enabling sRGB writes is harmless for framebuffers that
are not sRGB capable, the default framebuffer may be sRGB capable regardless
of the associated wined3d format.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-03-17 16:30:01 +01:00 committed by Alexandre Julliard
parent 966a07149a
commit cb9704a979
1 changed files with 2 additions and 3 deletions

View File

@ -2606,10 +2606,9 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
* performance incredibly. */
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
if (gl_info->supported[ARB_FRAMEBUFFER_SRGB])
if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB])
{
if (!(context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
|| device->state.render_states[WINED3D_RS_SRGBWRITEENABLE])
if (needs_srgb_write(context, &device->state, fb))
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);