Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 13 +++++++++---- dlls/wined3d/stateblock.c | 9 +++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 07179900c4..d96e7b7095 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -990,6 +990,15 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device, device->index_buffer_size = 0; }
+ if (!extended) + { + if (device->recording) + wined3d_stateblock_decref(device->recording); + device->recording = NULL; + device->update_state = device->state; + wined3d_stateblock_reset(device->state); + } + if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, mode ? &wined3d_mode : NULL, reset_enum_callback, !extended))) { @@ -997,10 +1006,6 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
if (!extended) { - if (device->recording) - wined3d_stateblock_decref(device->recording); - device->recording = NULL; - device->update_state = device->state; device->auto_mipmaps = 0; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 1965a4303f..967a44262c 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1857,3 +1857,12 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device,
return WINED3D_OK; } + +void CDECL wined3d_stateblock_reset(struct wined3d_stateblock *stateblock) +{ + TRACE("stateblock %p.\n", stateblock); + + wined3d_stateblock_state_cleanup(&stateblock->stateblock_state); + memset(&stateblock->stateblock_state, 0, sizeof(stateblock->stateblock_state)); + wined3d_stateblock_state_init(&stateblock->stateblock_state, stateblock->device, WINED3D_STATE_INIT_DEFAULT); +} diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 2df6c510b1..6fba7b5661 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -258,6 +258,7 @@ @ cdecl wined3d_stateblock_create(ptr long ptr) @ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_incref(ptr) +@ cdecl wined3d_stateblock_reset(ptr) @ cdecl wined3d_stateblock_set_blend_factor(ptr ptr) @ cdecl wined3d_stateblock_set_pixel_shader(ptr ptr) @ cdecl wined3d_stateblock_set_ps_consts_b(ptr long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 57f5775409..e328386d6f 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2660,6 +2660,7 @@ HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); +void __cdecl wined3d_stateblock_reset(struct wined3d_stateblock *stateblock); void __cdecl wined3d_stateblock_set_blend_factor(struct wined3d_stateblock *stateblock, const struct wined3d_color *blend_factor); void __cdecl wined3d_stateblock_set_pixel_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 53e92707ca..63bf5f4fa2 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -909,13 +909,15 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, device->index_buffer_size = 0; }
+ if (device->recording) + wined3d_stateblock_decref(device->recording); + device->recording = NULL; + device->update_state = device->state; + wined3d_stateblock_reset(device->state); + if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback, TRUE))) { - if (device->recording) - wined3d_stateblock_decref(device->recording); - device->recording = NULL; - device->update_state = device->state; present_parameters->BackBufferCount = swapchain_desc.backbuffer_count; implicit_swapchain = wined3d_swapchain_get_parent(device->implicit_swapchain); implicit_swapchain->swap_interval
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=58383
Your paranoid android.
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/surface.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 769b5a7576..89e5024c0e 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6068,14 +6068,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ swapchain_desc.backbuffer_height = mode.height; swapchain_desc.backbuffer_format = mode.format_id;
- if (FAILED(hr = wined3d_device_reset(ddraw->wined3d_device, - &swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE))) - { - ERR("Failed to reset device.\n"); - heap_free(texture); - return hr_ddraw_from_wined3d(hr); - } - if (ddraw->d3ddevice) { if (ddraw->d3ddevice->recording) @@ -6083,6 +6075,15 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ ddraw->d3ddevice->recording = NULL; ddraw->d3ddevice->update_state = ddraw->d3ddevice->state; } + wined3d_stateblock_reset(ddraw->state); + + if (FAILED(hr = wined3d_device_reset(ddraw->wined3d_device, + &swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE))) + { + ERR("Failed to reset device.\n"); + heap_free(texture); + return hr_ddraw_from_wined3d(hr); + }
wined3d_device_set_render_state(ddraw->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil);
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=58384
Your paranoid android.
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (32 bit WoW report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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 967a44262c..cd87809496 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 6fba7b5661..d0ba31bf4e 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -266,6 +266,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 e328386d6f..a567cfd2f1 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2674,6 +2674,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,
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=58385
Your paranoid android.
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (build log) ===
Task errors: The task timed out
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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 d96e7b7095..cd870c90a6 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2489,13 +2489,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)
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=58386
Your paranoid android.
=== debian10 (32 bit Chinese:China report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (32 bit WoW report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (64 bit WoW report) ===
d3d9: d3d9ex.c:3133: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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 63bf5f4fa2..6b6f5edfbc 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -2135,8 +2135,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=58387
Your paranoid android.
=== debian10 (32 bit WoW report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
=== debian10 (64 bit WoW report) ===
d3d9: d3d9ex.c:3133: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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=58388
Your paranoid android.
=== debian10 (32 bit WoW report) ===
d3d8: device.c:3165: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com