Commit Graph

3720 Commits

Author SHA1 Message Date
Joshua Ashton 7c993ae1a6 vkd3d: Move ID3D12RootSignature impl_froms to header
Basic casts should not be function calls.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton 875fbe5f50 vkd3d: Move ID3D12QueryHeap impl_froms to header
Basic casts should not be function calls.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton 2334c136e3 vkd3d: Move ID3D12DescriptorHeap impl_froms to header
Basic casts should not be function calls.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton 8d5308c9a1 vkd3d: Move ID3D12Resource impl_froms to header
Basic casts should not be function calls.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton 27e66b5c4a vkd3d: Move ID3D12Heap impl_froms to header
Basic casts should not be function calls.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton 26d8011b06 vkd3d: Move ID3D12Fence impl_froms to header
Basic casts should not be function calls.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton e597adb83a vkd3d: Move d3d12_query_heap_type_get_data_size to header
This should be inlined.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Joshua Ashton 3b3bd37f93 vkd3d: Avoid tracking + ending render passes when calling ResolveQueryData with 0 queries
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-23 12:12:13 +02:00
Conor McCarthy da8daa860b tests: Add test for SampleDesc.Count == 0 in test_create_committed_resource().
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
2021-09-23 11:00:04 +01:00
Conor McCarthy 446c7423ce vkd3d: Return E_INVALIDARG for texture creation if SampleDesc.Count == 0.
Windows returns E_INVALIDARG at least on AMD and Intel.
Psychonaughts 2 seems to use this as a de facto "do not create"
value, and reasonable vram usage depends on the call failing.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
2021-09-23 11:00:04 +01:00
Conor McCarthy d366ba47ac Revert "vkd3d: Support SAMPLE_DESC.Count of 0"
Windows returns E_INVALIDARG in this case.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
2021-09-23 11:00:04 +01:00
Georg Lehmann cf4fb44629 vkd3d: Remove almost unused variable.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-09-21 11:22:34 +01:00
Georg Lehmann edeb0658b7 vkd3d: Fix memory leak on failure.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-09-21 11:22:34 +01:00
Georg Lehmann 0afa6732ad vkd3d: Cleanup weird assignment.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-09-21 11:22:34 +01:00
Georg Lehmann 1946e42367 vkd3d-shader: Fix use-after-free on failure.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-09-21 11:22:34 +01:00
David McCloskey a19619ccbf vkd3d: Fixing compile errors on Windows. 2021-09-18 21:40:30 +01:00
Hans-Kristian Arntzen 173b8ecef0 vkd3d: Add workaround for DEATHLOOP.
Game attempts to create a host visible resource with
ALLOW_RENDER_TARGET flag. We cannot make this work on NVIDIA, but the
game never seems to actually create an RTV, so as a workaround, nop out
the flag, which does make it work after all :3

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-17 14:21:09 +02:00
Hans-Kristian Arntzen fa4d2182b1 vkd3d: Copy all aspects in CopyResource.
Just like we're promoting layer count, also promote aspect mask.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-17 14:21:09 +02:00
Hans-Kristian Arntzen 2b13d06f82 tests: Add test for how blending on integer RTVs are validated.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:57:28 +02:00
Hans-Kristian Arntzen e687d489ab vkd3d: Validate blend state against output signature.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:57:28 +02:00
Hans-Kristian Arntzen a4b082a828 vkd3d-shader: Add helper to parse output signature.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:57:28 +02:00
Hans-Kristian Arntzen 1d51818d8f vkd3d: Fix compile error introduced by bad rebase.
Somehow the rebase got really screwed up :\

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:42:30 +02:00
Hans-Kristian Arntzen a8f623e60d vkd3d: Negate upload_hvv config.
Enable resizable BAR style allocations by default, and add option to
disable it.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen 12066a2b67 vkd3d: Add debug config to log resizable BAR allocations.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen 710fa98918 vkd3d: Setup resizable bar budget.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen cec741706d vkd3d: Refactor out memory topology queries.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen abdaeb136d vkd3d: Add a memory budget per memory type.
For resizable BAR, we don't want to endlessly promote UPLOAD heaps to
BAR since VRAM is precious. The aim is to set a fixed budget where we
can keep allocating until full, at which point we fall back to plain HOST.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen e0451bb541 vkd3d: Handle fallbacks properly in suballocator.
With BAR budgets, what will happen is that
- Small allocation is requested
- A new chunk is requested
- try_suballocate_memory will end up calling allocate_memory, which
  allocates a fallback memory type
