Commit Graph

4579 Commits

Author SHA1 Message Date
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
bae6079047 include: Move D3D_BLOB_PART to a new header file.
According to a clang diagnostic, redefining a typedef is C11, and
we want to stick with C99.
2023-11-06 23:08:42 +01:00
Giovanni Mascellani
4e1f4cc428 ci: Make the MoltenVK logging less verbose. 2023-11-06 23:08:42 +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
Giovanni Mascellani
2955232656 ci: Allow the artifact copy to fail.
If the build fails some artifact files might not exist, and we
don't want the script to fail just because of that.
2023-11-06 23:08:32 +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
Nikolay Sivov
c588f33822 tests: Add some tests for using technique blocks when compiling for pixel/vertex profiles.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:04 +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
Nikolay Sivov
b8047fd650 tests: Add some tests for loop attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-01 21:47:49 +01:00
Giovanni Mascellani
c691ad8869 tests: Immediately transition buffers after creation in the shader runner.
The resource could be destructed before the command list left open
is executed; instead, we immediately perform the transition.
2023-11-01 21:47:44 +01:00
Giovanni Mascellani
46b7fccfd7 tests: Immediately transition textures after creation in the shader runner.
The resource could be destructed before the command list left open
is executed; instead, we immediately perform the transition.
2023-11-01 21:47:43 +01:00
Giovanni Mascellani
ca7fa0c015 tests: Immediately transition resources after readback in the shader runner.
The resource could be destructed before the command list left open
is executed; instead, we immediately perform the transition.
2023-11-01 21:47:41 +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
Nikolay Sivov
8e5c8c1725 tests: Add some tests for 'technique' token behaviour.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:45 +01:00
Nikolay Sivov
214d44fb11 tests: Add [effect] section support.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:45 +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