Module: wine Branch: master Commit: 4fbaab20201b73b074abefd36b808a63571579ab URL: http://source.winehq.org/git/wine.git/?a=commit;h=4fbaab20201b73b074abefd36b...
Author: Stefan Dösinger stefan@codeweavers.com Date: Thu Apr 23 11:28:15 2015 +0200
wined3d: Shadow format flags in wined3d_rendertarget_view.
---
dlls/wined3d/shader.c | 4 ++-- dlls/wined3d/state.c | 8 ++++---- dlls/wined3d/utils.c | 4 ++-- dlls/wined3d/view.c | 1 + dlls/wined3d/wined3d_private.h | 1 + 5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index d5a90c0..c249c9a 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 91f3485..b025dff 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 1686e30..5596375 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 9cda64d..83cd772 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 782f54f..dd2a85a 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;