Commit Graph

225 Commits

Author SHA1 Message Date
Giovanni Mascellani
470d83a9da vkd3d-shader: Move shader signatures to vsir_program. 2024-03-11 22:09:31 +01:00
Giovanni Mascellani
56dc0c9842 vkd3d-shader/dxbc: Decouple vkd3d_shader_desc from DXBC parsing. 2024-03-11 22:09:30 +01:00
Giovanni Mascellani
75bc68962d vkd3d-shader/dxbc: Add flag to ignore the DXBC checksum. 2024-03-11 22:08:55 +01:00
Henri Verbeet
bf628f0c74 vkd3d-shader/ir: Store block names in struct vsir_program. 2024-01-23 20:27:35 +01:00
Conor McCarthy
37d9dba512 vkd3d-shader/ir: Store code block names in struct vkd3d_shader_desc. 2024-01-17 22:28:38 +01:00
Henri Verbeet
3e2ace8d33 vkd3d-shader/dxbc: Use sizeof(uint32_t) instead of sizeof(DWORD) in calls to require_space(). 2024-01-11 23:05:56 +01:00
Henri Verbeet
69350e1ff0 vkd3d-shader/dxbc: Pass an unsigned int count to shader_parse_root_parameters1(). 2024-01-11 23:05:54 +01:00
Henri Verbeet
04acc52496 vkd3d-shader/dxbc: Pass a size_t offset to shader_get_string(). 2024-01-11 23:05:52 +01:00
Henri Verbeet
9dd5b2840f vkd3d-shader: Recognise DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS in shader_validate_descriptor_range1(). 2024-01-11 23:04:54 +01:00
Zebediah Figura
cabf9996f9 vkd3d-shader/tpf: Do not uninvert used masks for domain shader patch constants. 2023-12-11 23:18:42 +01:00
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