Commit Graph

3393 Commits

Author SHA1 Message Date
Zebediah Figura
852eefc01d vkd3d-shader/ir: Synthesize HS inputs with the register index and write mask of the signature element.
This pass was written as if to output normalized I/O, but it runs before the I/O
normalization pass.

Fixes: 98b5e2c6e0
2023-11-07 22:26:53 +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
Zebediah Figura
3ff22ac5af vkd3d-shader/spirv: Use the array sizes for shader phase builtins as well. 2023-11-07 22:26:47 +01:00
Zebediah Figura
f0a6c7de1d vkd3d-shader/hlsl: Record partial allocations in allocate_range(). 2023-11-07 22:26:11 +01:00
Zebediah Figura
c683fc9402 vkd3d-shader/hlsl: Check that a partial register's mask is also available in is_range_available(). 2023-11-07 22:26:10 +01:00
Giovanni Mascellani
7d49f9637a vkd3d-shader/ir: Check that SWITCH blocks are correctly nested. 2023-11-07 22:26:05 +01:00
Giovanni Mascellani
93632fb407 vkd3d-shader/ir: Check that REP blocks are correctly nested. 2023-11-07 22:26:04 +01:00
Giovanni Mascellani
92c36615ed vkd3d-shader/ir: Check that LOOP blocks are correctly nested. 2023-11-07 22:26:03 +01:00
Giovanni Mascellani
2f7d52dba4 vkd3d-shader/ir: Check that IF blocks are correctly nested. 2023-11-07 22:26:01 +01:00
Giovanni Mascellani
0a7e200f89 vkd3d-shader/ir: Do not enfore DCL_TEMPS count for hull shaders.
Hull shaders have a different temps count for each phase, and the
parser only reports the count for the patch constant phase.
In order to properly check for temps count on hull shaders, we first
need to decode its phases.
2023-11-07 22:26:00 +01:00
Giovanni Mascellani
ca3f594ae3 vkd3d-shader/ir: Emit an ERR() on validation errors. 2023-11-07 22:25:58 +01:00
Francisco Casas
0ef25ad137 vkd3d-shader/tpf: Support relative addressing for indexable temps in SM4.
For relative addressing, the vkd3d_shader_registers must point to
another vkd3d_shader_src_param. For now, use the sm4_instruction to save
them, since the only purpose of this struct is to be used as paramter
for write_sm4_instruction.
2023-11-07 22:25:49 +01:00
Francisco Casas
281796c526 vkd3d-shader/tpf: Move sm4_register_from_node() up. 2023-11-07 22:25:48 +01:00
Francisco Casas
e10d41d799 vkd3d-shader/tpf: Support writing relative addressing indexes. 2023-11-07 22:25:47 +01:00
Francisco Casas
617a20bffc vkd3d-shader/tpf: Write register index addressing. 2023-11-07 22:25:45 +01:00
Francisco Casas
043526a9f7 vkd3d-shader/tpf: Encode dst and src registers using the same function.
This function will also be required to encode rel_addr registers.
2023-11-07 22:25:44 +01:00
Henri Verbeet
a03e78bf62 vkd3d: Compile the UAV clear shaders at runtime. 2023-11-06 23:09:49 +01:00
Henri Verbeet
aa5380f32a vkd3d-shader/tpf: Do not write RDEF constant buffer entries for HLSL_CLASS_OBJECT variables.
RWBuffer objects would trigger a vkd3d_unreachable() in sm4_base_type().
It would be easy enough to add the required case there, but (manual,
unfortunately) tests show that we aren't supposed to write constant
buffer entries for objects in the first place, as you'd expect.

This particular path ends up being exercised by vkd3d's internal UAV
clear shaders, but unfortunately it looks like our RDEF data may have
more issues; the ability to write tests for it would seem helpful.
2023-11-06 23:09:47 +01:00
Zebediah Figura
a9f33e8657 vkd3d-shader/hlsl: Consistently use HLSL allocation functions. 2023-11-06 23:09:22 +01:00
Zebediah Figura
b9c164c1c4 vkd3d-shader/hlsl: Sort keywords.
Done with `LC_ALL=C sort -f`.
2023-11-06 23:09:20 +01:00
Zebediah Figura
7632365e60 vkd3d-shader/hlsl: Remove C++ comment lexing.
This is already handled by the preprocessor.
2023-11-06 23:09:19 +01:00
Zebediah Figura
4cfc7d44ab vkd3d-shader/hlsl: Remove some tokens from the lexer.
None of these currently have any meaning, and none of these can currently be
parsed as distinct tokens either (i.e. they will generate a syntax error
anyway).
2023-11-06 23:09:18 +01:00
Francisco Casas
98b5eb474a vkd3d-shader/tpf: Don't pass 0x4 as mask for vec4 constant src registers.
Co-authored-by: Evan Tang <etang@codeweavers.com>

Evan Tang reported that new fixmes appeared on the shader_runner when
running some of his tests after
f50d0ae2cb.

    vkd3d:652593:fixme:shader_sm4_read_src_param Unhandled mask 0x4.

The change to blame seems to be this added line in
sm4_src_from_constant_value().

    +    src->swizzle = VKD3D_SHADER_NO_SWIZZLE;

