Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 22 ++++++++++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 3 files changed, 24 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 1965a4303f..96021f8067 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1485,6 +1485,28 @@ void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock stateblock->changed.textureState[stage] |= 1u << state; }
+void CDECL wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, + UINT stage, struct wined3d_texture *texture) +{ + TRACE("stateblock %p, stage %u, texture %p.\n", stateblock, stage, texture); + + if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) + stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS); + + if (stage >= ARRAY_SIZE(stateblock->stateblock_state.textures)) + { + WARN("Ignoring invalid stage %u.\n", stage); + return; + } + + if (texture) + wined3d_texture_incref(texture); + if (stateblock->stateblock_state.textures[stage]) + wined3d_texture_decref(stateblock->stateblock_state.textures[stage]); + stateblock->stateblock_state.textures[stage] = texture; + stateblock->changed.textures |= 1u << stage; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 2df6c510b1..23d97d47b7 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -265,6 +265,7 @@ @ cdecl wined3d_stateblock_set_ps_consts_i(ptr long long ptr) @ cdecl wined3d_stateblock_set_render_state(ptr long long) @ cdecl wined3d_stateblock_set_sampler_state(ptr long long long) +@ cdecl wined3d_stateblock_set_texture(ptr long ptr) @ cdecl wined3d_stateblock_set_texture_stage_state(ptr long long long) @ cdecl wined3d_stateblock_set_vertex_declaration(ptr ptr) @ cdecl wined3d_stateblock_set_vertex_shader(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 57f5775409..37d9aeb671 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2673,6 +2673,7 @@ void __cdecl wined3d_stateblock_set_render_state(struct wined3d_stateblock *stat enum wined3d_render_state state, DWORD value); void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); +void __cdecl wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, UINT stage, struct wined3d_texture *texture); void __cdecl wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, UINT stage, enum wined3d_texture_stage_state state, DWORD value); void __cdecl wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 07179900c4..b3d6540ac3 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2484,13 +2484,16 @@ static HRESULT WINAPI d3d9_device_SetTexture(IDirect3DDevice9Ex *iface, DWORD st texture_impl = unsafe_impl_from_IDirect3DBaseTexture9(texture);
wined3d_mutex_lock(); - wined3d_device_set_texture(device->wined3d_device, stage, + wined3d_stateblock_set_texture(device->update_state, stage, texture_impl ? texture_impl->wined3d_texture : NULL); if (!device->recording) { unsigned int i = stage < 16 || (stage >= D3DVERTEXTEXTURESAMPLER0 && stage <= D3DVERTEXTEXTURESAMPLER3) ? stage < 16 ? stage : stage - D3DVERTEXTEXTURESAMPLER0 + 16 : ~0u;
+ wined3d_device_set_texture(device->wined3d_device, stage, + texture_impl ? texture_impl->wined3d_texture : NULL); + if (i < D3D9_MAX_TEXTURE_UNITS) { if (texture_impl && texture_impl->usage & D3DUSAGE_AUTOGENMIPMAP)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 53e92707ca..ac126139bc 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2133,8 +2133,11 @@ static HRESULT WINAPI d3d8_device_SetTexture(IDirect3DDevice8 *iface, DWORD stag texture_impl = unsafe_impl_from_IDirect3DBaseTexture8(texture);
wined3d_mutex_lock(); - wined3d_device_set_texture(device->wined3d_device, stage, + wined3d_stateblock_set_texture(device->update_state, stage, texture_impl ? texture_impl->wined3d_texture : NULL); + if (!device->recording) + wined3d_device_set_texture(device->wined3d_device, stage, + texture_impl ? texture_impl->wined3d_texture : NULL); wined3d_mutex_unlock();
return D3D_OK;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58348
Your paranoid android.
=== debian10 (32 bit report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c.
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (32 bit WoW report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (64 bit WoW report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c.
On Thu, 24 Oct 2019 at 09:42, Marvin testbot@winehq.org wrote:
=== debian10 (32 bit report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c.
As it turns out, the testbot is right about this one. This issue seems to be that while wined3d_device_reset() cleans up stateblock references before enumerating potentially blocking resources, d3d8_device_Reset() doesn't.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 3702454bde..9b7754bd8d 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -4811,7 +4811,9 @@ static HRESULT d3d_device7_SetTexture(IDirect3DDevice7 *iface, wined3d_texture = surf->wined3d_texture;
wined3d_mutex_lock(); - wined3d_device_set_texture(device->wined3d_device, stage, wined3d_texture); + wined3d_stateblock_set_texture(device->update_state, stage, wined3d_texture); + if (!device->recording) + wined3d_device_set_texture(device->wined3d_device, stage, wined3d_texture); wined3d_mutex_unlock();
return D3D_OK;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58349
Your paranoid android.
=== debian10 (32 bit report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c.
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (32 bit WoW report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (64 bit WoW report) ===
d3d8: device.c:1735: Test failed: Got unexpected hr 0x88760868. device.c:1737: Test failed: Got unexpected hr 0x88760869. device.c:1743: Test failed: Reset failed, hr 0x88760868. device.c:1745: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1751: Test failed: Reset failed, hr 0x88760868. device.c:1753: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1760: Test failed: Failed to reset device, hr 0x88760868. device.c:1767: Test failed: Failed to reset device, hr 0x88760868. device.c:1781: Test failed: Reset failed, hr 0x88760868. device.c:1784: Test failed: GetDepthStencilSurface failed, hr 0x88760866. device.c:1785: Test failed: Depth / stencil buffer should not be NULL. device.c:1790: Test failed: Reset failed, hr 0x88760868. device.c:1802: Test failed: Reset failed, hr 0x88760868. device.c:1804: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1813: Test failed: Reset failed, hr 0x88760868. device.c:1815: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1822: Test failed: Reset failed, hr 0x88760868. device.c:1824: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1836: Test failed: Reset failed, hr 0x88760868. device.c:1838: Test failed: TestCooperativeLevel failed, hr 0x88760869. device.c:1844: Test failed: Reset failed, hr 0x88760868. device.c:1856: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1867: Test failed: Reset returned 0x88760868, expected 0x8876086c. device.c:1878: Test failed: Reset returned 0x88760868, expected 0x8876086c.
d3d9: d3d9ex.c:3133: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.