Commit Graph

118 Commits

Author SHA1 Message Date
Philip Rebohle b82bbe265e vkd3d: Pass storage buffer alignment to shader compiler.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-16 14:24:36 +02:00
Hans-Kristian Arntzen 85dbb6c569 vkd3d-shader: Support StorageImageReadWithoutFormat.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 14:55:24 +02:00
Hans-Kristian Arntzen 250357c998 debug: Integrate automatic RenderDoc capturing.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-22 12:44:18 +02:00
Hans-Kristian Arntzen 586f002536 vkd3d-shader: Add shader replacement.
For debugging purposes, it can be extremely useful to be able to
pinpoint and replace specific shaders for testing hypotheses.

To make this practical, change the shader dumping to use hashes rather
than monotonically incrementing indices.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Hans-Kristian Arntzen f473370678 vkd3d-shader: Add hash function for shader blobs.
Simple FNV-1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Philip Rebohle 40764d82ef vkd3d-shader: Introduce VKD3D_SHADER_BINDING_FLAG_RAW_VA.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-07-29 15:23:25 +02:00
Hans-Kristian Arntzen 7b0345a149 vkd3d-shader: Add way to scan for expected patch vertex count from HS.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Joshua Ashton fdcf33ff47 vkd3d-shader: Fix incorrect enum being used for tesselator partitioning
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-26 15:42:41 +02:00
Joshua Ashton b9909854fe vkd3d: Make nameless unions really nameless
This makes it consistent across tests and vkd3d.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-15 19:59:52 +02: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 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 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 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 34e128897d vkd3d-shader: Pass more info from root signature to shader compiler.
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
Philip Rebohle 27595a8147 vkd3d-shader: Drop support for OpenGL targets.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-26 10:18:30 +01:00
Philip Rebohle c4c9fa82b0 vkd3d-shader: Drop support for combined resource samplers.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-02-26 10:18:30 +01:00
Hans-Kristian Arntzen 93e4b6ff9b vkd3d: Deal correctly with SM 5.1 register spaces.
Resource index is found in idx[0] in SM 5.0, but idx[1] when using SM
5.1, and register space is encoded separately. An rb_tree keeps track of
the internal resource index idx[0] and can map that to space/binding as
required when emitting SPIR-V.

For this to work, we must also make UAV counters register space aware.
In earlier implementation, UAV counter mask was assumed to correlate 1:1
with register_index, which breaks on SM 5.1.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-02-24 12:32:29 +01:00
Józef Kucia 077e8b1459 vkd3d-shader: Add support for SPV_EXT_demote_to_helper_invocation.
Requires SPIRV-Headers commit dcce859e34cf0c23625ec75ac44df750aa2f4d70.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-31 08:24:34 +02:00
Józef Kucia 096dfde280 include: Document API versions.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-18 16:40:45 +02:00
Józef Kucia faeb03c1a3 vkd3d-shader: Add enum for minimum-precision data types.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-21 16:25:02 +02:00
Philip Rebohle 578ce3653d vkd3d-shader: Parse ISG1, PSG1 and OSG1 signatures.
These signatures extend the OSG5 format by a minimum
precision hint, which gets ignored for now but could
be implemented using 16-bit floats in the future.

Fixes some shader parsing errors in Resident Evil 2.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-20 20:33:27 +02:00
Józef Kucia f510e93948 vkd3d-shader: Implement sampleinfo for rasterizer.
Also adds initial infrastructure for more flexible shader parameters.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-26 16:37:18 +02:00
Józef Kucia d5d1ee4031 vkd3d-shader: Do not export vkd3d_shader_free_root_signature_v_1_0().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-25 17:20:25 +02:00
Józef Kucia 374bcd276e vkd3d-shader: Remove versioned_ prefix from root signature functions.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-25 17:20:18 +02:00
Józef Kucia 21ab63c4d6 vkd3d-shader: Remove vkd3d_shader_serialize_root_signature().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-24 10:48:24 +02:00
Józef Kucia a9ad6f637d vkd3d-shader: Implement serialization for versioned root signatures.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-24 10:48:17 +02:00
Józef Kucia 16f36b0c9b vkd3d-shader: Remove vkd3d_shader_parse_root_signature().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-19 16:24:09 +02:00
Józef Kucia fbeabe0849 vkd3d-shader: Implement conversion between root signature 1.0 and 1.1.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-19 16:24:04 +02:00
Józef Kucia f9b9ae8cc7 vkd3d-shader: Implement parsing of root signature 1.1.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-19 16:23:53 +02:00
Józef Kucia 41274e6285 vkd3d: Drop support for dummy sampler.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-04 17:25:23 +02:00
Józef Kucia d96076a919 include: Add typedefs for vkd3d-shader function pointers.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-25 19:08:06 +01:00
Józef Kucia c333fddaf9 vkd3d-shader: Add support for OpenGL tessellation shaders.
In DXBC tessellator parameters are specified in hull shaders. In OpenGL,
even in SPIR-V, tessellator parameters must be specified in the
tessellation evaluation shader.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-14 16:01:14 +01:00
Józef Kucia c314b5b01c vkd3d-shader: Get sysval semantic from shader signature for inputs.
In domain shaders, inputs are declared with dcl_input without semantic.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-08 17:20:33 +01:00
Józef Kucia 59d97b07fe vkd3d-shader: Implement hull shader barriers.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-07 17:01:57 +01:00
Józef Kucia 82fb2797ca vkd3d-shader: Add FIXME about error messages from vkd3d_shader_serialize_root_signature().
We need to fix this before finalizing vkd3d-shader API.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-06 15:38:41 +01:00
Józef Kucia 4c0692b2ef vkd3d-shader: Rename vkd3d_shader_interface to vkd3d_shader_interface_info.
For consistency with other vkd3d and vkd3d-shader structures.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-17 19:44:05 +01:00
Józef Kucia 3d80b3f4bd vkd3d-shader: Add basic support for transform feedback.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-14 20:31:13 +01:00
Józef Kucia fbcc78d2f2 include: Include stdbool.h in vkd3d_shader.h.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-01-11 19:31:34 +01:00
Józef Kucia 5b0ed414a1 vkd3d-shader: Add support for dual source blending.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-17 19:17:10 +01:00
Józef Kucia 7decb65f54 vkd3d-shader: Implement shader visibility for UAV counters.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-15 18:33:37 +01:00
Józef Kucia bf227d4a28 include: Avoid bitfields in public structures.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-08 19:07:39 +01:00
Józef Kucia f732501a14 include: Move vkd3d_result to common header.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-08 19:07:34 +01:00
Józef Kucia c2e0bf1244 build: Build libvkd3d-shader as public library.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-02 11:19:00 +01:00
Józef Kucia 6988513d7b include: Move vkd3d_shader.h to private headers.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-25 15:50:02 +02:00
Józef Kucia 844c83a837 libs/vkd3d-shader: Avoid Windows data types in public API.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-15 20:00:35 +01:00
Józef Kucia fddf86e6ea libs/vkd3d-shader: Remove dependency on D3D12 headers.
We would like to allow building libvkd3d-shader as a standalone library
without our Direct3D translation layers.

