Commit Graph

427 Commits

Author SHA1 Message Date
Henri Verbeet
f96a791807 vkd3d-shader/ir: Pass a uint32_t swizzle to vkd3d_swizzle_get_component64(). 2023-12-14 23:19:51 +01:00
Henri Verbeet
8a1de71fb1 vkd3d-shader/ir: Pass a uint32_t swizzle to vkd3d_swizzle_get_component(). 2023-12-14 23:19:49 +01:00
Henri Verbeet
21491d1bbb vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_32_from_64(). 2023-12-13 22:33:07 +01:00
Henri Verbeet
3759186193 vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_64_from_32(). 2023-12-13 22:33:06 +01:00
Henri Verbeet
713adaa56a vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_component_count(). 2023-12-13 22:33:04 +01:00
Henri Verbeet
e1aa12f94b vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_get_component_idx(). 2023-12-13 22:33:03 +01:00
Giovanni Mascellani
ec4986e9e2 vkd3d-shader/spirv: Honor force_validation after emitting SPIR-V code. 2023-12-13 22:32:25 +01:00
Giovanni Mascellani
1015cc952e vkd3d-shader/d3d-asm: Add an "internal" mode for the ASM dumper.
The new mode exposes more details about what's going on inside the VSIR
code and it's meant to ease development and debugging.
2023-12-12 23:16:26 +01:00
Conor McCarthy
0610867334 vkd3d-shader/spirv: Emit an error if 64-bit integers are used. 2023-12-12 22:50:48 +01:00
Conor McCarthy
1929432559 vkd3d-shader: Introduce an instruction flag to suppress masking of bitwise shift counts.
DXIL does not use implicit masking of shift counts.
2023-12-12 22:50:46 +01:00
Conor McCarthy
1630fd9a3c vkd3d-shader/dxil: Apply metadata attachments to instructions.
These are apparently only used for 'dx.op' intrinsics, because the
instructions based on native LLVM ones have their own way to apply
attributes.
2023-12-07 21:57:00 +01:00
Conor McCarthy
cb88844a3d vkd3d-shader: Add a register index to struct vkd3d_shader_immediate_constant_buffer. 2023-12-07 21:56:47 +01:00
Conor McCarthy
ffae57eb8d vkd3d-shader/dxil: Support null constant arrays. 2023-12-07 21:56:43 +01:00
Conor McCarthy
9fcc904834 vkd3d-shader/spirv: Always emit clip/cull builtins as an array.
Clip/cull distance can appear as input in pixel shaders, and the
array size must not be forced to zero.
2023-12-06 15:31:20 +01:00
Conor McCarthy
eb05e434ff vkd3d-shader/dxil: Implement the DXIL LOAD instruction. 2023-11-22 22:07:59 +01:00
Conor McCarthy
59730ecfd8 vkd3d-shader/dxil: Implement the DXIL GEP instruction. 2023-11-22 22:07:58 +01:00
Conor McCarthy
a0f5d70792 vkd3d-shader/dxil: Support global variable initialisers. 2023-11-22 22:07:57 +01:00
Conor McCarthy
f2a656b876 vkd3d-shader/dxil: Introduce a value type for immediate constant buffers. 2023-11-22 22:07:56 +01:00
Conor McCarthy
85d5f83fb7 vkd3d-shader/dxil: Implement default address space global variables. 2023-11-22 22:07:54 +01:00
Conor McCarthy
920657e7ee vkd3d-shader: Delete unused struct list from struct vkd3d_shader_indexable_temp. 2023-11-22 22:07:52 +01:00
Henri Verbeet
01dad41862 vkd3d-shader/ir: Skip recording combined resource/sampler information for dynamically indexed descriptor arrays.
And output a warning instead.
2023-11-21 22:41:57 +01:00
Henri Verbeet
215a2c4ede vkd3d-shader/ir: Introduce vsir_register_is_descriptor(). 2023-11-13 23:19:10 +01:00
Conor McCarthy
22960753e9 vkd3d-shader/spirv: Introduce orderedness to comparison instructions. 2023-11-10 20:23:51 +01:00
Conor McCarthy
d3b90cc877 vkd3d-shader/dxil: Implement the DXIL CMP2 instruction. 2023-11-10 20:23:50 +01:00
Zebediah Figura
c7a7d9a18c vkd3d-shader/ir: Normalize all I/O registers to INPUT/OUTPUT/PATCHCONST.
Specifically, map COLOROUT to OUTPUT, and map INCONTROLPOINT to INPUT for domain
shaders as well as hull shaders.

