Commit graph

623 commits

Author SHA1 Message Date
Henri Verbeet
dcee5182c6 dxgi: Avoid redundantly setting the present info wait semaphore fields in d3d12_swapchain_queue_present(). 2023-12-05 21:24:37 +01:00
Henri Verbeet
3eebc3ea92 dxgi/tests: Release the swapchain after waiting for the window thread to finish in test_resize_target_wndproc().
In order to prevent resize_target_wndproc() from potentially accessing the
swapchain after it has been destroyed.
2023-12-05 21:24:37 +01:00
Alexandre Julliard
acad49573a makefiles: Always use the global SOURCES variable for .c files. 2023-11-01 22:44:03 +01:00
Alexandre Julliard
7ccb5df0fc makefiles: Always use the global SOURCES variable for .rc files. 2023-11-01 22:43:56 +01:00
Alex Henrie
3bc570e8ec dxgi/tests: Use CRT allocation functions. 2023-10-31 18:49:19 +01:00
Alex Henrie
2369657333 dxgi: Use CRT allocation functions. 2023-10-31 18:49:12 +01:00
Stefan Dösinger
ab6c51f28a dxgi/tests: Test swapchains with zero dimensions. 2023-08-18 18:44:05 +02:00
Stefan Dösinger
eba2523ac1 dxgi: Read back the swapchain size assigned by wined3d. 2023-08-18 18:34:10 +02:00
Alexandre Julliard
df20791bdb dxgi/tests: Use nameless unions/structs. 2023-08-15 18:56:45 +02:00
Francois Gouget
aeeaad0ea5 dxgi: Fix a typo in a comment. 2023-07-27 16:36:09 +09:00
Alistair Leslie-Hughes
83ea03bcc8 dxgi: Remove DECLSPEC_HIDDEN usage. 2023-07-20 21:48:39 +02:00
Giovanni Mascellani
e77a9eda74 dxgi: Wait before acquiring the Vulkan queue for presenting.
The reason is explained in upstream commit
b2a1f6b5e4f59fbc7f91ada7e565639dcf4e8e7f, which also applies
to earlier vkd3d versions.
2023-07-13 23:42:46 +02:00
Giovanni Mascellani
23a1642673 dxgi: Acquire and release the Vulkan queue inside d3d12_swapchain_queue_present(). 2023-07-13 23:42:46 +02:00
Giovanni Mascellani
3dad51fba8 dxgi: Do not allow vkd3d_acquire_vk_queue() to fail.
The implementation even asserts its return value.
2023-07-13 23:42:46 +02:00
Giovanni Mascellani
060e9f7694 dxgi: Remove the worker event, which is now useless. 2023-07-13 23:42:46 +02:00
Giovanni Mascellani
287c6fe928 dxgi: Move buffer resizing to the worker thread. 2023-07-13 23:42:46 +02:00
Giovanni Mascellani
8cc427978f dxgi: Move presentation to the worker thread.
The main thread still waits for the worker thread, in order to keep
buffer resizing synchronized with presentation. As soon as buffer
presentation is offloaded to the worker thread too the wait can be
dropped.
2023-07-13 23:42:46 +02:00
Giovanni Mascellani
f07859d75b dxgi: Introduce a worker thread for the D3D12 swapchain.
In the following commits the worker thread will be used for actual
presenting and buffer resizing. In this way the worker thread can
wait on the vkd3d queue without blocking or even deadlocking the
application.
2023-07-13 23:42:46 +02:00
Giovanni Mascellani
aeb9776f4c dxgi: Split D3D12/Vulkan resource creation and destruction.
This is to eventually hand frontend and backend resource management
to different code pieces.
2023-07-04 15:37:16 +02:00
Giovanni Mascellani
b4741fd259 dxgi: Pass a VkImage to d3d12_swapchain_queue_present().
This is to eventually allow d3d12_swapchain_queue_present() to
operate on a certain VkImage even if current_buffer_index has
already been modified since the corresponding Present() call.
2023-07-04 15:37:15 +02:00
Giovanni Mascellani
89cd45bb1f dxgi: Free the frontend images memory only once. 2023-07-04 15:37:15 +02:00
Giovanni Mascellani
e5c232eb4c dxgi: Consider vk_format a frontend field.
This is an oversight in eec9c3a2f6:
vk_format specifies the format used for the frontend resources. The backend
images could use a different format, depending on what the swapchain
supports.

Also, introduce the terms "frontend" and "backend" for the two sides
of the swapchain, which are probably easier to understand.
2023-07-04 15:37:12 +02:00
Giovanni Mascellani
e1cdc48786 dxgi/tests: Test that the present count is updated when Present() is called. 2023-07-04 15:37:12 +02:00
Giovanni Mascellani
1a0c2d6b41 dxgi/tests: Test that the back buffer index is updated when Present() is called. 2023-07-04 15:37:12 +02:00
Zebediah Figura
ebaa0a9426 wined3d: Recreate swapchain textures in wined3d_swapchain_resize_buffers().
Instead of using wined3d_texture_update_desc(). This is safe, because:

* ddraw never exposes wined3d textures directly, and always retrieves them
  directly from wined3d when rendering.

* d3d8 and d3d9 (non-extended) will only resize buffers during a reset, and
  resetting is forbidden if the application holds any references to the
  backbuffers. RTVs are also replaced during a reset, so there is no concern
  about retrieving the old RTVs from the device state.

* d3d9ex allows resetting while holding references to the backbuffers, but tests
  (fixed by this patch) show that the backbuffers should in fact be recreated.

* dxgi forbids holding references to back buffers during ResizeBuffers(),
  including indirect references via command lists or device contexts.
