diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index d5a90c09256..c249c9a4963 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2344,8 +2344,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE]) { - const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; - if (rt_format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + unsigned int rt_fmt_flags = state->fb->render_targets[0]->format_flags; + if (rt_fmt_flags & WINED3DFMT_FLAG_SRGB_WRITE) { static unsigned int warned = 0; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 91f348565c7..b025dff7110 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -368,6 +368,7 @@ static GLenum gl_blend_factor(enum wined3d_blend factor, const struct wined3d_fo static void state_blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; + unsigned int rt_fmt_flags = state->fb->render_targets[0]->format_flags; const struct wined3d_gl_info *gl_info = context->gl_info; GLenum srcBlend, dstBlend; enum wined3d_blend d3d_blend; @@ -381,7 +382,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st /* Disable blending in all cases even without pixelshaders. * With blending on we could face a big performance penalty. * The d3d9 visual test confirms the behavior. */ - if (context->render_offscreen && !(rt_format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) + if (context->render_offscreen && !(rt_fmt_flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { gl_info->gl_ops.gl.p_glDisable(GL_BLEND); checkGLcall("glDisable GL_BLEND"); @@ -4899,13 +4900,12 @@ static void psorigin(struct wined3d_context *context, const struct wined3d_state void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; + unsigned int rt_fmt_flags = state->fb->render_targets[0]->format_flags; const struct wined3d_gl_info *gl_info = context->gl_info; TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); - if (state->render_states[WINED3D_RS_SRGBWRITEENABLE] - && rt_format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + if (state->render_states[WINED3D_RS_SRGBWRITEENABLE] && rt_fmt_flags & WINED3DFMT_FLAG_SRGB_WRITE) gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 1686e3072df..5596375aeeb 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3686,7 +3686,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d unsigned int i; DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; - const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; + unsigned int rt_fmt_flags = state->fb->render_targets[0]->format_flags; const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_d3d_info *d3d_info = context->d3d_info; @@ -3902,7 +3902,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d } if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE] - && rt_format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + && rt_fmt_flags & WINED3DFMT_FLAG_SRGB_WRITE) { settings->sRGB_write = 1; } else { diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 9cda64d921f..83cd77202a9 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -101,6 +101,7 @@ static void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *vie view->parent_ops = parent_ops; view->format = wined3d_get_format(gl_info, desc->format_id); + view->format_flags = view->format->flags; if (resource->type == WINED3D_RTYPE_BUFFER) { view->sub_resource_idx = 0; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 782f54f6d05..dd2a85ad536 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2692,6 +2692,7 @@ struct wined3d_rendertarget_view const struct wined3d_parent_ops *parent_ops; const struct wined3d_format *format; + unsigned int format_flags; unsigned int sub_resource_idx; unsigned int buffer_offset;