Obscure the non-existent differences from the view of the backend.
2023-11-09 21:14:52 +01:00
Conor McCarthy
58ffb5d181 vkd3d-shader/spirv: Introduce integer width cast instructions.
ITOI and UTOU may cast from a bool to a 32-bit integer. Cast to a 64-bit
integer from a smaller type will be added later.
2023-11-09 21:14:32 +01:00
Conor McCarthy
7de4ac2e48 vkd3d-shader/spirv: Support bool cast in spirv_compiler_emit_alu_instruction(). 2023-11-09 21:14:30 +01:00
Conor McCarthy
5b87d6419a vkd3d-shader/spirv: Support bool logic ops in spirv_compiler_emit_alu_instruction(). 2023-11-09 21:14:27 +01:00
Zebediah Figura
12240efa79 vkd3d-shader/spirv: Use register counts from the signature and shader desc. 2023-11-07 22:26:49 +01:00
Zebediah Figura
0058764f01 vkd3d-shader: Store the control point counts in struct vkd3d_shader_desc. 2023-11-07 22:26:49 +01:00
Giovanni Mascellani
2f7d52dba4 vkd3d-shader/ir: Check that IF blocks are correctly nested. 2023-11-07 22:26:01 +01:00
Conor McCarthy
749df8dec2 vkd3d-shader/dxil: Implement the DXIL BINOP instruction. 2023-11-06 23:09:03 +01:00
Conor McCarthy
acbc80cba2 vkd3d-shader/spirv: Introduce an IDIV instruction. 2023-11-06 23:09:00 +01:00
Conor McCarthy
c8d3515d8b vkd3d-shader/spirv: Introduce an FREM instruction. 2023-11-06 23:08:58 +01:00
Zebediah Figura
fa23165cc0 vkd3d-shader/spirv: Remove handling of VKD3DSPR_OUTCONTROLPOINT.
I/O normalization removes this register type.
2023-11-06 23:07:58 +01:00
Zebediah Figura
b73d2c978d vkd3d-shader/ir: Check for vocp usage during IR normalization.
The hull shader barrier used for this was broken by I/O normalization, since
vocp is no longer exposed to the spirv backend.

Restore this barrier by checking for vocp during normalization instead.
2023-11-06 23:07:56 +01:00
Giovanni Mascellani
af72466db1 vkd3d-shader/ir: Validate the index of a TEMP register. 2023-11-02 18:22:52 +01:00
Giovanni Mascellani
4140b87499 vkd3d-shader/ir: Validate the DCL_TEMPS instruction. 2023-11-02 18:22:50 +01:00
Giovanni Mascellani
79fa5fd8bb vkd3d-shader/ir: Validate the register index count. 2023-11-02 18:22:49 +01:00
Giovanni Mascellani
26e4191d4b vkd3d-shader/ir: Validate the register dimension. 2023-11-02 18:22:47 +01:00
Giovanni Mascellani
f3a20be35a vkd3d-shader/ir: Validate the register data type. 2023-11-02 18:22:38 +01:00
Giovanni Mascellani
72d0f765f2 vkd3d-shader/ir: Validate the register precision. 2023-11-02 18:22:37 +01:00
Giovanni Mascellani
2ba8c5771c vkd3d-shader: Deduplicate profile version comparison functions. 2023-11-02 18:22:35 +01:00
Giovanni Mascellani
dd96fe50e2 vkd3d-shader: Dump shaders as soon as possible.
So that they are dumped even if parsing fails, which is a circumstance
in which one likely wants to see the problematic shader.

