From f870cf9282333e397dcaa0d5b26218635a886478 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 24 Feb 2021 22:57:05 +0100 Subject: [PATCH] wined3d: Load/invalidate entire views in ffp_blitter_clear_rendertargets(). In particular, clearing a multi-layer view affects all layers, not just the first. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d10core/tests/d3d10core.c | 4 ++-- dlls/d3d11/tests/d3d11.c | 4 ++-- dlls/wined3d/texture.c | 21 ++++++++------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index a5b2620d98a..b2a2e2028f2 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -11250,12 +11250,12 @@ static void test_clear_render_target_view_2d(void) get_texture_readback(texture, 3, &rb); colour = get_readback_color(&rb, 8, 8); - todo_wine ok(compare_color(colour, 0x8000ff00, 1), "Got unexpected colour 0x%08x.\n", colour); + ok(compare_color(colour, 0x8000ff00, 1), "Got unexpected colour 0x%08x.\n", colour); release_resource_readback(&rb); get_texture_readback(texture, 4, &rb); colour = get_readback_color(&rb, 8, 8); - todo_wine ok(compare_color(colour, 0x80ff0000, 1), "Got unexpected colour 0x%08x.\n", colour); + ok(compare_color(colour, 0x80ff0000, 1), "Got unexpected colour 0x%08x.\n", colour); release_resource_readback(&rb); ID3D10RenderTargetView_Release(rtv[2]); diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index a331baf48a0..c40593d31d8 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -15580,12 +15580,12 @@ static void test_clear_render_target_view_2d(void) get_texture_readback(texture, 3, &rb); colour = get_readback_color(&rb, 8, 8, 0); - todo_wine ok(compare_color(colour, 0x8000ff00, 1), "Got unexpected colour 0x%08x.\n", colour); + ok(compare_color(colour, 0x8000ff00, 1), "Got unexpected colour 0x%08x.\n", colour); release_resource_readback(&rb); get_texture_readback(texture, 4, &rb); colour = get_readback_color(&rb, 8, 8, 0); - todo_wine ok(compare_color(colour, 0x80ff0000, 1), "Got unexpected colour 0x%08x.\n", colour); + ok(compare_color(colour, 0x80ff0000, 1), "Got unexpected colour 0x%08x.\n", colour); release_resource_readback(&rb); ID3D11RenderTargetView_Release(rtv[2]); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index b53cd02d75c..d6408fb1c7a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -5366,12 +5366,10 @@ static void ffp_blitter_clear_rendertargets(struct wined3d_device *device, unsig if (rtv && rtv->format->id != WINED3DFMT_NULL) { - struct wined3d_texture *rt = wined3d_texture_from_resource(rtv->resource); - if (flags & WINED3DCLEAR_TARGET && !is_full_clear(rtv, draw_rect, rect_count ? clear_rect : NULL)) - wined3d_texture_load_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding); + wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding); else - wined3d_texture_prepare_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding); + wined3d_rendertarget_view_prepare_location(rtv, context, rtv->resource->draw_binding); } } @@ -5392,18 +5390,17 @@ static void ffp_blitter_clear_rendertargets(struct wined3d_device *device, unsig if (depth_stencil) { DWORD ds_location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; - struct wined3d_texture *ds = wined3d_texture_from_resource(dsv->resource); if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL) && !is_full_clear(dsv, draw_rect, rect_count ? clear_rect : NULL)) - wined3d_texture_load_location(ds, dsv->sub_resource_idx, context, ds_location); + wined3d_rendertarget_view_load_location(dsv, context, ds_location); else - wined3d_texture_prepare_location(ds, dsv->sub_resource_idx, context, ds_location); + wined3d_rendertarget_view_prepare_location(dsv, context, ds_location); if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { - wined3d_texture_validate_location(ds, dsv->sub_resource_idx, ds_location); - wined3d_texture_invalidate_location(ds, dsv->sub_resource_idx, ~ds_location); + wined3d_rendertarget_view_validate_location(dsv, ds_location); + wined3d_rendertarget_view_invalidate_location(dsv, ~ds_location); } } @@ -5443,7 +5440,6 @@ static void ffp_blitter_clear_rendertargets(struct wined3d_device *device, unsig for (i = 0; i < rt_count; ++i) { struct wined3d_rendertarget_view *rtv = fb->render_targets[i]; - struct wined3d_texture *texture; if (!rtv) continue; @@ -5454,9 +5450,8 @@ static void ffp_blitter_clear_rendertargets(struct wined3d_device *device, unsig continue; } - texture = texture_from_resource(rtv->resource); - wined3d_texture_validate_location(texture, rtv->sub_resource_idx, rtv->resource->draw_binding); - wined3d_texture_invalidate_location(texture, rtv->sub_resource_idx, ~rtv->resource->draw_binding); + wined3d_rendertarget_view_validate_location(rtv, rtv->resource->draw_binding); + wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding); } if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context->d3d_info, state, fb))