On tpf binaries the last 12 bits of each src register in an instruction
specify the swizzle, and there are 5 possible combinations:

    Dimension NONE
    -------- 00

    Dimension SCALAR
    -------- 01

    Dimension VEC4, with a 4 bit writemask:
    ---- xxxx 00 01

    Dimension VEC4, with an 8 bit swizzle:
    xx xx xx xx 01 01

    Dimension VEC4, with a 2bit scalar dimension number:
    ------ xx 10 01

So far, we have only seen src registers use 4 bit writemasks in a
single case: for vec4 constants, and it is always zero.

So we expect this:

    ---- 0000 00 01

Now, I probably wanted to initialize src->swizzle to zero when writing
constants, but VKD3D_SHADER_NO_SWIZZLE is not zero, it is actually the
default swizzle:

    11 10 01 00

And the last 4 bits (0x4) get written in the mask part, which causes
the reader to complain.
2023-11-06 23:09:10 +01:00
Conor McCarthy
749df8dec2 vkd3d-shader/dxil: Implement the DXIL BINOP instruction. 2023-11-06 23:09:03 +01:00
Conor McCarthy
3e0638148a vkd3d-shader/spirv: Support VKD3D_DATA_UINT in spirv_compiler_emit_neg().
The DXIL parser uses unsigned types even if the source code uses signed,
so unsigned values may be negated.
2023-11-06 23:09:02 +01:00
Conor McCarthy
4905d047bd vkd3d-shader/spirv: Handle the UMUL instruction. 2023-11-06 23:09:01 +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
Giovanni Mascellani
0d4aebd2e7 vkd3d-shader: Explicitly cast vkd3d_shader_global_flags to uint64_t.
On macOS vkd3d_shader_global_flags has underlying type unsigned long,
while uint64_t is defined as unsigned long long. This difference
causes a few warnings to be raised.
2023-11-06 23:08:37 +01:00
Nikolay Sivov
31346e2cba vkd3d-shader/tpf: Fix used temp registers accounting for dcl_temps.
Otherwise we always output "dcl_temps 1" even when no temp registers were used.
2023-11-06 23:08:10 +01:00
Zebediah Figura
f05be8ff12 vkd3d-shader/spirv: No longer handle builtin array size mismatch in spirv_compiler_emit_input().
This is taken care of by prior I/O lowering. We no longer need to deal with this here.
2023-11-06 23:07:59 +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
Zebediah Figura
8b42f523f2 vkd3d-shader/ir: Pass a vkd3d_shader_parser to instruction_array_normalise_io_registers(). 2023-11-06 23:07:54 +01:00
Conor McCarthy
7419f4e31d vkd3d-shader/dxil: Allow empty struct types. 2023-11-02 18:23:12 +01:00
Nikolay Sivov
dbcc4c4e40 vkd3d-shader/hlsl: Parse empty technique declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:07 +01:00
Nikolay Sivov
53b0101a53 vkd3d-shader/hlsl: Use case-insensitive match for the "technique" keyword.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:06 +01:00
Nikolay Sivov
ea8ff5394c vkd3d-shader/hlsl: Add a keyword for fx_5_0 techniques.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:05 +01:00
Conor McCarthy
7ca6a5452a vkd3d-shader/dxil: Always apply the signature element start column to used_mask.
The used_mask value loaded from an additional tag/value pair is relative
to the start column.
2023-11-02 18:22:59 +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
f3c1a15a6f vkd3d-shader/dxil: Use vsir_register_init() to initialize registers. 2023-11-02 18:22:35 +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
Nikolay Sivov
ecdc3f39d4 vkd3d-shader: Accept 'loop' attribute, on loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-01 21:47:49 +01:00
Nikolay Sivov
26784672d8 vkd3d-shader: Check loop [unroll] attribute for conflict with other attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-01 21:47:49 +01:00
Conor McCarthy
589670180a vkd3d-shader/dxil: Implement the DXIL EXTRACTVAL instruction. 2023-11-01 21:47:34 +01:00
Conor McCarthy
e899b67bbf vkd3d-shader/spirv: Support scalar swizzle of vector SSA registers. 2023-11-01 21:47:33 +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
Conor McCarthy
f57d65361a vkd3d-shader/dxil: Replace register_address_init() with register_index_address_init().
Makes it much clearer which register index is being written.
2023-11-01 21:47:29 +01:00
Zebediah Figura
a66acea1b5 vkd3d-shader/spirv: Always use the sysval from the signature. 2023-10-31 21:59:40 +01:00
Zebediah Figura
eef62b95c1 vkd3d-shader/spirv: Use the interpolation mode from the signature. 2023-10-31 21:59:39 +01:00
Zebediah Figura
15b69721de vkd3d-shader/tpf: Set the interpolation mode for signature elements. 2023-10-31 21:59:38 +01:00
Zebediah Figura
6b7834d635 vkd3d-shader/d3dbc: Set the interpolation mode for signature elements. 2023-10-31 21:59:36 +01:00
Zebediah Figura
a668f1ce1c vkd3d-shader: Handle a NULL descriptor info in vkd3d_shader_scan_add_descriptor(). 2023-10-31 21:59:33 +01:00
Francisco Casas
eef2163375 vkd3d-shader/tpf: Declare indexable temps.
If var->indexable, then the variable is given a unique register number,
regardless of its lifetime.
2023-10-31 21:59:22 +01:00
Francisco Casas
83c313ecc6 vkd3d-shader/hlsl: Mark vars that require non-constant dereferences. 2023-10-31 21:59:21 +01:00
Francisco Casas
313df300ad vkd3d-shader/hlsl: Rename hlsl_deref.offset to hlsl_deref.rel_offset.
This field is now analogous to vkd3d_shader_register_index.rel_addr.