- Subsequent small allocators will always end up allocating a new
  fallback memory block, never reusing existing blocks.
- System memory is rapidly exhausted once apps start hitting against
  budget.

The fix is to add flags which explicitly do not attempt to fallback
allocate. This makes it possible to handle fallbacks at the appropriate
level in try_suballocate_memory instead.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen cb94cfd10c vkd3d: Fix silly typo in global mask.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen 426cdc9218 vkd3d: Destroy GLOBAL_BUFFER for some early error out paths.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen 69d4f55219 vkd3d: Refactor VkDeviceMemory allocation to keep track of type/size.
We will need to consider some form of budgeting, so make sure that all
allocation and freeing is done in a central place.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 16:10:57 +02:00
Hans-Kristian Arntzen a590db2508 tests: Add test for host visible render target.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen d402255349 tests: Add reduced test for ReadWriteSubresource to 2D images.
3D linear images are not well supported.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen b4521ebbd8 tests: Add tests for various ways to map 2D textures.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen 8d49d3e9ae vkd3d: Add extra validation for mapping textures.
D3D12 validation layers complain if you try to map mipmapped 3D volumes
for ... some reason. The error is very explicit, so I assume it's
intentional :)

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen 9fd422a0fd vkd3d: Fix default layout check when using LINEAR tiled images.
Match behavior of d3d12_resource_pick_layout.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen 41295eff6c vkd3d: Consider CPU availibility when selecting memory types.
Need to consider that based on host visibility requirements, we need to
select either LINEAR or OPTIMAL image types, and those tiling modes can
have different memory requirements.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen 132638be67 vkd3d: Add more logging when linear image allocation fails.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen 50f2c35b44 vkd3d: Add stricter ROW_MAJOR texture validation.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Hans-Kristian Arntzen 961fef84de vkd3d: Allow map of texture as long as ppData is NULL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-16 15:35:57 +02:00
Joshua Ashton 9c0fa91ca5 vkd3d: Add shader quirks for Psychonauts 2
Works around a game bug. It uses texture() inside divergent control flow.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-09-15 11:52:39 +02:00
Hans-Kristian Arntzen 3081887757 vkd3d: Add 12_2 to list of valid feature levels.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-14 21:18:29 +02:00
Hans-Kristian Arntzen 0e216b2b10 vkd3d: Narrow workaround for global pipeline cache.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-08 18:37:55 +02:00
Hans-Kristian Arntzen 11086a94e0 vkd3d: Add macros to parse/build NV driver versions.
The bit offsets are a bit different from Vulkan API.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-08 18:37:55 +02:00
Hans-Kristian Arntzen d2b3238b2d tests: Add tests for creating DS formats without ALLOW_DEPTH_STENCIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-07 13:31:28 +02:00
Hans-Kristian Arntzen fcaeca8d27 vkd3d: Allow typeless depth-stencil formats without ALLOW_DEPTH_STENCIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-07 13:31:28 +02:00
Hans-Kristian Arntzen 403d1f9743 vkd3d: Workaround huge memory overhead for individual VkPipelineCaches.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-07 13:21:54 +02:00
Hans-Kristian Arntzen b8f0cd6eb6 dxil-spirv: Update submodule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-07 12:10:06 +02:00
Hans-Kristian Arntzen 1d5acef691 tests: Add test for footprint -> depth-stencil copy.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-06 17:00:51 +02:00
Hans-Kristian Arntzen a3267ba8e5 vkd3d: Fix copies between footprint and DS aspects.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-09-06 17:00:51 +02:00