Commit Graph

203 Commits

Author SHA1 Message Date
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
Henri Verbeet
f5c6f2ea0e vkd3d-shader: Introduce vkd3d_shader_parser_error().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 18:35:40 +02:00
Henri Verbeet
a0c2e52b4b vkd3d-shader/sm4: Set an error state when shader_sm4_error() is called.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 18:35:38 +02:00
Henri Verbeet
8543a1741e vkd3d-shader/sm4: Use the parser location in shader_sm4_error().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 18:35:36 +02:00
Henri Verbeet
18e838a1cc vkd3d-shader/sm4: Maintain the parser location in the vkd3d_shader_parser structure.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 15:34:21 +02:00
Henri Verbeet
aca39afd73 vkd3d-shader/sm4: Store the message context pointer in the vkd3d_shader_parser structure.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 15:34:20 +02:00
Henri Verbeet
6be802ac1f vkd3d-shader/sm4: Get rid of the redundant "shader_version" field in the vkd3d_shader_sm4_parser structure.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 15:34:18 +02:00
Henri Verbeet
3023d6ba46 vkd3d-shader/sm4: Rename the vkd3d_sm4_data structure to vkd3d_shader_sm4_parser.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 15:34:16 +02:00
Henri Verbeet
88c8d11805 vkd3d-shader/sm4: Store a vkd3d_shader_parser structure in the vkd3d_sm4_data structure.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 15:34:14 +02:00
Conor McCarthy
04bb6c395f vkd3d-shader/sm4: Skip second-order extended operands.
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-09-28 20:17:35 +02:00
Conor McCarthy
9e40fe5768 vkd3d-shader/sm4: Parse the "non-uniform" modifier.
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-09-28 20:17:34 +02:00
Conor McCarthy
a422e37953 vkd3d-shader/sm4: Parse register precision modifiers.
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-09-28 20:17:32 +02:00
Conor McCarthy
cddd978be6 vkd3d-shader/sm4: Parse register modifiers separately from the extended operand type.
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-09-28 20:17:30 +02:00