Commit Graph

566 Commits

Author SHA1 Message Date
Philip Rebohle bbfbf94c5e vkd3d-shader: Always use private vars for arrayed builtins.
Fixes invalid shader code being generated in Monster Hunter World.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:30:51 +02:00
Philip Rebohle 0c2057ff68 vkd3d-shader: Support texel offset for sample_c instruction.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-16 10:30:51 +02:00
Philip Rebohle 407c740927 vkd3d: Rework vkd3d_dxbc_compiler_get_resource_binding.
Instead of taking the resource type, take the binding flag.
This allows us to also use this function for UAV counters.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-10 14:32:33 +02:00
Philip Rebohle 56df26d845 vkd3d-shader: Implement support for stencil export.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-06 11:53:09 +02:00
Philip Rebohle 3ee4ab56d7 vkd3d-shader: Enable SPV_EXT_shader_viewport_index_layer if necessary.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-06 11:53:09 +02:00
Philip Rebohle c07f46f09c vkd3d-shader: Look up existing register fpr built-in outputs.
Otherwise, if two built-in outputs share the same register, we
may end up multiple redundant private variables, only one of
which gets initialized, leading to uninitialized outputs.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-04-06 11:53:09 +02:00
Hans-Kristian Arntzen 671560c4e3 vkd3d-shader: Allow bindless UAV counters in DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-27 15:43:19 +01:00
Hans-Kristian Arntzen 31a2a308ee vkd3d-shader: Enable physical storage extension in DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-27 15:43:19 +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 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 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 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
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 b88f04bd21 vkd3d-shader: Add integration for DXIL shaders.
If we detect that a blob contains a DXIL chunk, use dxil-spirv to
compile the shader to SPIR-V if it is enabled in the build.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-03-18 10:58:17 +01:00
Philip Rebohle be5cdd2e55 vkd3d-shader: Optionally declare push constant buffer as UBO.
Will be used on implementations that do not support enough
push constants to hold all root signature data.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 13:54:12 +01:00
Philip Rebohle 02e98e3d5c vkd3d-shader: Unroll descriptor table offsets.
Avoids having to use 16-byte array strides when using an
inline uniform block to store the table offsets.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-16 13:54:12 +01:00
Philip Rebohle 77bc640f3f vkd3d-shader: Implement dynamic UBO indexing.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-12 11:32:41 +01:00
Philip Rebohle 6a7f1b95e5 vkd3d-shader: Add global UBO binding declarations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-12 11:32:41 +01:00
Philip Rebohle b11b95f34d vkd3d-shader: Factor out bindless resource index computation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-12 11:32:41 +01:00
Philip Rebohle 5700b37aa4 vkd3d-shader: Work around games not declaring bindings properly.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle a7fbb728ec vkd3d-shader: Apply NonUniformEXT decorations to resources as needed.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle d92d2af986 vkd3d-shader: Parse NonUniform operand modifier.
This modifier can be applied to both destination and source
operands, so for the sake of simplicity and to avoid having
to pass down modifier information explicitly, just store this
state with the register.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle 1c9b07e8b3 vkd3d-shader: Scan multi-register descriptor ranges properly.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle ffaa31e1d9 vkd3d-shader: Implement bindless sampler declarations and indexing.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle 6f20fcc488 vkd3d-shader: Implement bindless resource indexing.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle 6c4a476318 vkd3d-shader: Implement bindless resource declarations.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle ade87e6c47 vkd3d-shader: Add push constants for descriptor table offsets.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle 4218009e79 vkd3d-shader: Add helpers to declare runtime arrays.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-10 10:55:24 +01:00
Philip Rebohle 324da790db vkd3d-shader: Simplify UAV counter interface declaration.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-02 12:16:30 +01:00
Philip Rebohle 0689d8396d vkd3d-shader: Change the way UAV bindings are tracked.
Makes UAV-related code more readable and supports up to 64
UAV bindings, which is enough to support resource binding
tier 2.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-03-02 12:16:30 +01:00
Hans-Kristian Arntzen f015da5e56 vkd3d-shader: Add entry point to query if DXIL is supported.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-29 14:11:57 +01:00
Hans-Kristian Arntzen 3ebe2eb527 vkd3d-shader: Expose debug shader dumping in private header.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-27 19:46:30 +01:00
Hans-Kristian Arntzen 4928f9c094 vkd3d-shader: Add path for debug dumping SPIR-V as well.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-27 19:46:30 +01:00
Hans-Kristian Arntzen 0f971790e6 vkd3d-shader: Attempt to parse ISG1 as well when parsing input signatures.
DXIL blobs use ISG1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-27 15:20:10 +01:00
Hans-Kristian Arntzen 4a9ab29903 vkd3d-shader: Add helper function to query if a blob is DXIL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-27 15:20:10 +01:00
Hans-Kristian Arntzen edd4c990ed vkd3d-shader: Move vkd3d_find_shader into private header.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-27 15:20:10 +01:00
Philip Rebohle 82f9f76931 vkd3d-shader: Rework SPIR-V extension enablement.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-27 10:30:34 +01:00
Philip Rebohle 7cccf5756a vkd3d-shader: Rework SPIR-V capability enablement.
We're going to need more capabilities outside the 0-63 range
going forward, so a bitmask doesn't cut it and adding extra
struct members for each capability seems excessive.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-27 10:30:34 +01:00