Also, it makes sense to rename it now because all the constant part of
the offset is now handled to hlsl_deref.const_offset. Consequently, it
may also be NULL now.
2023-10-31 21:59:19 +01:00
Francisco Casas
74767beaf6 vkd3d-shader/hlsl: Absorb hlsl_ir_constant deref offsets into const_offset. 2023-10-31 21:59:18 +01:00
Francisco Casas
1520f327e5 vkd3d-shader/hlsl: Express deref->offset in whole registers.
This is required to use SM4 relative addressing, because it is limited
to whole-register granularity.
2023-10-31 21:59:16 +01:00
Francisco Casas
61a17643a2 vkd3d-shader/hlsl: Split deref-offset into a node and a constant uint.
This uint will be used for the following:

- Since SM4's relative addressing (the capability of passing a register
  as an index to another register) only has whole-register granularity,
  we will need to make the offset node express the offset in
  whole-registers and specify the register component in this uint,
  otherwise we would have to add additional / and % operations in the
  output binary.

- If, after we apply constant folding and copy propagation, we determine
  that the offset is a single constant node, we can store all the offset
  in this uint constant, and remove the offset src.

  This allows DCE to remove a good bunch of the nodes previously required
  only for the offset constants, which makes the output more liteweight
  and readable, and simplifies the implementation of relative addressing
  when writing tpf in the following patches.

In dump_deref(), we use "c" to indicate components instead of whole
registers. Since now both the offset node and the offset uint are in
components a lowered deref would look like:

    var[@42c + 2c]

But, once we express the offset node in whole registers we will remove
the "c" from the node part:

    var[@22 + 3c]
2023-10-31 21:59:14 +01:00
Francisco Casas
81be47c00b vkd3d-shader/hlsl: Introduce hlsl_deref_is_lowered() helper.
Some functions work with dereferences and need to know if they are
lowered yet.