The downside of that is that for shader types other than HLSL
the profile is not written any more in the filename. This should
not be a big problem, because in those cases the shader describes
its own type.

When dumping an HLSL shader, the id is brought in front of the profile
in the file name, in order to make it more tab-friendly: when dealing
with a directory full of shaders it's likely that the id determines
the profile, but the other way around.
2023-11-02 18:22:26 +01:00
Giovanni Mascellani
ab09c0b45b vkd3d-shader: Expose the whole profile when dumping an HLSL shader.
The profile cannot be reliably devised by analyzing the HLSL code,
so it's useful to have it included in the file name.
2023-11-02 18:22:24 +01:00
Conor McCarthy
43b5d73870 vkd3d-shader/dxil: Implement DX instruction CBufferLoadLegacy. 2023-11-01 21:47:32 +01:00
Conor McCarthy
3b1bbe2b0a vkd3d-shader/dxil: Implement DX instruction CreateHandle. 2023-11-01 21:47:30 +01:00
Zebediah Figura
15b69721de vkd3d-shader/tpf: Set the interpolation mode for signature elements. 2023-10-31 21:59:38 +01:00
Nikolay Sivov
9a6e4a0c58 vkd3d-shader/hlsl: Check for duplicate case statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:58:59 +01:00
Conor McCarthy
f7525bf0c6 vkd3d-shader/dxil: Validate the descriptor list metadata nodes. 2023-10-19 23:07:42 +02:00
Conor McCarthy
a4ed06bc5b vkd3d-shader/d3d-asm: Recognise the 'rasteriser ordered view' UAV flag. 2023-10-18 20:58:27 +02:00
Henri Verbeet
b63c853688 vkd3d-utils: Implement D3DGetBlobPart().
This was largely adapted from Wine's d3dcompiler_43, with some style
adjustments.
2023-10-18 20:58:22 +02:00
Conor McCarthy
4b7ca0c294 vkd3d-shader/dxil: Read DXIL global flags. 2023-10-17 22:18:25 +02:00
Conor McCarthy
06f8a88466 vkd3d-shader: Define more global flags. 2023-10-17 22:18:23 +02:00
Conor McCarthy
7113064a19 vkd3d-shader/dxil: Handle signature element additional tag/value pairs. 2023-10-16 22:36:36 +02: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
62badbff7a vkd3d-shader/dxil: Validate the entry point info. 2023-10-16 22:36:28 +02:00
Conor McCarthy
cba3e18c45 vkd3d-shader/dxil: Read DXIL metadata values. 2023-10-12 18:23:31 +02:00
Conor McCarthy
a62343f544 vkd3d-shader/dxil: Read DXIL metadata strings. 2023-10-12 18:23:29 +02:00
Conor McCarthy
df4e1b7393 vkd3d-shader/dxil: Read immediate constant arrays. 2023-10-11 22:21:19 +02:00
Zebediah Figura
2bcd6ea893 vkd3d-shader: Introduce a separate register type for combined samplers. 2023-10-09 21:58:38 +02:00
Alistair Leslie-Hughes
71715cc434 vkd3d-shader: Fix compiler warning.
vkd3d-shader/tpf.c:3810:39: warning: passing argument 2 of ‘sm4_register_from_node’ from incompatible pointer type [-Wincompatible-pointer-types]
vkd3d-shader/tpf.c:4750:59: warning: passing argument 3 of ‘sm4_register_from_deref’ from incompatible pointer type [-Wincompatible-pointer-types]

