Commit Graph

10698 Commits

Author SHA1 Message Date
Zebediah Figura 1eabd77422 wined3d: Do not print a d3d_perf warning in adapter_vk_alloc_bo() for unmapped BOs.
BOs will always be unmapped here. This is a relic from an older form of the code
where mapping was done in wined3d_context_vk_create_bo().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 18:27:43 +01:00
Zebediah Figura fdf2995604 wined3d: Allow changing settings using a new WINE_D3D_CONFIG environment variable.
This can be significantly more convenient than modifying the registry.

config_list_get_value() is based on vkd3d_debug_list_has_member() by Józef
Kucia.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Stefan Dösinger 10baf0cb9e wined3d: Remove the no-op wined3d_resource_release.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Stefan Dösinger cb4385ea87 wined3d: Use the default queue index for resource fencing.
This removes tracking work entirely from the CS thread and replaces
interlocked with regular writes on the main thread. It also avoids
accessing access_count in read-write mode from two threads.

Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Stefan Dösinger e308f53aa6 wined3d: Use extra bits in the queue head and tail counters.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Jan Sikorski 8e0ab7363d wined3d: Implement event queries using Vulkan events.
This makes event results available sooner, i.e. after they are executed
by the GPU, and also moves the polling from CS to application's thread.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 20:33:00 +01:00
Jan Sikorski 1a7a50a140 wined3d: Poll Vulkan queries directly on the application thread.
We want to avoid using the poll list, for occlusion queries especially,
as in some games the number of occlusion queries can reach the hundreds.
OpenGL backend already does this by using ARB_QUERY_BUFFER_OBJECT.
We could mimic this in Vulkan too using compute shaders to accumulate
pending queries, however, unlike with OpenGL, we can also just directly
call vkGetQueryPoolResults() from the application's thread.
A downside of the approach taken here is that Vulkan queries allocated
to a wined3d_query are only released after the query is reused or
destroyed. In principle, if this ever becomes a problem, it could be
avoided by protecting the query pool with a mutex and releasing queries
after reading the results.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 20:32:57 +01:00
Jan Sikorski 7f1473e4be wined3d: Track pending Vulkan queries separately for each query.
This is mostly to enable polling queries from the application thread by
removing the need to access the shared context.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 20:32:54 +01:00
Jan Sikorski 9204569061 wined3d: Add poll_in_cs field to wined3d_query().
Its eventual purpose is to allow for skipping the poll list mechanism
by calling query_poll() in the application thread. In this patch it is
only used for when we don't have a separate CS thread.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 20:32:50 +01:00
Matteo Bruni 6b7ccb76ab wined3d: Fix typo in WARN() message.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-03 18:59:24 +01:00
Alexandre Julliard 5d62e5603a wined3d: Export all the vkd3d functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-03 10:07:16 +01:00
Alexandre Julliard 24432a24d5 wined3d: Use the bundled vkd3d and build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-03 10:07:16 +01:00
Zebediah Figura 1b893093fd wined3d: Allocate a heap memory buffer in wined3d_cs_map_upload_bo() if possible.
Based on patches by Matteo Bruni and Michael Müller.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-25 19:02:18 +01:00
Zebediah Figura 125f5b7210 wined3d: Accelerate texture DISCARD maps as well.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:32 +01:00
Zebediah Figura aa9b1fb3a3 wined3d: Allocate texture BOs from heap.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:28 +01:00
Zebediah Figura 1632b8e7a4 wined3d: Use WINED3D_LOCATION_CLEARED for the initial location of textures.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:24 +01:00
Zebediah Figura 4103a7085c wined3d: Consider WINED3D_LOCATION_CLEARED to be a CPU-accessible location.
For the purposes of texture2d_blt(). The main goal here is to allow uploading
from WINED3D_LOCATION_CLEARED to a multisample texture (and hence initializing
it).

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:20 +01:00
Zebediah Figura f4e65025b6 wined3d: Handle DISCARDED and CLEARED locations in wined3d_texture_get_memory().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:15 +01:00
Zebediah Figura 3a67b7f2fb wined3d: Handle WINED3D_LOCATION_CLEARED in wined3d_texture_load_location().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:10 +01:00
Zebediah Figura 23fbec2722 wined3d: Remove the now redundant "locations" parameter from wined3d_texture_get_memory().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:04 +01:00
Zebediah Figura 71b8ec3fd2 wined3d: Introduce a wined3d_texture_get_bo_address() helper.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:37:00 +01:00
Zebediah Figura 81068b89d8 wined3d: Introduce a wined3d_texture_update_sub_resource() helper.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-21 22:33:54 +01:00
Zebediah Figura 5dd3b178ce wined3d: Set a valid map pointer in adapter_gl_alloc_bo() if possible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-18 22:10:47 +01:00
Zebediah Figura 83fc1807f9 wined3d: Treat NOOVERWRITE maps on a previously discarded buffer as if they were DISCARD maps.
For the purposes of wined3d_cs_map_upload_bo().

That is, if a buffer was just created or just discarded [e.g. with
wined3d_device_evict_managed_resources()], and then subsequently mapped with
WINED3D_MAP_NOOVERWRITE, treat it as if it had been mapped with
WINED3D_MAP_DISCARD instead, thus allowing the adapter_alloc_upload_bo callback
to allocate a new buffer from the client thread.

