wined3d: Add full dirty region at texture creation.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-03-25 14:56:40 +03:00 committed by Alexandre Julliard
parent eae36aab81
commit 2ce72c6872
3 changed files with 42 additions and 10 deletions

View File

@ -5531,9 +5531,6 @@ static void add_dirty_rect_test(void)
hr = IDirect3DTexture8_GetSurfaceLevel(tex_dynamic, 0, &surface_dynamic);
ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
fill_surface(surface_src_red, 0x00ff0000, 0);
fill_surface(surface_src_green, 0x0000ff00, 0);
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1);
ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr);
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
@ -5543,6 +5540,23 @@ static void add_dirty_rect_test(void)
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
ok(SUCCEEDED(hr), "Failed to set mip filter, hr %#x.\n", hr);
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)tex_dst2);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)tex_src_red,
(IDirect3DBaseTexture8 *)tex_dst2);
fill_surface(surface_src_green, 0x00000080, D3DLOCK_NO_DIRTY_UPDATE);
hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)tex_src_green,
(IDirect3DBaseTexture8 *)tex_dst2);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
add_dirty_rect_test_draw(device);
color = getPixelColor(device, 320, 240);
ok(color_match(color, 0x00000080, 1), "Unexpected colour 0x%08x.\n", color);
hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
fill_surface(surface_src_red, 0x00ff0000, 0);
fill_surface(surface_src_green, 0x0000ff00, 0);
hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)tex_src_green,
(IDirect3DBaseTexture8 *)tex_dst1);
ok(SUCCEEDED(hr), "Failed to update texture, hr %#x.\n", hr);

View File

@ -19394,9 +19394,6 @@ static void add_dirty_rect_test(void)
hr = IDirect3DTexture9_GetSurfaceLevel(tex_dynamic, 0, &surface_dynamic);
ok(SUCCEEDED(hr), "Failed to get surface level, hr %#x.\n", hr);
fill_surface(surface_src_red, 0x00ff0000, 0);
fill_surface(surface_src_green, 0x0000ff00, 0);
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1);
ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
@ -19406,6 +19403,23 @@ static void add_dirty_rect_test(void)
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
ok(SUCCEEDED(hr), "Failed to set sampler state, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)tex_dst2);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)tex_src_red,
(IDirect3DBaseTexture9 *)tex_dst2);
fill_surface(surface_src_green, 0x00000080, D3DLOCK_NO_DIRTY_UPDATE);
hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)tex_src_green,
(IDirect3DBaseTexture9 *)tex_dst2);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
add_dirty_rect_test_draw(device);
color = getPixelColor(device, 320, 240);
ok(color_match(color, 0x00000080, 1), "Unexpected colour 0x%08x.\n", color);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
fill_surface(surface_src_red, 0x00ff0000, 0);
fill_surface(surface_src_green, 0x0000ff00, 0);
hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)tex_src_green,
(IDirect3DBaseTexture9 *)tex_dst1);
ok(SUCCEEDED(hr), "Failed to update texture, hr %#x.\n", hr);

View File

@ -3895,11 +3895,15 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
texture->flags |= WINED3D_TEXTURE_GENERATE_MIPMAPS;
}
if (flags & WINED3D_TEXTURE_CREATE_RECORD_DIRTY_REGIONS
&& !(texture->dirty_regions = heap_calloc(texture->layer_count, sizeof(*texture->dirty_regions))))
if (flags & WINED3D_TEXTURE_CREATE_RECORD_DIRTY_REGIONS)
{
wined3d_texture_cleanup_sync(texture);
return E_OUTOFMEMORY;
if (!(texture->dirty_regions = heap_calloc(texture->layer_count, sizeof(*texture->dirty_regions))))
{
wined3d_texture_cleanup_sync(texture);
return E_OUTOFMEMORY;
}
for (i = 0; i < texture->layer_count; ++i)
wined3d_texture_dirty_region_add(texture, i, NULL);
}
/* Precalculated scaling for 'faked' non power of two texture coords. */