In the long term, it should be possible to build and use libvkd3d-shader
without Win32 data types, Vulkan headers and libs.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-15 20:00:31 +01:00
Józef Kucia 367e55cd59 libs/vkd3d-shader: Force public enums to 32-bit values.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-02 18:49:57 +01:00
Józef Kucia 18b285328e libs/vkd3d-shader: Add version argument to vkd3d_shader_serialize_root_signature(). 2017-10-10 16:57:36 +02:00
Józef Kucia 6b43a5fe38 libs/vkd3d-shader: Implement root signature serialization. 2017-10-10 16:02:09 +02:00
Józef Kucia 5a020d6673 libs/vkd3d-shader: Implement shader visibility for descriptors. 2017-09-22 16:42:07 +02:00
Józef Kucia b19fe74284 libs/vkd3d-shader: Export shader signature parsing. 2017-09-11 22:35:16 +02:00
Józef Kucia 5ef6f71996 libs/vkd3d-shader: Emit declarations for UAV counters. 2017-09-07 17:15:54 +02:00
Józef Kucia 7416c83ae2 libs/vkd3d-shader: Rename vkd3d_descriptor_type to vkd3d_shader_descriptor_type. 2017-09-07 17:15:54 +02:00
Józef Kucia efdf2ec691 libs/vkd3d-shader: Rename vkd3d_shader_push_constant to vkd3d_shader_push_constant_buffer.
This should be clearer. Multiple constant buffers can be assigned to
a single push constant range.
2017-09-07 17:15:54 +02:00
Józef Kucia 5bdc928908 libs/vkd3d-shader: Export shader scan function.
For UAV counters support in libvkd3d.
2017-09-01 11:27:58 +02:00
Józef Kucia f5515c46df libs/vkd3d: Create default sampler for each root signature.
We need a sampler for SpvOpImageFetch aka texelFetch().
2017-08-16 13:11:52 +02:00
Józef Kucia e3d6bac31b libs/vkd3d-shader: Introduce vkd3d_shader_interface structure. 2017-08-16 13:11:52 +02:00
Józef Kucia 2665cbe522 libs/vkd3d: Duplicate Vulkan descriptors for SRVs and UAVs.
Vulkan has different descriptor types for buffers and textures.
Therefore, we do not know the exact Vulkan descriptor type for D3D12 SRV
and UAV descriptors up front. This information can be extracted from
shaders when creating PSOs but creating incompatible Vulkan descriptor
set layouts for PSOs with the same root signature would introduce a lot
of complexity.

In order to preserve compatibility between resource bindings for PSOs
with the same root signature we duplicate Vulkan descriptors for SRVs
and UAVs (a buffer view and an image view descriptor). This strategy may
be reasonable for small root signatures.
2017-08-08 17:09:35 +02:00
Józef Kucia d75966ab9e libs/vkd3d: Assign non-overlapping push constant ranges for root constants. 2017-08-01 10:51:45 +02:00
Józef Kucia 92fcb9ffa2 libs/vkd3d-shader: Add support for push constants. 2017-07-27 15:24:38 +02:00
Józef Kucia edd1e9602d libs/vkd3d-shader: Implement arbitrary mappings from D3D shader register to Vulkan descriptors.
An arbitrary mapping can be passed to vkd3d_shader_compile_dxbc().
2017-07-26 13:45:25 +02:00
Józef Kucia 8f6af1125d libs/vkd3d-shader: Get rid of VKD3D_SHADER_FLIP_Y compiler option.
We use negative viewport height to flip Y.
2017-06-27 22:21:43 +02:00
Józef Kucia 0afe0032b0 libs/vkd3d-shader: Add VKD3D_SHADER_STRIP_DEBUG compiler option. 2017-06-27 22:21:43 +02:00
Józef Kucia 3f03cd1ec8 libs/vkd3d-shader: Implement root signature parsing. 2017-06-27 13:16:47 +02:00
Józef Kucia 93458c8933 libs/vkd3d-shader: Add library. 2017-06-16 22:38:21 +02:00