2023-06-29 12:04:35 +02:00
Zebediah Figura
0dc7de15e0 dxgi: Do not create a d3d11 swapchain object for the implicit swapchain.
This swapchain is never actually exposed, and effectively only exists due to
implementation constraints. When it was introduced, it was necessary or simplest
to create a dxgi swapchain object, but currently that's no longer necessary, and
avoiding that allows some code to be simplified.
2023-06-29 12:04:33 +02:00
Giovanni Mascellani
e0ce5e331a dxgi: Rename and split d3d12_swapchain_destroy_buffers(). 2023-06-21 18:15:43 +02:00
Giovanni Mascellani
2e556c3245 dxgi: Only create D3D12 resources when necessary. 2023-06-21 18:15:43 +02:00
Giovanni Mascellani
c10e272152 dxgi: Do not destroy D3D12 resources unless requested.
This is probably a leftover of when Vulkan swapchain images were
used directly.
2023-06-21 18:15:43 +02:00
Giovanni Mascellani
bc3edfd188 dxgi: Remove now-useless function d3d12_swapchain_create_buffers(). 2023-06-21 18:15:43 +02:00
Giovanni Mascellani
0521f57027 dxgi: Do not uselessly pass queue_family_index around. 2023-06-21 18:15:43 +02:00
Giovanni Mascellani
4e88f44270 dxgi: Move Vulkan-specific code to d3d12_swapchain_create_vulkan_swapchain(). 2023-06-02 22:25:02 +02:00
Giovanni Mascellani
a7ff40a324 dxgi: Move non-Vulkan-specific code out of d3d12_swapchain_create_vulkan_swapchain(). 2023-06-02 22:25:02 +02:00
Giovanni Mascellani
6cb23836e7 dxgi: Factor out d3d12_swapchain_create_image_resources(). 2023-06-02 22:25:02 +02:00
Giovanni Mascellani
237062d01f dxgi: Store Vulkan formats in the swapchain object. 2023-06-02 22:25:02 +02:00
Giovanni Mascellani
565917d5d2 dxgi: Rename d3d12_swapchain_prepare_command_buffers(). 2023-06-02 22:25:02 +02:00
Giovanni Mascellani
eec9c3a2f6 dxgi: Document some struct d3d12_swapchain fields. 2023-06-02 22:25:02 +02:00
Zebediah Figura
7b7d26a731 dxgi: Create d3d11 swapchain textures directly from d3d11_swapchain_init().
Using the IWineDXGIDeviceParent::swapchain_texture_created() callback.
2023-04-26 22:49:17 +02:00
Zebediah Figura
4413e94908 dxgi: Introduce IWineDXGIDeviceParent::register_swapchain_texture() and use it in IDXGIDevice::CreateSurface().
Instead of having d3d11 create the wined3d texture, create it in dxgi instead,
and let d3d11 create a d3d_texture2d object to wrap it.

This is a step towards getting rid of the create_swapchain_texture() callback,
which is mildly difficult to work with and conceptually complex.
2023-04-26 22:49:17 +02:00
Andrey Gusev
af6d82613a dxgi: Update TRACE in dxgi_device_create_resource(). 2023-04-19 20:26:15 +02:00
Giovanni Mascellani
9015565ac0 dxgi/tests: Test the frame latency waitable more thoroughly. 2023-04-05 11:36:14 +02:00
Giovanni Mascellani
3cb350b228 dxgi/tests: Rename the waitable object from "event" to "semaphore".
From the tests it behaves more like a semaphore than like an event.

I'm not testing explicitly because I'm not sure it's relevant, but
another indication is that calling ReleaseSemaphore() returns
ERROR_ACCESS_DENIED, while calling SetEvent() returns
ERROR_INVALID_HANDLE.
2023-04-05 11:36:13 +02:00
Giovanni Mascellani
54bf9a9363 dxgi: Return a duplicate frame latency event. 2023-04-05 11:36:13 +02:00
Giovanni Mascellani
c6c065818c dxgi: Return correct present count with DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT. 2023-04-05 11:36:13 +02:00
Giovanni Mascellani
ecc480c8dc dxgi/tests: Test GetLastPresentCount() with DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT. 2023-04-05 11:36:11 +02:00
Stefan Dösinger
617831054f dxgi/tests: Test nested SetFullscreenState from the same thread.
I am still deliberately not testing after which message the swapchain
state changes from the old state to the new until we find a game that
depends on this.

ddraw, d3d8 and d3d9 do not catch recursive SetDisplayMode or Reset()
calls. They will recurse for about 16 times and then return library
specific weird return values like 0xd0000510 (NTSTATUS, but
nonexistent facility) or 0x88760868 (non-existent HRESULT facility). I
suspect it aborts when the kernel-side message processing stack is
exhausted. As such, an application depending on nested calls in those
libraries would have to deliberately do it, but limit the amount of
nesting to a non-zero amount.
2023-03-10 09:49:32 +01:00
Stefan Dösinger
92544264fd dxgi/tests: Test nested fullscreen application from different thread. 2023-03-10 09:49:32 +01:00
Stefan Dösinger
33170e2720 dxgi: Catch nested SetFullscreenState invocations. 2023-03-10 09:49:32 +01:00
Stefan Dösinger
75f7bd0eea dxgi: Unlock the wined3d mutex after storing the new target.
Otherwise a second thread might set it to something else between the
unlock and assignment.
2023-03-10 09:49:32 +01:00
Stefan Dösinger
52bdd0dbcd dxgi/tests: Run test_swapchain_window_messages on d3d12. 2023-03-10 09:49:32 +01:00