wined3d: Don't attach render targets on clears when unnecessary.

Otherwise we'd limit the cleared area to the size of the render target.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2018-04-26 23:30:13 +02:00 committed by Alexandre Julliard
parent 12016da9e1
commit df99c9b9f4
2 changed files with 28 additions and 23 deletions

View File

@ -19788,9 +19788,12 @@ static void test_multisample_mismatch(void)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
/* Check depth buffer values. AMD GPUs (r500 and evergreen tested) clear the depth buffer
* like you'd expect in a correct framebuffer setup. Nvidia doesn't clear it, neither in
* the Z only clear case nor in the combined clear case. */
/* Check depth buffer values. AMD GPUs (r500 and evergreen tested) clear
* the depth buffer like you'd expect in a correct framebuffer
* setup. Nvidia doesn't clear it, neither in the Z only clear case nor in
* the combined clear case.
* In Wine we currently happen to allow the depth only clear case but
* disallow the combined one. */
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE);
ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
hr = IDirect3DDevice9_BeginScene(device);
@ -19802,7 +19805,7 @@ static void test_multisample_mismatch(void)
color = getPixelColor(device, 62, 240);
ok(color_match(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = getPixelColor(device, 64, 240);
ok(color_match(color, 0x0000ff00, 1) || broken(color_match(color, 0x000000ff, 1)),
ok(color_match(color, 0x0000ff00, 1) || color_match(color, 0x000000ff, 1),
"Got unexpected color 0x%08x.\n", color);
color = getPixelColor(device, 318, 240);
ok(color_match(color, 0x0000ff00, 1) || broken(color_match(color, 0x000000ff, 1)),
@ -23532,26 +23535,25 @@ static void test_null_format(void)
{
unsigned int x, y;
D3DCOLOR color;
BOOL todo;
}
expected_colors[] =
{
{200, 30, 0x0000ff00, FALSE},
{440, 30, 0x0000ff00, FALSE},
{520, 30, 0x0000ff00, FALSE},
{600, 30, 0x0000ff00, FALSE},
{200, 90, 0x00000000, FALSE},
{440, 90, 0x0000ff00, FALSE},
{520, 90, 0x0000ff00, FALSE},
{600, 90, 0x0000ff00, FALSE},
{200, 150, 0x000000ff, FALSE},
{440, 150, 0x000000ff, FALSE},
{520, 150, 0x0000ff00, FALSE},
{600, 150, 0x0000ff00, FALSE},
{200, 320, 0x000000ff, FALSE},
{440, 320, 0x000000ff, FALSE},
{520, 320, 0x00000000, TRUE},
{600, 320, 0x0000ff00, FALSE},
{200, 30, 0x0000ff00},
{440, 30, 0x0000ff00},
{520, 30, 0x0000ff00},
{600, 30, 0x0000ff00},
{200, 90, 0x00000000},
{440, 90, 0x0000ff00},
{520, 90, 0x0000ff00},
{600, 90, 0x0000ff00},
{200, 150, 0x000000ff},
{440, 150, 0x000000ff},
{520, 150, 0x0000ff00},
{600, 150, 0x0000ff00},
{200, 320, 0x000000ff},
{440, 320, 0x000000ff},
{520, 320, 0x00000000},
{600, 320, 0x0000ff00},
};
IDirect3DSurface9 *original_rt, *small_rt, *null_rt, *small_null_rt;
IDirect3DDevice9 *device;
@ -23672,7 +23674,7 @@ static void test_null_format(void)
for (i = 0; i < ARRAY_SIZE(expected_colors); ++i)
{
color = getPixelColor(device, expected_colors[i].x, expected_colors[i].y);
todo_wine_if(expected_colors[i].todo) ok(color_match(color, expected_colors[i].color, 1),
ok(color_match(color, expected_colors[i].color, 1),
"Expected color 0x%08x at (%u, %u), got 0x%08x.\n",
expected_colors[i].color, expected_colors[i].x, expected_colors[i].y, color);
}

View File

@ -542,7 +542,10 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->rt_count = rt_count;
if (flags & WINED3DCLEAR_TARGET)
op->rt_count = rt_count;
else
op->rt_count = 0;
op->fb = &cs->fb;
SetRect(&op->draw_rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height);
if (state->render_states[WINED3D_RS_SCISSORTESTENABLE])