Commit 4ff594e8 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Don't pass the whole context to needs_srgb_write().

parent d7eba2a9
...@@ -3414,7 +3414,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl, ...@@ -3414,7 +3414,7 @@ BOOL wined3d_context_gl_apply_clear_state(struct wined3d_context_gl *context_gl,
gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB]) if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB])
{ {
if (needs_srgb_write(&context_gl->c, state, fb)) if (needs_srgb_write(context_gl->c.d3d_info, state, fb))
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
......
...@@ -426,7 +426,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c ...@@ -426,7 +426,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
wined3d_texture_invalidate_location(texture, rtv->sub_resource_idx, ~rtv->resource->draw_binding); wined3d_texture_invalidate_location(texture, rtv->sub_resource_idx, ~rtv->resource->draw_binding);
} }
if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, fb)) if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context->d3d_info, state, fb))
{ {
if (rt_count > 1) if (rt_count > 1)
WARN("Clearing multiple sRGB render targets without GL_ARB_framebuffer_sRGB " WARN("Clearing multiple sRGB render targets without GL_ARB_framebuffer_sRGB "
......
...@@ -3904,7 +3904,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 ...@@ -3904,7 +3904,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
unsigned int i; unsigned int i;
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
if (!d3d_info->srgb_write_control && needs_srgb_write(context, state, state->fb)) if (!d3d_info->srgb_write_control && needs_srgb_write(d3d_info, state, state->fb))
{ {
static unsigned int warned = 0; static unsigned int warned = 0;
......
...@@ -4474,7 +4474,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state ...@@ -4474,7 +4474,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
if (needs_srgb_write(context, state, state->fb)) if (needs_srgb_write(context->d3d_info, state, state->fb))
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
......
...@@ -6236,7 +6236,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d ...@@ -6236,7 +6236,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
break; break;
} }
} }
settings->sRGB_write = !d3d_info->srgb_write_control && needs_srgb_write(context, state, state->fb); settings->sRGB_write = !d3d_info->srgb_write_control && needs_srgb_write(d3d_info, state, state->fb);
if (d3d_info->vs_clipping || !use_vs(state) || !state->render_states[WINED3D_RS_CLIPPING] if (d3d_info->vs_clipping || !use_vs(state) || !state->render_states[WINED3D_RS_CLIPPING]
|| !state->render_states[WINED3D_RS_CLIPPLANEENABLE]) || !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{ {
......
...@@ -5118,10 +5118,10 @@ static inline BOOL needs_separate_srgb_gl_texture(const struct wined3d_context * ...@@ -5118,10 +5118,10 @@ static inline BOOL needs_separate_srgb_gl_texture(const struct wined3d_context *
return FALSE; return FALSE;
} }
static inline BOOL needs_srgb_write(const struct wined3d_context *context, static inline BOOL needs_srgb_write(const struct wined3d_d3d_info *d3d_info,
const struct wined3d_state *state, const struct wined3d_fb_state *fb) const struct wined3d_state *state, const struct wined3d_fb_state *fb)
{ {
return (!(context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL) return (!(d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
|| state->render_states[WINED3D_RS_SRGBWRITEENABLE]) || state->render_states[WINED3D_RS_SRGBWRITEENABLE])
&& fb->render_targets[0] && fb->render_targets[0]->format_flags & WINED3DFMT_FLAG_SRGB_WRITE; && fb->render_targets[0] && fb->render_targets[0]->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment