Commit Graph

2126 Commits

Author SHA1 Message Date
Philip Rebohle 000983aa73 vkd3d: Declare bindless UAV counter binding.
We'll add this to the root descriptor set since moving the binding
to one of the bindless sets would be hard to do; we'd need to track
the binding index of each "bindless" binding for set updates etc.

In order to stay within the limit of 8 sets, we also cannot introduce
a separate set for UAV counters (currently there are 6 bindless sets,
the static sampler set, and the root descriptor set).

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle 577efe9040 vkd3d: Optionally enable VK_KHR_buffer_device_address.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle 4d896bf53c vkd3d-shader: Use correct addressing model for physical storage buffers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle aca3e7636e vkd3d-shader: Implement bindless UAV counter ops.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle cb9775ca05 vkd3d-shader: Respect bindless flag for UAV counter bindings.
Also stores the type ID of the pointer to the UAV counter struct,
since we need to load the pointer before we can access the counter.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle 11a9ac6c19 vkd3d-shader: Emit declarations for bindless UAV counters.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 15:04:23 +01:00
Philip Rebohle facae7690c vkd3d: Replace descriptor mutex with per-descriptor spinlocks.
Greatly improves performance in various games that update or
copy a large number of descriptors per frame due to the high
overhead of pthread_mutex_{un}lock.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-27 13:33:03 +01:00
Philip Rebohle b577b5c329 vkd3d-common: Implement spinlock.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-27 13:33:03 +01:00
Hans-Kristian Arntzen 1030989973 vkd3d: Fix integer cast warning in d3d12.c.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-26 12:17:55 +01:00
Philip Rebohle cdc35483c4 vkd3d: Remove default pixel shader.
Unnecessary.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:07:28 +01:00
Philip Rebohle 682838b193 vkd3d: Enable bindless UAV.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle b6cfef09cb vkd3d: Explicitly assign UAV counter set.
Otherwise, we pass an incorrect set index when using bindless UAVs.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle 4ee06bc5d6 vkd3d: Ignore UAV counters for unbounded UAV ranges.
We cannot support that right now.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle 3fa194ce21 vkd3d-shader: Support nonuniform qualifier for bindless UAVs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle fb92b7c113 vkd3d-shader: Emit bindless UAV declarations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle 8dd73f3e45 vkd3d-shader: Explicitly pass flags to get_global_binding.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle a0c1ce4e55 vkd3d-shader: Explicitly pass image format to get_global_binding.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle 18caa8adc3 vkd3d-shader: Pass resource binding struct to get_global_binding.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle 81ee079449 vkd3d-shader: Move atomic counter declaration.
Allows us to have bindless UAVs without a special code path
for bindless UAV counters for now.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-26 12:05:47 +01:00
Philip Rebohle 31518debc2 vkd3d-shader: Always initialize modifer.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-25 19:31:33 +01:00
Hans-Kristian Arntzen 89cefd87d5 vkd3d: Add test for bindless UAV counters.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 14:42:32 +01:00
Hans-Kristian Arntzen 2d83388313 vkd3d: Add test for bindless UAV.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 14:42:32 +01:00
Hans-Kristian Arntzen 7c479f6dae vkd3d: Disable index_buffer_strip_cut spam in normal runtime.
Demote this warning to TRACE only.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 12:54:44 +01:00
Hans-Kristian Arntzen 4939e38c14 vkd3d: Clamp RTV/DSV array sizes to their real array lengths.
Avoids overflowing vkCreateFramebuffer later with UINT_MAX layers.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 11:27:14 +01:00
Hans-Kristian Arntzen f7ea9967d0 vkd3d: Use minimum width/height/layer framebuffer.
All attachments must be at least as large as the framebuffer, using a
max operator is not compliant with Vulkan.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 11:17:01 +01:00
Hans-Kristian Arntzen afb47543d2 vkd3d: Always use CBV-as-SSBO path.
NVIDIA currently seems to have some issues with bindless CBV on Vulkan,
which have been reported. Somehow, bindless SSBO works around black
screen on SotTR, as well as some rendering glitches on Control.