This can be known checking if deref->offset.node is NULL or
deref->data_type is NULL. I am using the latter since it keeps working
even after the following patches that split deref->offset into
constant and variable parts.
2023-10-31 21:59:12 +01:00
Francisco Casas
e93568f290 vkd3d-shader/hlsl: Clean-up instruction block for offset node creation. 2023-10-31 21:59:11 +01:00
Nikolay Sivov
bc2a4ee66a vkd3d-shader/tpf: Write out 'switch' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:05 +01:00
Nikolay Sivov
68c14079a6 vkd3d-shader/hlsl: Add a pass to normalize switch cases blocks.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:04 +01:00
Nikolay Sivov
c84d4e3571 vkd3d-shader/hlsl: Add a pass to remove unreachable code.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:03 +01:00
Nikolay Sivov
a4fa323e6c vkd3d-shader/hlsl: Add copy propagation logic for switches.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:02 +01:00
Nikolay Sivov
72623031a2 vkd3d-shader/hlsl: Validate break/continue context.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:01 +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
Nikolay Sivov
ec8dfa467f vkd3d-shader/hlsl: Add initial support for parsing 'switch' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:58:57 +01:00
Henri Verbeet
f75bdd6e21 vkd3d-utils: Implement D3DStripShader(). 2023-10-19 23:07:50 +02:00
Conor McCarthy
b7b128595e vkd3d-shader/dxil: Read CBV descriptors. 2023-10-19 23:07:45 +02:00
Conor McCarthy
1e5f91b371 vkd3d-shader: Emit IR CBV declaration sizes in bytes.
DXIL declares CBV sizes in bytes and they are not aligned to 16 bytes.
2023-10-19 23:07:43 +02:00
Conor McCarthy
f7525bf0c6 vkd3d-shader/dxil: Validate the descriptor list metadata nodes. 2023-10-19 23:07:42 +02:00
Conor McCarthy
9b64d04ed3 vkd3d-shader/spirv: Align constant buffer sizes to 16 bytes.
DXIL constant buffer sizes are not aligned to 16 bytes.
2023-10-19 23:07:40 +02:00
Henri Verbeet
96556a8834 vkd3d-shader/hlsl: Add support for RWTexture2DArray. 2023-10-19 23:07:31 +02:00
Henri Verbeet
2c71c18879 vkd3d-shader/hlsl: Add support for RWTexture1DArray. 2023-10-19 23:07:30 +02:00
Nikolay Sivov
e242b46922 vkd3d-shader/tpf: Convert some of the semantic names to system values names when in compatibility mode.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-19 23:03:23 +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
9ce98f9be5 vkd3d-utils: Implement D3DGetOutputSignatureBlob(). 2023-10-18 20:58:24 +02:00
Henri Verbeet
9d9f762ede vkd3d-utils: Implement D3DGetInputSignatureBlob(). 2023-10-18 20:58:24 +02:00
Henri Verbeet
be8efb9c9c vkd3d-utils: Implement D3DGetInputAndOutputSignatureBlob(). 2023-10-18 20:58:24 +02:00
Henri Verbeet
247eaa6b7d vkd3d-utils: Implement D3DGetDebugInfo(). 2023-10-18 20:58:24 +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
Henri Verbeet
4e8ba62481 vkd3d-shader/spirv: Initialise "symbol.descriptor_array" in spirv_compiler_emit_combined_sampler_declarations().
Besides simply avoiding carrying around some uninitialised data, we
check "symbol->descriptor_array" in spirv_compiler_prepare_image(), both
for separate resources and for combined resource/sampler symbols.
2023-10-17 22:18:44 +02:00
Conor McCarthy
85c165ff39 vkd3d-shader/dxil: Read DXIL compute shader thread group dimensions. 2023-10-17 22:18:26 +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
Henri Verbeet
47d4097efa vkd3d-utils: Check for a NULL 'blob' pointer in D3DCreateBlob(). 2023-10-16 22:36:58 +02:00
Conor McCarthy
e0d0a04b79 vkd3d-shader/dxil: Handle multi-row signature elements. 2023-10-16 22:36:38 +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
Francisco Casas
38a7309758 vkd3d-shader/d3dbc: Use D3DSIO_TEXKILL instead of VKD3D_SM1_OP_TEXKILL (clangd). 2023-10-12 23:27:24 +02:00
Francisco Casas
7960836551 vkd3d-shader/hlsl: Remove enum hlsl_error_level (clangd).
It is only used once for calling hlsl_note(), and it expects an enum
vkd3d_shader_log_level values instead.
2023-10-12 23:27:22 +02:00
Francisco Casas
432fa8fa8f vkd3d-shader/tpf: Avoid translations to D3DDECLUSAGE and back (clangd). 2023-10-12 23:27:19 +02:00
Francisco Casas
f0da419a8c vkd3d-shader: Remove unnecessary fallthroughs (clangd). 2023-10-12 23:27:19 +02:00
Conor McCarthy
6034f4a976 vkd3d-shader/dxil: Read DXIL metadata named nodes. 2023-10-12 18:23:33 +02:00
Conor McCarthy
4ac201788d vkd3d-shader/dxil: Read DXIL metadata kinds. 2023-10-12 18:23:32 +02:00
Conor McCarthy
cba3e18c45 vkd3d-shader/dxil: Read DXIL metadata values. 2023-10-12 18:23:31 +02:00
Conor McCarthy
5817fabc30 vkd3d-shader/dxil: Read DXIL metadata nodes. 2023-10-12 18:23:30 +02:00
Conor McCarthy
a62343f544 vkd3d-shader/dxil: Read DXIL metadata strings. 2023-10-12 18:23:29 +02:00
Conor McCarthy
05d516bb00 vkd3d-shader/dxil: Emit an error on allocation failure in dxil_record_to_string(). 2023-10-11 22:21:22 +02:00
Conor McCarthy
52dc6f252c vkd3d-shader/dxil: Read global constants in sm6_parser_globals_init().
These are needed for reading metadata.
2023-10-11 22:21:20 +02:00
Conor McCarthy
df4e1b7393 vkd3d-shader/dxil: Read immediate constant arrays. 2023-10-11 22:21:19 +02:00
Nikolay Sivov
9c6c7cb78f vkd3d: Add partial implementation for CreateCommittedResource1(). 2023-10-10 22:11:46 +02:00
Zebediah Figura
6a942581db vkd3d-shader/ir: Translate TEX instructions to SAMPLE. 2023-10-09 21:58:40 +02:00
Zebediah Figura
bd9eae6c22 vkd3d-shader: Scan combined sampler declarations.
This does not handle 1.x samplers yet.
2023-10-09 21:58:38 +02:00
Zebediah Figura
2bcd6ea893 vkd3d-shader: Introduce a separate register type for combined samplers. 2023-10-09 21:58:38 +02:00
Nikolay Sivov
3af629cf8c vkd3d-shader/tpf: Output interpolation modifiers for input declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:31 +02:00
Nikolay Sivov
8479ceedfc vkd3d-shader/hlsl: Propagate structure fields modifiers when copying shader inputs.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:29 +02:00
Nikolay Sivov
1930b51d97 vkd3d-shader/hlsl: Allow interpolation modifiers on structure fields.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:27 +02:00
Nikolay Sivov
de860c3cbf vkd3d-shader/hlsl: Parse 'centroid' and 'noperspective' modifiers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:24 +02:00
Nikolay Sivov
c5414fa92f vkd3d-shader/tpf: Write 'continue' instruction.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:17 +02:00
Nikolay Sivov
e4b423d6b5 vkd3d-shader/hlsl: Handle 'continue' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:14 +02:00
Nikolay Sivov
0e5749e78e vkd3d-shader/hlsl: Allow 'break' instructions in loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:12 +02:00
Nikolay Sivov
6ba75fd92f vkd3d: Add partial implementation for CreateHeap1().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:07 +02:00
Conor McCarthy
75c2af3640 vkd3d-shader/spirv: When declaring a CBV initialise the register with the register index range.
The declaration instruction register contains id, range first, and range
last. The backend includes range first in the variable name. After commit
e8b3561252 it was always zero, and since commit 67f0196c33 it is
UINT_MAX, so constant buffers are named, e.g., "%cb0_4294967295".
2023-10-09 21:58:01 +02:00
Zebediah Figura
a4c5f3a798 vkd3d-shader/spirv: Add a debug name for the push constant buffer. 2023-10-09 21:57:53 +02:00
Henri Verbeet
98d158d004 vkd3d-shader/tpf: Get rid of the output map.
Map output registers in the backend instead, as needed.
2023-10-09 21:57:46 +02:00
Henri Verbeet
31ce7c3a38 vkd3d-shader/hlsl: Get rid of the vkd3d_sm4_* forward declarations in hlsl.h.
These are no longer needed outside of tpf.c.
2023-10-09 21:57:38 +02:00
Francisco Casas
014960b64b vkd3d-shader/tpf: Use lookup table for opcode_info_from_sm4().
Makes get_opcode_info() and thus, tpf reading a little faster.
2023-10-05 16:16:27 +02:00
Francisco Casas
88b644a11d vkd3d-shader/tpf: Don't store sm4 instruction extra bits in the opcode.
Adding extra bits to instr->opcode doesn't seem correct, given that it
is an enum.