Change to use uint32_t as requested.
2023-10-05 16:14:44 +02:00
Conor McCarthy
f61c853f61 vkd3d-shader/dxil: Convert into an error the warning for an unhandled instrinsic. 2023-09-26 22:07:51 +02:00
Francisco Casas
e904660497 vkd3d-shader: Turn vkd3d_shader_register.immconst_type into vkd3d_shader_register.dimension. 2023-09-26 22:07:04 +02:00
Francisco Casas
5d6899888d vkd3d-shader: Rename shader_register_init() to vsir_register_init(). 2023-09-26 22:06:50 +02:00
Conor McCarthy
3249723972 vkd3d-shader/spirv: Introduce a Static Single Assignment register type. 2023-09-25 22:07:04 +02:00
Giovanni Mascellani
34b1c0fe5d vkd3d-shader/ir: Validate source parameters. 2023-09-22 11:06:18 +02:00
Giovanni Mascellani
603170106c vkd3d-shader/ir: Validate destination parameters. 2023-09-22 11:06:17 +02:00
Giovanni Mascellani
585e60ad3b vkd3d-shader/ir: Validate register types. 2023-09-22 11:06:16 +02:00
Giovanni Mascellani
b09cfbda90 vkd3d-shader/ir: Validate instruction handlers. 2023-09-22 11:06:15 +02:00
Giovanni Mascellani
c052cd8998 vkd3d-shader/ir: Introduce a boilerplate to validate the generated IR.
For the moment the validator is trivial, it never fails. Checks will
be added incrementally.
2023-09-22 11:06:13 +02:00
Giovanni Mascellani
cf871d2cb2 vkd3d-shader: Embed the parsing location in vkd3d_shader_instruction.
So that it can be used for printing meaningful error locations by
downstream processors.
2023-09-22 11:06:12 +02:00
Giovanni Mascellani
05af25eecb vkd3d-shader: Rename shader_instruction_init(). 2023-09-22 11:06:05 +02:00
Conor McCarthy
e54f770669 vkd3d-shader/dxil: Implement the DXIL CALL instruction. 2023-08-30 22:48:48 +02:00
Conor McCarthy
58d6e44501 vkd3d-shader/dxil: Validate the function block count. 2023-08-30 22:48:45 +02:00
Zebediah Figura
9624e2f904 vkd3d-shader/spirv: Declare SRVs and UAVs from the descriptor info. 2023-08-28 20:40:02 +02:00
Conor McCarthy
61841e9423 vkd3d-shader/tpf: Handle the swizzle type bitfield in dst param tokens. 2023-08-28 20:39:49 +02:00
Conor McCarthy
92021b7a3c vkd3d-shader/tpf: Use the default vec4 swizzle if a src param contains a mask. 2023-08-28 20:39:46 +02:00
Conor McCarthy
7e5d9e3b6f vkd3d-shader/tpf: Handle the dimension bitfield in src param tokens. 2023-08-28 20:39:45 +02:00
Conor McCarthy
5c706152fa vkd3d-shader/tpf: Validate the src register of case conditions.
Case values are constants in TPF.
2023-08-28 20:39:43 +02:00
Nikolay Sivov
1153f6bb34 vkd3d-shader/hlsl: Parse "if" statement attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-24 21:43:49 +02:00
Zebediah Figura
c1ebba9515 vkd3d-shader: Add structure stride to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
88f85ffb50 vkd3d-shader: Add constant buffer size to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
8c465c81cf vkd3d-shader: Add sample count to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Nikolay Sivov
932c5e36dc vkd3d-shader/hlsl: Add constant folding for 'log2'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:20 +02:00
Nikolay Sivov
58bc61e48d vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:18 +02:00
Zebediah Figura
7d02922541 vkd3d-shader: Add register ID to struct vkd3d_shader_descriptor_info1. 2023-08-14 18:38:11 +02:00
Zebediah Figura
4e9798f6f7 vkd3d-shader: Introduce struct vkd3d_shader_scan_descriptor_info1. 2023-08-14 18:38:11 +02:00
Francisco Casas
2258e9d0f3 vkd3d-shader/tpf: Make register_type_table an array of structs with lookup tables. 2023-08-14 18:38:06 +02:00
Zebediah Figura
d932fba7c3 vkd3d-shader/spirv: Make output varyings not consumed by the next stage private variables. 2023-08-03 21:20:42 +09:00
Zebediah Figura
11475ef62a vkd3d-shader: Implement remapping shader output registers to match the next shader's semantics. 2023-08-03 21:20:42 +09: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
Conor McCarthy
402c93fa68 vkd3d-shader/spirv: Introduce an undefined register type. 2023-07-20 22:32:52 +02:00
Conor McCarthy
3e553aaaa7 vkd3d-shader/dxil: Emit the shader instructions.
Sufficient for compiling a no-op pixel shader.
2023-07-20 22:32:51 +02:00
Zebediah Figura
e9fb067d4c vkd3d-shader/ir: Move normalization code from spirv.c to ir.c.
It is not spirv-specific and will (presumably) be used for GLSL as well.
2023-07-17 22:56:43 +02:00
Zebediah Figura
d077562f79 vkd3d-shader/d3dbc: Scan descriptors for constant register sets. 2023-07-17 22:56:39 +02:00
Conor McCarthy
5d33fb4633 vkd3d-shader/dxil: Read numeric constants. 2023-07-11 22:43:57 +02:00
Conor McCarthy
c96143abdc vkd3d-shader/dxil: Read global function declarations. 2023-07-11 22:43:55 +02:00
Conor McCarthy
22157c3da3 vkd3d-shader/dxil: Validate the module format version. 2023-07-11 22:43:53 +02:00
Conor McCarthy
eca4b62c7e vkd3d-shader/dxil: Read the value symbol table. 2023-07-11 22:43:49 +02:00
Conor McCarthy
571d807dd8 vkd3d-shader/dxil: Read the type table. 2023-07-11 22:43:48 +02:00
Zebediah Figura
e489098878 vkd3d-shader: Record a global temporary count per sm4 shader.
Store it in the shader_desc, and declare temps from that when compiling SPIR-V,
instead of parsing dcl_instructions.