AMD won't care since UBOs and SSBOs are basically the same thing.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-25 11:16:44 +01:00
Philip Rebohle b85852e733 vkd3d: Fix barriers for bindless CBV-as-SSBO.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-23 16:20:38 +01:00
Hans-Kristian Arntzen 8010c26ec4 vkd3d: Do not attempt to enable primitive restart for non-strip topology.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-23 12:56:16 +01:00
Philip Rebohle e7360fbd46 vkd3d: Fix build.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 14:39:58 +01:00
Philip Rebohle d4d299d765 vkd3d: Initialize feature options in d3d12_device_caps_init.
Also reworks the check for resource binding tiers.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle 1e78cd3397 vkd3d: Determine maximium feature level in d3d12_device_caps_init.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle bf8863568c vkd3d: Introduce d3d12_device_caps_init.
This method is meant to process d3d12 device caps after the
device itself has been fully initialized. This helps avoid
code duplication in certain instances and guarantees that we
know about all enabled Vulkan features.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle f3e8c156c2 vkd3d: Move minimum feature level check to d3d12_device_create.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Philip Rebohle 19b971de0a vkd3d: Introduce d3d12_caps.
Meant to bundle all d3d12 feature caps and options, of which
we're going to have to add more over time.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-19 13:10:18 +01:00
Hans-Kristian Arntzen e85cc6288e vkd3d: Declare inline header function as static.
Fixes some linking issues on my end with undeclared external symbols.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 15:39:04 +01:00
Hans-Kristian Arntzen b7c14698b4 vkd3d-shader: Add CBV_AS_STORAGE_BUFFER support to DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 15:39:04 +01:00
Philip Rebohle 95c1faeeb9 vkd3d: Add some missing bindless feature checks.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Philip Rebohle 2ffb5396cc vkd3d: Use storage buffers for bindless CBV if supported.
Used as a fallback for older Nvidia generations which do not
support bindless uniform buffers.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Philip Rebohle 8618bc1d5b vkd3d: Enable storage buffer usage alongside uniform buffer usage.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Philip Rebohle ef80658ffb vkd3d: Do not disable storage buffer indexing features.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Philip Rebohle fda155b965 vkd3d: Adjust descriptor types if CBV_AS_SSBO is set.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Philip Rebohle 3709ae1dd8 vkd3d: Introduce VKD3D_BINDLESS_CBV_AS_SSBO flag.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Philip Rebohle a9ba32a6c4 vkd3d-shader: Add option to declare bindless CBVs as SSBOs.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 14:35:35 +01:00
Hans-Kristian Arntzen 71d8f63356 vkd3d: Split descriptor pool allocation based on usage.
Logically split up descriptor pool allocation in three types:
- STATIC: Root descriptors and internal allocation.
- VOLATILE: For packed descriptor set which comes from heaps.
- IMMUTABLE_SAMPLER: For immutable samplers. This should be removed once
  we start allocating sampler sets at sampler creation time.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 14:29:03 +01:00
Hans-Kristian Arntzen 291db5581c vkd3d: Fix push constant size check against D3D12_MAX_ROOT_COST.
MAX_ROOT_COST is in terms of number of u32s.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 14:29:03 +01:00
Philip Rebohle 5bf4b207f2 vkd3d-shader: Bound-check root constant reads.
Safety measure in case a broken app performs out-of-bounds reads.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 11:57:35 +01:00
Philip Rebohle 423bb09b46 vkd3d-shader: Unroll root constant buffers.
Fixes spec violations when we have root constant ranges not
aligned to 16 bytes.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 11:57:35 +01:00
Philip Rebohle d129e477f6 vkd3d-shader: Load constant buffer components individually.
Enables us to unroll root constant buffers. Not loading unneeded
components early may also help some drivers generate better code.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 11:57:35 +01:00
Philip Rebohle 01098e194e vkd3d-shader: Simplify vkd3d_dxbc_compiler_emit_mov.
Having a lot of special code here just makes it harder for
us to implement UBO-specific load path, not to mention that
the mov instruction itself is very rare.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-18 11:57:35 +01:00
Hans-Kristian Arntzen ceee2096a5 vkd3d: Query subgroup properties and expose SM 6.0 if present.
Does not cover every case for SM 6.0, but it's a useful start.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 10:58:17 +01:00