Signed-off-by: Paul Gofman pgofman@codeweavers.com --- Fixes rendering in Guilty Gear Isuka which (d3d8 game) which regressed with commit 513d3e1376761889a792719d4dccaf41bc6d2829.
dlls/d3d8/tests/visual.c | 20 +++++++++++++++++--- dlls/d3d9/tests/visual.c | 20 +++++++++++++++++--- dlls/wined3d/texture.c | 11 +++++++---- 3 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index b7f6dd62e9c..41fc0cbf16a 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -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); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 89f9e9cf2c6..9f9055483b1 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -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); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index fdd2c70c667..94a1b848a2a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3895,11 +3895,14 @@ 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; + } + wined3d_texture_dirty_region_add(texture, 0, NULL); }
/* Precalculated scaling for 'faked' non power of two texture coords. */
On Thu, 24 Mar 2022 at 20:06, Paul Gofman pgofman@codeweavers.com wrote:
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index fdd2c70c667..94a1b848a2a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3895,11 +3895,14 @@ 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;
}
}wined3d_texture_dirty_region_add(texture, 0, NULL);
Shouldn't we be doing that for all layers? (In case of d3d8 in particular, that would mean all faces of a cube texture.)
On 3/25/22 14:02, Henri Verbeet wrote:
On Thu, 24 Mar 2022 at 20:06, Paul Gofman pgofman@codeweavers.com wrote:
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index fdd2c70c667..94a1b848a2a 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3895,11 +3895,14 @@ 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;
}
wined3d_texture_dirty_region_add(texture, 0, NULL); }
Shouldn't we be doing that for all layers? (In case of d3d8 in particular, that would mean all faces of a cube texture.)
Yes, indeed, thanks. I will resend.