As part of this change, we declare a single, global temps array (with Private
scope instead of Function) which is as large as the maximum of all dcl_temps
instructions. It is not clear to me whether this will improve, hurt, or have no
significant effect on the lower-level compiler. An alternative is to still
redeclare a new temps array every time (although still with a smaller size).
2023-07-04 22:39:45 +02:00
Conor McCarthy
6775f7ba66 vkd3d-shader/dxil: Read and validate DXIL bitcode unabbreviated blocks. 2023-06-28 21:40:34 +02:00
Zebediah Figura
7e1fcdca89 vkd3d-shader: Synthesize signatures for d3dbc shaders. 2023-06-27 22:33:41 +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
110e48e54d vkd3d-shader/ir: Eliminate struct vkd3d_shader_normaliser. 2023-05-24 22:00:28 +02:00
Conor McCarthy
6dd1b01284 vkd3d-shader/tpf: Validate index range declarations. 2023-05-09 21:51:31 +02:00
Conor McCarthy
d565fbdcd6 vkd3d-shader/tpf: Validate input/output registers. 2023-05-09 21:51:29 +02:00
Conor McCarthy
2166088b0b vkd3d-shader/tpf: Validate signature element masks. 2023-05-09 21:51:28 +02:00
Conor McCarthy
b8e6482365 vkd3d-shader/tpf: Validate signature element register indices. 2023-05-09 21:51:19 +02:00
Conor McCarthy
adf7db021c vkd3d-shader/tpf: Validate input/output register index counts. 2023-05-09 21:51:17 +02:00
Francisco Casas
3e9a9c5051 vkd3d-shader/hlsl: Track objects sampling dimension. 2023-05-08 20:24:15 +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
Nikolay Sivov
6da7d16d4c vkd3d-shader/trace: Add separate id for discard.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-26 22:46:49 +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
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
Henri Verbeet
c4d307a08d vkd3d-shader: Get rid of the "instruction_idx" field from struct vkd3d_shader_parser.
This is unused now.
2023-04-12 21:54:51 +02:00
Conor McCarthy
98b5e2c6e0 vkd3d-shader/ir: Insert hull shader control point input declarations if no control point phase is defined.
The SPIR-V backend will emit a default control point phase. Inserting
inputs into the IR allows handling of declarations via the usual path
instead of an ad hoc implementation which may not match later changes
to input handling.
2023-04-12 21:54:28 +02:00
Conor McCarthy
14295a224d vkd3d-shader/ir: Normalise control point phase output registers to include the control point id.
In SPIR-V the address must include the invocation id, but in TPF it
is implicit. Move the register index up one slot and insert an
OUTPOINTID relative address.
2023-04-12 21:54:27 +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
Zebediah Figura
70cfd58be6 vkd3d-shader/spirv: Introduce a spirv_compile() helper. 2023-04-06 17:51:59 +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
Conor McCarthy
16a7de4b38 vkd3d-shader/trace: Trace the normalised instruction array after tracing the input. 2023-04-03 17:58:23 +02:00
Conor McCarthy
eabdccb117 vkd3d-shader/ir: Merge all shader IR fork and join phases into a single phase.
Normalise the incoming vkd3d_shader_instruction IR to the shader model 6
pattern. This allows generation of a single patch constant function in
SPIR-V.
2023-04-03 17:58:21 +02:00
Nikolay Sivov
ee52ad8106 vkd3d-shader/trace: Output sample count for multisampled resources. 2023-03-08 20:15:06 +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
Henri Verbeet
c87492ed21 vkd3d-shader/dxbc: Introduce API for parsing DXBC blobs. 2023-02-23 21:47:26 +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
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
d14f42be9d vkd3d-shader/spirv: Pass a parser pointer to spirv_compiler_generate_spirv(). 2023-01-24 18:11:16 +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
Conor McCarthy
007f894b94 vkd3d-shader/sm1: Store parsed instructions in an array. 2023-01-24 18:11:06 +01:00
Zebediah Figura
9c817e5e6d vkd3d-shader/hlsl: Forbid recursive calls. 2023-01-19 19:16:27 +01:00
Zebediah Figura
718c79b823 vkd3d-shader/hlsl: Parse the numthreads attribute. 2022-11-08 20:53:04 +01:00
Zebediah Figura
d6799bd5d3 vkd3d-shader/hlsl: Parse function attributes. 2022-11-08 20:53:03 +01:00
Zebediah Figura
e2aed38509 vkd3d-shader/spirv: Avoid using DXBC-specific definitions. 2022-11-08 20:52:32 +01:00
Zebediah Figura
35b48a8b04 vkd3d-shader/spirv: Rename struct vkd3d_dxbc_compiler to struct spirv_compiler.
We would like to generate SPIR-V for input formats other than DXBC.