For instance, get_opcode_info() would return NULL if additional bits are
added to instr->opcode. This is not a problem now because that function
is called when reading and not writing.
2023-10-05 16:16:24 +02:00
Francisco Casas
0a5fa80f02 vkd3d-shader/tpf: Apply mask to swizzle when swizzle type is scalar.
In native's output, for scalar swizzles only the first component of the
swizzle is written, the others are left as zero.
2023-10-05 16:16:21 +02:00
Francisco Casas
f06169afc5 vkd3d-shader/tpf: Don't calculate instruction size in advance.
Co-authored-by: Henri Verbeet <hverbeet@codeweavers.com>
2023-10-05 16:16:19 +02:00
Nikolay Sivov
7c378cc6f9 vkd3d-shader/hlsl: Remove conditional branching when condition is a compile time constant.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:16:09 +02:00
Nikolay Sivov
f3389789b2 vkd3d-shader: Add constant folding for 'rsq'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:16:03 +02:00
Nikolay Sivov
a58c659b10 vkd3d-shader/hlsl: Add constant folding for binary complement operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:56 +02:00
Nikolay Sivov
8ebccad3c9 vkd3d-shader/hlsl: Add constant folding for rshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:54 +02:00
Nikolay Sivov
6e74819eb7 vkd3d-shader/hlsl: Add constant folding for lshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:52 +02:00
Nikolay Sivov
8c9d65d6b3 vkd3d-shader/hlsl: Add constant folding for logical 'not', for bools.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:50 +02:00
Francisco Casas
4ab6572be7 vkd3d-shader/hlsl: Replace hlsl_type_get_regset() uses with hlsl_deref_get_regset(). 2023-10-05 16:15:37 +02:00
Francisco Casas
a214b7374b vkd3d-shader/hlsl: Avoid hlsl_type_get_regset() in allocate_register_reservations(). 2023-10-05 16:15:34 +02:00
Francisco Casas
cd0e3786c3 vkd3d-shader/hlsl: Avoid hlsl_type_get_regset() in sm4_get_extern_resources(). 2023-10-05 16:15:28 +02:00
Francisco Casas
dfce1e7f4a vkd3d-shader/hlsl: Make regset an output argument in hlsl_type_get_component_offset().
Components only span across a single regset, so instead of expecting the
regset as input for the offset, hlsl_type_get_component_offset() can
actually retrieve it.
2023-10-05 16:15:26 +02:00
Nikolay Sivov
b5c0c9c22f vkd3d-shader/hlsl: Add fwidth() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:10 +02:00
Andrey Gusev
8087cc01f7 vkd3d: Add ID3D12GraphicsCommandList5 interface stub. 2023-10-05 16:15:02 +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
Francisco Casas
c92772657f vkd3d-shader/tpf: Replace sm4_src_register with vkd3d_shader_src_param. 2023-10-03 21:27:48 +02:00
Francisco Casas
13f62e60e1 vkd3d-shader/tpf: Remove sm4_src_register.swizzle_type. 2023-10-03 21:27:47 +02:00
Francisco Casas
32f03468fc vkd3d-shader/tpf: Make sm4_src_register.mod a vkd3d_shader_src_modifier enum. 2023-10-03 21:27:45 +02:00
Andrey Gusev
679203f717 vkd3d: Add ID3D12GraphicsCommandList4 interface stub. 2023-10-03 21:27:34 +02:00
Giovanni Mascellani
627cf50320 vkd3d: Use CONST_VTABLE. 2023-10-02 22:25:14 +02:00
Andrey Gusev
1006e8cbd4 vkd3d: Add ID3D12Device5 interface stub. 2023-09-28 23:13:29 +02:00
Francisco Casas
f50d0ae2cb vkd3d-shader/tpf: Store vkd3d-shader swizzles in sm4_src_register.swizzle. 2023-09-28 23:13:16 +02:00
Francisco Casas
ef9ec28eb0 vkd3d-shader/tpf: Replace sm4_dst_register with vkd3d_shader_dst_param. 2023-09-28 23:13:14 +02:00
Francisco Casas
d41d8f8771 vkd3d-shader/tpf: Rename sm4_dst_register.writemask to write_mask. 2023-09-28 23:13:12 +02:00
Andrey Gusev
acd3ed97dc vkd3d: Add ID3D12Device4 interface stub. 2023-09-27 22:34:52 +02:00
Francisco Casas
123e399b89 vkd3d-shader/d3d-asm: Don't print offset for DEPTHOUT registers.
This register is unique and thus is not accompanied with an offset in
the native disassembler output.
2023-09-27 22:34:48 +02:00
Francisco Casas
ef1567c17b vkd3d-shader/d3d-asm: Use vkd3d_shader_register.dimension to know when to dump writemask.
This change ensures that we don't dump the writemask for registers that
have a scalar dimension.

