Jacek Caban
078cf6a240
vkd3d-shader/dxbc: Use return type to return result from read_u32 and read_float.
...
Avoid implicit casts from enum pointers.
2023-11-20 22:07:45 +01:00
Conor McCarthy
8648ca0e77
vkd3d-shader/dxil: Read the DXIL input and output signatures.
...
These can differ from the DXBC signatures by having multiple rows, and
load/store instructions reference them by id instead of register index.
2023-10-16 22:36:29 +02:00
Conor McCarthy
5984b4e455
vkd3d-shader/dxbc: Load input signatures also from ISG1 chunks.
...
When DXBC contains DXIL code it uses ISG1 signatures.
2023-09-25 22:07:06 +02:00
Zebediah Figura
1615e5a76b
vkd3d-shader/dxbc: Map sm4 fragment outputs to system values based on their name.
2023-09-21 19:16:29 +02:00
Zebediah Figura
cb96482500
vkd3d-shader: Add a separate field for the target location of a signature element.
...
We want to be able to remap input signatures based on the signature index, but
signature normalization both reorders the signature, and requires the old
register index, so add a new field for this.
2023-08-03 21:20:39 +09:00
Zebediah Figura
dfb2a316e6
vkd3d-shader/dxbc: Remove redundant zero-initialization of the vkd3d_shader_desc structure.
2023-07-04 22:39:43 +02:00
Conor McCarthy
6775f7ba66
vkd3d-shader/dxil: Read and validate DXIL bitcode unabbreviated blocks.
2023-06-28 21:40:34 +02:00
Conor McCarthy
6835e8176f
vkd3d-shader/ir: Normalise signatures and input/output registers to the Shader Model 6 pattern.
...
In Shader Model 6 each signature element can span a range of register
indices, or 'rows', and system values do not share a register index with
non-system values. Inputs and outputs are referenced by element index
instead of register index. This patch merges multiple signature elements
into a single element under the following conditions:
- The register index in a load or store is specified dynamically by
including a relative address parameter with a base register index. The
dcl_index_range instruction is used to identify these.
- A register declaration is split across multiple elements which declare
different components of the register.
- A patch constant function writes tessellation factors. These are an
array in SPIR-V, but in SM 5.x each factor is declared as a separate
register, and these are dynamically indexed by the fork/join instance
id. Elimination of multiple fork/join phases converts the indices to
constants, but merging the signature elements into a single arrayed
element matches the SPIR-V output.
All references to input/output register indices are converted to element
indices. If a relative address is present, the element index is moved up
a slot so it cannot be confused with a constant offset. Existing code
only handles register index relative addressing for tessellation factors.
This patch adds generic support for it.
2023-05-24 22:00:29 +02:00
Conor McCarthy
a0a18b1620
vkd3d-shader: Introduce an internal shader signature structure.
...
A register count is required for Shader Model 6 signatures, including
those normalised from earlier models.
2023-05-03 21:12:07 +02:00
Henri Verbeet
73dc62aebf
vkd3d-shader: Get rid of the unused vkd3d_shader_src_param_entry structure.
2023-05-02 20:45:27 +02:00
Henri Verbeet
804e315b68
vkd3d-shader/sm4: Move the TPF parser from dxbc.c to hlsl_sm4.c.
2023-04-20 22:54:28 +02:00
Henri Verbeet
0c05f2409c
vkd3d-shader/sm4: Get rid of shader_sm4_is_end().
2023-04-12 21:54:57 +02:00
Henri Verbeet
1e448b0b71
vkd3d-shader/sm4: Pass a vkd3d_shader_sm4_parser structure to shader_sm4_read_instruction().
2023-04-12 21:54:56 +02:00
Henri Verbeet
09566e2c25
vkd3d-shader: Get rid of the "ptr" field from struct vkd3d_shader_parser.
...
This is an implementation detail.
2023-04-12 21:54:53 +02:00
Zebediah Figura
a60c47ff39
vkd3d-shader: Explicitly align the size in bytecode_get_next_offset() and rename it accordingly.
2023-04-06 17:52:16 +02:00
Henri Verbeet
d6d9aab31c
vkd3d-shader: Align the start offset instead of the size in bytecode_put_bytes().
...
The practical effect this has is that we avoid potential trailing padding at
the end of DXBC blobs. Unfortunately this also means we need to be more
careful about using bytecode_get_size() to find the offset where subsequent
data would get written, although in many cases this follows a put_u32() call.
2023-04-04 22:01:36 +02:00
Henri Verbeet
685abf9c2d
vkd3d-shader/sm4: Do not specify a destination register for VKD3D_SM4_OP_DCL_RESOURCE in opcode_table[].
...
We do not set one in shader_sm4_read_dcl_resource(), and
shader_sm4_read_instruction() explicitly sets this to 0.
2023-03-13 22:09:54 +01:00
Henri Verbeet
65b7154a22
vkd3d-shader/sm4: Set "dst_count" to 0 when we clear "dst" in shader_sm4_read_instruction().
...
VKD3D_SM4_OP_DCL_RESOURCE currently has 1 for "dst_count", but NULL for
"dst". This is largely harmless because we never attempt to access the
destination register of VKD3DSIH_DCL instructions, but nevertheless not
quite proper.
2023-03-13 22:09:49 +01:00
Nikolay Sivov
ee52ad8106
vkd3d-shader/trace: Output sample count for multisampled resources.
2023-03-08 20:15:06 +01:00
Conor McCarthy
9f6e6d3fcd
vkd3d-shader/dxbc: Validate and skip the signature section header size.
...
Silences a very common warning.
2023-03-08 20:14:59 +01:00
Conor McCarthy
3b5316be82
vkd3d-shader/dxbc: Emit a shader error for an invalid signature data size.
2023-03-08 20:14:57 +01:00
Conor McCarthy
83e39e2650
vkd3d-shader/dxbc: Pass a message context to for_each_dxbc_section().
2023-03-08 20:14:55 +01:00
Henri Verbeet
b1e13d6e33
vkd3d-shader/dxbc: Introduce API for serialising DXBC blobs.
2023-02-23 21:47:27 +01:00
Henri Verbeet
c87492ed21
vkd3d-shader/dxbc: Introduce API for parsing DXBC blobs.
2023-02-23 21:47:26 +01:00
Henri Verbeet
d0d2130f74
vkd3d-shader/dxbc: Rename parse_dxbc() to for_each_dxbc_section().
2023-02-23 21:47:23 +01:00
Henri Verbeet
a06320c1fc
vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to parse_dxbc().
2023-02-23 21:47:22 +01:00
Henri Verbeet
2f762465a6
vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to shader_extract_from_dxbc().
2023-02-23 21:47:21 +01:00
Henri Verbeet
3a3acb5b7d
vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to shader_parse_input_signature().
2023-02-23 21:47:20 +01:00
Henri Verbeet
e2825f7658
vkd3d-shader/dxbc: Pass a vkd3d_shader_dxbc_section_desc structure to the parse_dxbc() section handler.
2023-02-23 21:47:19 +01:00
Henri Verbeet
5020781f76
vkd3d-shader/dxbc: Pass a vkd3d_shader_dxbc_section_desc structure to shader_parse_root_signature().
2023-02-23 21:47:18 +01:00
Henri Verbeet
6c64f8a217
vkd3d-shader/dxbc: Pass a vkd3d_shader_dxbc_section_desc structure to shader_parse_signature().
2023-02-23 21:47:16 +01:00
Henri Verbeet
bf3c012834
vkd3d-shader/dxbc: Rename the dxbc_writer_section structure to vkd3d_shader_dxbc_section_desc.
...
In preparation of exposing it in the public API.
2023-02-23 21:47:15 +01:00
Henri Verbeet
b59de4de5c
vkd3d-shader/dxbc: Store DXBC section data as a vkd3d_shader_code structure.
2023-02-23 21:47:13 +01:00
Conor McCarthy
2a5ae0a8c6
vkd3d-shader/sm4: Use the instruction array interface in compile_dxbc_tpf().
2023-01-24 18:11:14 +01:00
Conor McCarthy
e9a2642d6a
vkd3d-shader/trace: Use the instruction array interface in vkd3d_dxbc_binary_to_text().
2023-01-24 18:11:10 +01:00
Conor McCarthy
e8cb90608d
vkd3d-shader: Initialise the instruction array in vkd3d_shader_parser_init().
2023-01-24 18:11:10 +01:00
Conor McCarthy
a9aaa59df0
vkd3d-shader/sm4: Store parsed instructions in an array.
2023-01-24 18:11:08 +01:00
Zebediah Figura
520c7457a9
vkd3d-shader/sm4: Use a flat array to store destination types.
...
This cuts about 12 kB off of the 64-bit build.
2022-11-08 20:52:36 +01:00
Zebediah Figura
4173158c8b
vkd3d-shader/sm4: Use a flat array to store source types.
2022-11-08 20:52:34 +01:00
Zebediah Figura
e2aed38509
vkd3d-shader/spirv: Avoid using DXBC-specific definitions.
2022-11-08 20:52:32 +01:00
Zebediah Figura
ba08825ccd
vkd3d-shader/sm4: Use the VKD3D_DXBC_MAX_SOURCE_COUNT macro where possible.
2022-11-08 20:52:31 +01:00
Zebediah Figura
fa17a170b1
vkd3d-shader/sm4: Recognise the msad opcode.
...
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-14 18:31:08 +01:00
Henri Verbeet
273316a742
vkd3d-shader/sm4: Make the "reg" parameter to shader_sm4_set_descriptor_register_range() const.
...
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:31:33 +01:00
Matteo Bruni
02ac34d0a2
vkd3d-shader/sm4: Skip non-color outputs in shader output mapping.
...
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-14 21:02:01 +01:00
Alexandre Julliard
e21928f6ee
vkd3d-shader: Consistently use uint32_t for pointers to shader data.
...
Mixing uint32_t and DWORD pointers causes warnings on Windows.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
2022-01-31 15:58:08 +01:00
Zebediah Figura
4fdd6f0935
vkd3d-shader: Trace tiled resource opcodes.
...
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-01-13 17:20:44 +01:00
Conor McCarthy
eb1ae29de0
vkd3d-shader/dxbc: Emit a fixme when a DXIL shader chunk is found.
...
Simplifies detection of SM6+ shaders, e.g. Horizon Zero Dawn and
Cyberpunk 2077.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-10 20:10:08 +01:00
Zebediah Figura
2edec69da4
vkd3d-shader: Make shader_extract_from_dxbc() static.
...
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-01-06 11:34:19 +01:00
Conor McCarthy
4a2fbe54c0
vkd3d-shader/spirv: Implement support for stencil export.
...
Based on a vkd3d-proton patch by Philip Rebohle.
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 18:37:00 +02:00
Henri Verbeet
28316b2694
vkd3d-shader: Introduce struct vkd3d_shader_parser_ops.
...
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 18:35:42 +02:00