Commit 2ce72c68 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wined3d: Add full dirty region at texture creation.

parent eae36aab
......@@ -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);
......
......@@ -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);
......@@ -3895,12 +3895,16 @@ 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)
{
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. */
if (texture->resource.gl_type == WINED3D_GL_RES_TYPE_TEX_RECT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment