wined3d: Invalidate sRGB write state in wined3d_cs_exec_set_rendertarget_view() if needed.
Instead of in wined3d_context_gl_setup_target(). If the render-target view uses an sRGB format, but the underlying resource has a typeless format, we'd potentially miss an invalidation in wined3d_context_gl_setup_target() where we only have access to the underlying resource. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
46c50c03ce
commit
b1c8449954
|
@ -15184,7 +15184,7 @@ static void test_swapchain_views(void)
|
||||||
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
|
ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
|
||||||
|
|
||||||
draw_color_quad(&test_context, &color);
|
draw_color_quad(&test_context, &color);
|
||||||
todo_wine check_texture_color(test_context.backbuffer, 0xffbc957c, 1);
|
check_texture_color(test_context.backbuffer, 0xffbc957c, 1);
|
||||||
|
|
||||||
srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
|
||||||
srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
srv_desc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||||
|
|
|
@ -4122,11 +4122,6 @@ static void wined3d_context_gl_setup_target(struct wined3d_context_gl *context_g
|
||||||
if ((old->alpha_size && !new->alpha_size) || (!old->alpha_size && new->alpha_size)
|
if ((old->alpha_size && !new->alpha_size) || (!old->alpha_size && new->alpha_size)
|
||||||
|| !(texture->resource.format_flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
|
|| !(texture->resource.format_flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
|
||||||
context_invalidate_state(&context_gl->c, STATE_BLEND);
|
context_invalidate_state(&context_gl->c, STATE_BLEND);
|
||||||
|
|
||||||
/* Update sRGB writing when switching between formats that do/do not support sRGB writing */
|
|
||||||
if ((context_gl->c.current_rt.texture->resource.format_flags & WINED3DFMT_FLAG_SRGB_WRITE)
|
|
||||||
!= (texture->resource.format_flags & WINED3DFMT_FLAG_SRGB_WRITE))
|
|
||||||
context_invalidate_state(&context_gl->c, STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When switching away from an offscreen render target, and we're not
|
/* When switching away from an offscreen render target, and we're not
|
||||||
|
|
|
@ -1191,17 +1191,29 @@ void wined3d_device_context_emit_set_scissor_rects(struct wined3d_device_context
|
||||||
static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
|
static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
|
||||||
{
|
{
|
||||||
const struct wined3d_cs_set_rendertarget_view *op = data;
|
const struct wined3d_cs_set_rendertarget_view *op = data;
|
||||||
BOOL prev_alpha_swizzle, curr_alpha_swizzle;
|
bool prev_alpha_swizzle, curr_alpha_swizzle;
|
||||||
struct wined3d_rendertarget_view *prev;
|
struct wined3d_rendertarget_view *prev;
|
||||||
|
bool prev_srgb_write, curr_srgb_write;
|
||||||
|
struct wined3d_device *device;
|
||||||
|
|
||||||
|
device = cs->c.device;
|
||||||
prev = cs->state.fb.render_targets[op->view_idx];
|
prev = cs->state.fb.render_targets[op->view_idx];
|
||||||
cs->state.fb.render_targets[op->view_idx] = op->view;
|
cs->state.fb.render_targets[op->view_idx] = op->view;
|
||||||
device_invalidate_state(cs->c.device, STATE_FRAMEBUFFER);
|
device_invalidate_state(device, STATE_FRAMEBUFFER);
|
||||||
|
|
||||||
prev_alpha_swizzle = prev && prev->format->id == WINED3DFMT_A8_UNORM;
|
prev_alpha_swizzle = prev && prev->format->id == WINED3DFMT_A8_UNORM;
|
||||||
curr_alpha_swizzle = op->view && op->view->format->id == WINED3DFMT_A8_UNORM;
|
curr_alpha_swizzle = op->view && op->view->format->id == WINED3DFMT_A8_UNORM;
|
||||||
if (prev_alpha_swizzle != curr_alpha_swizzle)
|
if (prev_alpha_swizzle != curr_alpha_swizzle)
|
||||||
device_invalidate_state(cs->c.device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL));
|
device_invalidate_state(device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL));
|
||||||
|
|
||||||
|
if (!(device->adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
|
||||||
|
|| cs->state.render_states[WINED3D_RS_SRGBWRITEENABLE])
|
||||||
|
{
|
||||||
|
prev_srgb_write = prev && prev->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
|
||||||
|
curr_srgb_write = op->view && op->view->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
|
||||||
|
if (prev_srgb_write != curr_srgb_write)
|
||||||
|
device_invalidate_state(device, STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wined3d_device_context_emit_set_rendertarget_view(struct wined3d_device_context *context, unsigned int view_idx,
|
void wined3d_device_context_emit_set_rendertarget_view(struct wined3d_device_context *context, unsigned int view_idx,
|
||||||
|
|
Loading…
Reference in New Issue