The "vkd3d_" prefix is dropped, partly to make names shorter, and partly to help
clarify what is an internal function.

I prefer avoiding the vkd3d_* prefix on all internal functions, for these
reasons. However, I'm open to restoring it.
2022-11-08 20:52:29 +01:00
Francisco Casas
6989266e76 vkd3d-shader/hlsl: Check for non-static object references.
It is responsibility of the shader's programmer to ensure that
object references can be solved statically.

Resource arrays for ps_5_1 and vs_5_1 are an exception which is not
properly handled yet. They probably deserve a different object type.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Matteo Bruni
228f7ab5cd vkd3d-shader/hlsl: Handle over/underflow when parsing integer literals.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-12 19:33:56 +02:00
Giovanni Mascellani
40b299c727 vkd3d-shader/hlsl: Fold constant division.
This commit includes work by Francisco Casas.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-15 21:18:17 +02: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
cea9f19bd4 vkd3d-shader/d3d-asm: Always use '.' as decimal separator when printing doubles.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:31:33 +01:00
Henri Verbeet
aef9e9ea62 vkd3d-shader/d3d-asm: Always use '.' as decimal separator when printing floats.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:31:33 +01:00
Henri Verbeet
4728cf1286 include: Introduce a common macro for defining tags.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:31:33 +01:00
Henri Verbeet
ab45f0cafd vkd3d-shader: Explicitly handle VKD3D_DATA_MIXED in vkd3d_component_type_from_data_type().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-28 22:23:18 +01:00
Henri Verbeet
f5c4c06090 vkd3d-shader/hlsl: Respect the requested target type.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-28 22:23:13 +01:00