For instance, for this shader:

    float r;

    float4 main(out float d : DEPTH) : sv_target
    {
        d = r;
        return 0;
    }

we now correctly dump

    dcl_output oDepth

instead of

    dcl_output oDepth.x
2023-09-27 22:34:47 +02:00
Francisco Casas
a358722f71 vkd3d-shader/d3d-asm: Use vkd3d_shader_register.dimension to know when to dump swizzle.
The assumption that sampler registers never have a swizzle is not
totally correct.

For instance, for the following shader:

    Texture2D tex;
    sampler sam;

    float4 main() : sv_target
    {
        return tex.GatherGreen(sam, float2(0, 0));
    }

the gather instruction is being disassembled as

  gather4_indexable(texture2d) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0

instead of

  gather4_indexable(texture2d)(float,float,float,float) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0.y

(notice the missing swizzle in the last parameter s0).

This is because the Gather instructions give the sampler register a vec4
dimension (and scalar swizzle type) to indicate the channel for the
gather operation.

The solution is using the new vkd3d_shader_register.dimension instead of
checking the swizzle type.
2023-09-27 22:34:46 +02:00
Francisco Casas
8e0fe29bfc vkd3d-shader/tpf: Replace sm4_register with vkd3d_shader_register. 2023-09-27 22:34:31 +02:00
Francisco Casas
10bbc7eda5 vkd3d-shader/tpf: Move sm4_register.mod to sm4_src_register. 2023-09-27 22:34:30 +02:00
Francisco Casas
8124ba3a54 vkd3d-shader/tpf: Put sm4_register.immconst_uint inside a union. 2023-09-27 22:34:28 +02:00
Francisco Casas
0c8b74cb39 vkd3d-shader/tpf: Turn sm4_register.dim into an enum vkd3d_shader_dimension. 2023-09-27 22:34:26 +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
Conor McCarthy
b30b95e824 vkd3d-shader/dxil: Do not access null code blocks on failure. 2023-09-26 22:07:50 +02:00
Andrey Gusev
56cd609308 vkd3d: Add ID3D12Device3 interface stub. 2023-09-26 22:07:45 +02:00
Giovanni Mascellani
83ddfb9e8d vkd3d: Expose the image view usage to Vulkan.
This prevents a failure with MoltenVK, which is not able to
create 2D-array view for any usage other than color attachment.
2023-09-26 22:07:41 +02:00
Francisco Casas
74d79c7e45 vkd3d-shader/d3dbc: Initialize register dimension for all register types. 2023-09-26 22:07:06 +02:00
Francisco Casas
33f47c5ae9 vkd3d-shader/tpf: Parse register dimension for all register types. 2023-09-26 22:07:04 +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
dc35125d73 vkd3d-shader/tpf: Use vsir_register_init() in shader_sm1_parse_dst_param(). 2023-09-26 22:07:03 +02:00
Francisco Casas
51aa5a45e9 vkd3d-shader/tpf: Use vsir_register_init() in shader_sm1_parse_src_param(). 2023-09-26 22:07:02 +02:00
Francisco Casas
c1d9e776e2 vkd3d-shader/tpf: Use vsir_register_init() in shader_sm4_read_param(). 2023-09-26 22:07:01 +02:00
Francisco Casas
6f5cb219f4 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_default_control_point_phase(). 2023-09-26 22:07:00 +02:00
Francisco Casas
81802e27d0 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_resource_declaration(). 2023-09-26 22:06:59 +02:00
Francisco Casas
314c6e4808 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_sampler_declaration(). 2023-09-26 22:06:58 +02:00
Francisco Casas
b2f262467f vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_dcl_immediate_constant_buffer(). 2023-09-26 22:06:56 +02:00
Francisco Casas
67f0196c33 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_cbv_declaration(). 2023-09-26 22:06:55 +02:00
Francisco Casas
04529bc0b7 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_dcl_indexable_temp(). 2023-09-26 22:06:54 +02:00
Francisco Casas
e174f6b413 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_emit_hull_shader_builtins(). 2023-09-26 22:06:53 +02:00
Francisco Casas
89d7bd7a81 vkd3d-shader/spirv: Use vsir_register_init() in spirv_compiler_get_invocation_id(). 2023-09-26 22:06:52 +02:00
Francisco Casas
5d6899888d vkd3d-shader: Rename shader_register_init() to vsir_register_init(). 2023-09-26 22:06:50 +02:00
Giovanni Mascellani
d9c8b49ea0 vkd3d-shader/ir: Remove dead code during normalisation.
The SPIR-V backend generates invalid SPIR-V code when
VSIR has dead code (except for NOPs).
2023-09-25 22:07:27 +02:00
Zebediah Figura
fcda20a8c3 vkd3d-shader/hlsl: Use lower_ir() for lower_sqrt(). 2023-09-25 22:07:23 +02:00
Zebediah Figura
496a3a2093 vkd3d-shader/hlsl: Use lower_ir() for lower_division(). 2023-09-25 22:07:22 +02:00
Zebediah Figura
ecd781e809 vkd3d-shader/hlsl: Use lower_ir() for lower_int_abs(). 2023-09-25 22:07:21 +02:00
Zebediah Figura
7944ee9bed vkd3d-shader/hlsl: Use lower_ir() for lower_casts_to_bool(). 2023-09-25 22:07:20 +02:00
Zebediah Figura
65bf6e997c vkd3d-shader/hlsl: Use lower_ir() for more passes. 2023-09-25 22:07:18 +02:00
Petrichor Park
976fd67f51 vkd3d-shader/hlsl: Implement intrinsic tan.
This commit also extends the trigonometry tests a little bit to make
sure that tan works right.
2023-09-25 22:07:13 +02:00
Conor McCarthy
6ec5e5bf54 vkd3d-shader/dxil: Implement DX instruction LoadInput. 2023-09-25 22:07:09 +02:00
Conor McCarthy
644a06dcca vkd3d-shader/dxil: Declare shader inputs. 2023-09-25 22:07:08 +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
Conor McCarthy
575135a9ce vkd3d-shader/spirv: Build undefined values once. 2023-09-25 22:07:05 +02:00
Conor McCarthy
3249723972 vkd3d-shader/spirv: Introduce a Static Single Assignment register type. 2023-09-25 22:07:04 +02:00
Conor McCarthy
a67a85989f vkd3d-shader/d3d-asm: Trace undefined registers. 2023-09-25 22:07:02 +02:00
Conor McCarthy
b765f3c770 vkd3d-shader: Make the paramater allocator slab size at least MAX_REG_OUTPUT.
The allocator is used for DXIL input/output parameter arrays.
2023-09-25 22:07:01 +02:00
Zebediah Figura
257a351f37 vkd3d-shader/spirv: Flush NaN to zero in ftoi. 2023-09-25 22:06:45 +02:00
Zebediah Figura
a5b6162d25 vkd3d-shader/spirv: Clamp ftoi upper bound to INT_MAX. 2023-09-25 22:06:44 +02:00
Zebediah Figura
9dee15da5b vkd3d-shader/spirv: Clamp ftoi lower bound to INT_MIN. 2023-09-25 22:06:43 +02:00
Zebediah Figura
cc893a3368 vkd3d-shader/spirv: Clamp ftou upper bound to UINT_MAX. 2023-09-25 22:06:41 +02:00
Zebediah Figura
491146fa94 vkd3d-shader/spirv: Clamp ftou lower bound to zero. 2023-09-25 22:06:39 +02:00
Giovanni Mascellani
b9fa8cfaa6 vkd3d: Set the image aspect when clearing UAVs.
This fixes a number of tests on Mesa on Intel.
2023-09-22 11:06:55 +02:00
Nikolay Sivov
485cbe8cb7 vkd3d-shader/hlsl: Add constant folding for 'sat'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:35 +02:00
Nikolay Sivov
89c99cccce vkd3d-shader/hlsl: Add constant folding for 'exp2'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:34 +02:00
Nikolay Sivov
c16c5caad8 vkd3d-shader/hlsl: Add constant folding for 'fract'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:33 +02:00
Giovanni Mascellani
c69562128a vkd3d-shader/hlsl: Correctly fold casts from double. 2023-09-22 11:06:29 +02:00
Giovanni Mascellani
49bbd98a04 vkd3d-shader/hlsl: Correctly fold casts from float.
I.e., without invoking undefined behavior in the compiler. The rules
are desumed from the the MSDN documentation for ftoi and ftou.
2023-09-22 11:06:28 +02:00
Nikolay Sivov
d9c984c11a vkd3d-shader/hlsl: Add constant folding for the ternary operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:23 +02:00
Nikolay Sivov
6d1ba83856 vkd3d-shader/hlsl: Use conditional moves for arithmetic operators instead of branching.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:22 +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
531c41306d vkd3d-shader/dxil: Destroy the SM6 parser on parsing errors. 2023-09-22 11:06:11 +02:00
Giovanni Mascellani
78220ed07e vkd3d-shader/tpf: Destroy the SM4 parser on parsing errors. 2023-09-22 11:06:10 +02:00
Giovanni Mascellani
a2fb9588c7 vkd3d-shader/d3dbc: Destroy the SM1 parser on parsing errors. 2023-09-22 11:06:09 +02:00
Giovanni Mascellani
d1cb6b41b1 vkd3d-shader/d3dbc: Skip DCL semantic tokens properly. 2023-09-22 11:06:08 +02:00
Giovanni Mascellani
9487cc6ab5 vkd3d-shader/ir: Simplify the control flow in shader_instruction_normalise_io_params(). 2023-09-22 11:06:06 +02:00
Giovanni Mascellani
5220125c9f vkd3d-shader/ir: Fully reinitialize an instruction when making it a NOP. 2023-09-22 11:06:05 +02:00
Giovanni Mascellani
05af25eecb vkd3d-shader: Rename shader_instruction_init(). 2023-09-22 11:06:05 +02:00
Andrey Gusev
78ff0f3df4 vkd3d: Add ID3D12Device2 interface. 2023-09-22 11:05:59 +02:00
Henri Verbeet
90d4529f27 Release 1.9. 2023-09-21 19:16:32 +02:00
Zebediah Figura
9417c7cfb7 vkd3d-shader/d3dbc: Translate sm1 fragment outputs to system values. 2023-09-21 19:16:31 +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
fd120d8f2d vkd3d-shader: Rename vkd3d_shader_next_stage_info to vkd3d_shader_varying_map_info.
It was originally intended that this structure could hold other information
about the next stage which compilation might depend on. For example, compilation
to GLSL needs to know the type of the next shader in some circumstances.