This was the source of a bunch of stalls in Grand Theft Auto V, although it's
hard to measure a difference in performance.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-18 22:10:47 +01:00
Zebediah Figura 1b1b03055d wined3d: Try to allocate new OpenGL BOs from the client thread for DISCARD maps.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-18 22:10:47 +01:00
Zebediah Figura f257daf390 wined3d: Do not allocate upload bufers for resources pinned to system memory.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-18 22:10:47 +01:00
Zebediah Figura c724df3b8e wined3d: Move the "pin sysmem" flag to struct wined3d_resource.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-18 22:10:47 +01:00
Zebediah Figura 4f54f4591a wined3d: Protect wined3d_chunk_gl map fields with a mutex.
Parallel to a5efc1d5e0. Unlike with the Vulkan
backend, we cannot map chunks from the client thread, but we can access the
mapped pointer and increase the map count of already mapped chunks.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 18:57:27 +01:00
Zebediah Figura ec5a71068b wined3d: Don't use persistent BOs from the client thread if we might need to do vertex attribute conversion.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:33 +01:00
Zebediah Figura 95173d6f65 wined3d: Allow passing a NULL context to wined3d_device_gl_create_bo().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:33 +01:00
Zebediah Figura 4a3cefab75 wined3d: Protect access to the OpenGL wined3d_allocator with a critical section.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:33 +01:00
Zebediah Figura 7c16fb7ce3 wined3d: Pass a wined3d_device_gl pointer to wined3d_context_gl_create_bo().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:33 +01:00
Connor McAdams 0dcdfae29a wined3d: Fix comment in wined3d_texture_vk_download_data().
For download, vkCmdCopyImageToBuffer() is used, not
vkCmdCopyBufferToImage().

Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-15 22:59:53 +01:00
Zebediah Figura 57c58c46bb wined3d: Use wined3d_context_copy_bo_address() to download buffer ranges.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-15 22:59:53 +01:00
Zebediah Figura bf5ae2a3a0 wined3d: Use wined3d_context_copy_bo_address() to upload buffer ranges.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-15 22:59:52 +01:00
Zebediah Figura 9f8b5670e4 wined3d: Pass a wined3d_range array to wined3d_context_copy_bo_address().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-15 22:59:52 +01:00
Zebediah Figura a2653a9455 wined3d: Move struct wined3d_buffer_ops to buffer.c.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-15 22:59:52 +01:00
Zebediah Figura 30d670a7b9 wined3d: Allow NOOVERWRITE maps to be accelerated on 32-bit architectures.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Zebediah Figura 831ff10200 wined3d: Keep a client reference count for the BO map pointer.
Currently this has no effect. Depending on whether wined3d_map_persistent()
returns true, either the client thread doesn't access the map pointer outside of
d3d map requests, or the BO is never unmapped. However, we'd like to be able to
let NOOVERWRITE maps be accelerated while still being able to unmap arbitrary
BOs at arbitrary times from the CS thread.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Henri Verbeet a13fc3bb7e wined3d: Use the chunk allocator for GL vertex buffers.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Zebediah Figura eb90d5db4f wined3d: Allow up to 128 MiB of persistently mapped memory on 32-bit architectures.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Paul Gofman b36e4cfe2d wined3d: Clear GL backbuffer in wined3d_context_gl_init().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:20:42 +01:00
Jan Sikorski 9a799898a1 wined3d: Avoid waiting for a command buffer to finish executing to read off its queries.
Some games wait for query results on the frame executing the query,
expecting that enough time have passed for it to be available. By
requiring that the entire command buffer is done, we risk stalling the
whole frame if it wasn't flushed along the way. This patch drops this
requirement.

Mainly, we need to ensure that we don't call vkGetQueryPoolResults()
before the reset command is executed, and accidentally retrieve result
from previous usage. Using host query reset doesn't quite solve the
problem, as it might get called too early, if the application decides to
reuse a query without waiting for results. Besides, we want to support
devices where host query reset is not available.

To make it work, when a Vulkan query is no longer needed, we queue it
for resetting at command buffer submission time, and only mark it free
for reuse after this command buffer is finished executing.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:13:10 +01:00
Jan Sikorski 8981c32fa2 wined3d: Reinitialize query pool's free list entry when it runs out.
We check if it's empty to put it back in.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:12:33 +01:00
Zebediah Figura 626dc29ae2 wined3d: Always submit UPDATE_SUB_RESOURCE ops when uploading if not mapping persistently.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:08:27 +01:00
Zebediah Figura f30d3ac214 wined3d: Introduce wined3d_lock_init() and wined3d_lock_cleanup() helpers.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:08:22 +01:00
Zebediah Figura d53f9d5f88 wined3d: Always set map_ptr for mapped OpenGL BOs.
Regardless of whether we are mapping persistently. Matches the Vulkan backend.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:08:05 +01:00
Jan Sikorski b33a5b34b7 wined3d: Use a separate heap for deferred resource upload buffers.
Significantly reduces global heap lock contention in some games.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:07:58 +01:00
Paul Gofman 2435f116c3 wined3d: Use StretchBlt() in swapchain_blit_gdi().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-11 17:07:48 +01:00
Zebediah Figura d9e8f4b458 wined3d: Call wined3d_context_unmap_bo_address() when updating a buffer BO.
That is, don't just flush it, but unmap it as well.

As of d8e8ab21c0, we can get here even when
!wined3d_map_persistent(). Thus we currently end up leaving BOs mapped when
performing an accelerated DISCARD map. Try to avoid that.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-10 18:09:36 +01:00