That was never actualized, and since the API is fixed at this point for 1.9, it
makes the most sense to rename the structure to match its actual scope.

The documentation was written and arranged to imply that the structure would
hold other information about the next shader than the varying map; this is
changed accordingly as well.
2023-09-21 19:16:27 +02:00
Henri Verbeet
f796d8668e vkd3d-shader: Export vkd3d_shader_build_varying_map. 2023-09-19 21:30:35 +02:00
Henri Verbeet
da89da2bf3 vkd3d-shader: Hide support for DXIL sources.
Unfortunately this is not sufficiently ready to release.
2023-09-18 21:04:19 +02:00
Giovanni Mascellani
ee28861837 vkd3d-shader/hlsl: Document some possibly obscure HLSL opcodes. 2023-09-14 20:28:55 +02:00
Giovanni Mascellani
f251da574c vkd3d-shader/hlsl: Remove HLSL_OP3_LERP.
It is unused, and it's not clear whether it would be of any help to
have it.
2023-09-14 20:28:54 +02:00
Nikolay Sivov
45541dd9b2 vkd3d-shader/asm: Tweak TEXCOORD declaration name.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:16 +02:00
Nikolay Sivov
ee6c66eb1b vkd3d-shader/d3dbc: Disallow 1D sampler types when writing sampler declaration.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:14 +02:00
Nikolay Sivov
177ea3bcbd vkd3d-shader/hlsl: Produce 2D resource declarations and loads for tex1D().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:11 +02:00
Francisco Casas
39563aa5b3 vkd3d-shader/hlsl: Lower matrix swizzles. 2023-09-13 23:10:38 +02:00
Nikolay Sivov
fc2aaee224 vkd3d-shader: Use ternary operator in fmod() implementation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:26 +02:00
Nikolay Sivov
1002a6b357 vkd3d-shader/tpf: Use 'movc' to implement ternary operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:25 +02:00
Nikolay Sivov
c5d680d141 vkd3d-shader/hlsl: Add tex1D() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:06 +02:00
Conor McCarthy
3badab2086 vkd3d-shader: Handle size in bytes in spirv_compiler_emit_cbv_declaration().
The caller passes a byte size now.
2023-09-04 20:25:33 +02:00
Conor McCarthy
bad4c74002 vkd3d-shader: Match only UAV descriptors in vkd3d_shader_scan_add_uav_flag().
Fixes compilation failures in Cyberpunk 2077 due to missing UAV counter
flag.
2023-09-04 20:25:31 +02:00
Zebediah Figura
a597dc8755 vkd3d-shader/hlsl: Define lit() in HLSL. 2023-08-30 22:49:03 +02:00
Zebediah Figura
9ab77658f2 vkd3d-shader/hlsl: Define smoothstep() in HLSL. 2023-08-30 22:49:01 +02:00
Zebediah Figura
d396c4ce27 vkd3d-shader/hlsl: Store the internal name counter in struct hlsl_ctx.
This is minutely more efficient than using a global variable and atomic instructions.
2023-08-30 22:48:59 +02:00
Zebediah Figura
f22e52f358 vkd3d-shader/hlsl: Separate an add_user_call() helper. 2023-08-30 22:48:57 +02:00
Zebediah Figura
63e056512d vkd3d-shader/hlsl: Introduce an hlsl_sprintf_alloc() helper. 2023-08-30 22:48:55 +02:00
Conor McCarthy
d27b8eb2c0 vkd3d-shader/dxil: Implement DX instruction StoreOutput. 2023-08-30 22:48:52 +02:00
Conor McCarthy
bf49a1a95b vkd3d-shader/dxil: Declare shader outputs. 2023-08-30 22:48:50 +02:00
Conor McCarthy
e54f770669 vkd3d-shader/dxil: Implement the DXIL CALL instruction. 2023-08-30 22:48:48 +02:00
Conor McCarthy
720a087c28 vkd3d-shader/dxil: Replace the result type enum with a bool.
Changes to failure handling make the enum unnecessary.
2023-08-30 22:48:47 +02:00
Conor McCarthy
58d6e44501 vkd3d-shader/dxil: Validate the function block count. 2023-08-30 22:48:45 +02:00
Conor McCarthy
61a550017f vkd3d-shader/spirv: Handle signature element mask left shift in spirv_compiler_emit_output().
Element masks can have a left shift in DXIL, but these must start at
bit 0 in the register info. The SPIR-V declaration will either be a
builtin or have SpvDecorationComponent.
2023-08-30 22:48:43 +02:00