Commit Graph

4983 Commits

Author SHA1 Message Date
Giovanni Mascellani
bc9db34cdc vkd3d-shader/ir: Validate LABEL instructions. 2024-01-18 23:15:55 +01:00
Giovanni Mascellani
dd1b2feec0 vkd3d-shader/ir: Validate LABEL registers. 2024-01-18 23:15:54 +01:00
Giovanni Mascellani
17f4afc2b5 vkd3d-shader/ir: Validate that structured CF does not appear in block-based shaders. 2024-01-18 23:15:53 +01:00
Giovanni Mascellani
1d45b7a422 vkd3d-shader/spirv: Normalise the shader before allocating registers.
So registers are allocated after normalisation (which could require
additional registers).
2024-01-18 23:15:48 +01:00
Zebediah Figura
9ad48f16ea vkd3d-shader/hlsl: Forbid mismatched argument types in ternaries. 2024-01-18 23:15:44 +01:00
Zebediah Figura
275901557c vkd3d-shader/hlsl: Handle scalar values in ternaries. 2024-01-18 23:15:43 +01:00
Zebediah Figura
11112798c8 vkd3d-shader/hlsl: Handle scalar conditions in ternaries. 2024-01-18 23:15:42 +01:00
Zebediah Figura
2c8751478f vkd3d-shader/hlsl: Forbid objects in ternary conditions. 2024-01-18 23:15:41 +01:00
Giovanni Mascellani
38fdf24002 vkd3d-shader: Make relative address sources mutable too.
They were forgotten in 78d95889bd.

Fixes: 78d95889bd
2024-01-18 23:15:35 +01:00
Giovanni Mascellani
93100edb4b tests: Test a couple of degenerate switch instances. 2024-01-18 23:15:35 +01:00
Giovanni Mascellani
6cb7487fb0 tests: Add a test with non-trivial control flow. 2024-01-18 23:15:35 +01:00
Conor McCarthy
83851133c5 vkd3d-shader/ir: Set merged signature element interpolation mode only from used elements. 2024-01-18 23:15:27 +01:00
Conor McCarthy
759362b527 tests: Test an interpolated PS input where component x is unused.
FXC does not emit an interpolation mode for unused elements.
2024-01-18 23:15:26 +01:00
Conor McCarthy
b8280e4210 vkd3d-shader/ir: Revert "Do not merge signature elements which have different interpolation modes.".
This reverts commit b5c067b41a.

The commit causes regressions in other shaders because unused elements
do not have an interpolation mode.
2024-01-18 23:15:25 +01:00
Conor McCarthy
efe800f7f0 vkd3d-shader/dxil: Handle the DXIL SWITCH instruction. 2024-01-18 23:15:14 +01:00
Conor McCarthy
ba1ee27b4b vkd3d-shader/dxil: Handle the DXIL PHI instruction. 2024-01-18 23:15:12 +01:00
Conor McCarthy
8a5804eb43 vkd3d-shader/dxil: Handle the DXIL BR instruction conditional variant. 2024-01-18 23:15:10 +01:00
Conor McCarthy
c9493884ef vkd3d-shader/dxil: Handle the DXIL BR instruction unconditional variant. 2024-01-18 23:15:03 +01:00
Conor McCarthy
9e964fa0c7 vkd3d-shader/dxil: Introduce a code block terminator struct. 2024-01-18 23:15:01 +01:00
Giovanni Mascellani
866e5de95b ci: Prepare the macOS build environment in a dedicated CI job. 2024-01-18 23:13:05 +01:00
Giovanni Mascellani
847930d5e0 ci: Rename CI target build-image to image-linux. 2024-01-18 23:13:03 +01:00
Henri Verbeet
cd77b2a9be vkd3d-utils: Use debugstr_hresult() in D3DStripShader(). 2024-01-17 22:29:39 +01:00
Henri Verbeet
1b3aa005db vkd3d-utils: Use debugstr_hresult() in get_blob_part(). 2024-01-17 22:29:39 +01:00
Henri Verbeet
2476d6bd6c vkd3d-utils: Use debugstr_hresult() in D3DCreateBlob(). 2024-01-17 22:29:39 +01:00
Henri Verbeet
cd9610bbe0 include: Introduce a debug helper for HRESULTs. 2024-01-17 22:29:39 +01:00
Henri Verbeet
71decc927f vkd3d-common: Introduce vkd3d_atomic_increment_u64(). 2024-01-17 22:29:29 +01:00
Conor McCarthy
c40093474e vkd3d-shader/tpf: Validate sysvals in index range declarations. 2024-01-17 22:29:01 +01:00
Conor McCarthy
4c30b23821 vkd3d-shader: Make the control point count the outer dimension of I/O arrays.
The relative-addressed case in shader_register_normalise_arrayed_addressing()
leaves the control point id in idx[0], while for constant register
indices it is placed in idx[1]. The latter case could be fixed instead,
but placing the control point count in the outer dimension is more
logical.
2024-01-17 22:28:59 +01:00
Conor McCarthy
b8561d6fd2 tests: Test punned array access in patch constant functions.
The FXC optimiser sometimes converts a local array of input values into
direct array addressing of the inputs, which can result in a
dcl_indexrange instruction spanning input elements with different masks.
2024-01-17 22:28:58 +01:00
Conor McCarthy
418e8d8100 vkd3d-shader/ir: Expand index range write masks to cover all element masks.
For example, this occurred in a shader:

reg_idx write_mask
   0      xyz
   1      xyzw
   2      xyzw
   3      xyz

The dcl_indexrange instruction covered only xyz, so once merged, searching for
xyzw failed.

It is impossible to declare an input array where elements have different
component counts, but the optimiser can create this case. One way for
this to occur is to dynamically index input values via a local array
containing copies of the input values. The optimiser converts this to
dynamically indexed inputs.
2024-01-17 22:28:56 +01:00
Zebediah Figura
16962ac6f1 vkd3d-shader/hlsl: Allow non-numeric types in the ternary operator. 2024-01-17 22:28:51 +01:00
Zebediah Figura
46bd099341 vkd3d-shader/hlsl: Separate an add_ternary() helper. 2024-01-17 22:28:50 +01:00
Zebediah Figura
9ac210eb1e tests: Add many more tests for ternary expressions. 2024-01-17 22:28:50 +01:00
Zebediah Figura
a5549bae38 vkd3d-shader/hlsl: Do not try to lower ternaries of types other than scalar or vector. 2024-01-17 22:28:49 +01:00
Zebediah Figura
e0b1f2e273 vkd3d-shader/hlsl: Remove a redundant definition of the "float" type. 2024-01-17 22:28:47 +01:00
Conor McCarthy
559d9d4ee0 vkd3d-shader/ir: Include an initial label instruction in the first control flow block. 2024-01-17 22:28:41 +01:00
Conor McCarthy
d402804851 vkd3d-shader/spirv: Do not emit function code before the main prolog. 2024-01-17 22:28:40 +01:00
Conor McCarthy
b4b2b0d3ac vkd3d-shader/spirv: Declare indexable temps as Private unless function scope is specified. 2024-01-17 22:28:39 +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
Conor McCarthy
ffc65215ba vkd3d-shader/ir: Flatten SWITCH/CASE/DEFAULT/ENDSWITCH control flow instructions. 2024-01-17 22:28:36 +01:00
Conor McCarthy
dcb8527327 vkd3d-shader/ir: Flatten LOOP/BREAK/CONTINUE/ENDLOOP control flow instructions. 2024-01-17 22:28:35 +01:00
Conor McCarthy
e1dddc01b7 vkd3d-shader/ir: Flatten IF/ELSE/ENDIF control flow instructions. 2024-01-17 22:28:34 +01:00
Conor McCarthy
f3d464de0e vkd3d-shader/spirv: Handle RETP in spirv_compiler_handle_instruction(). 2024-01-17 22:28:33 +01:00
Conor McCarthy
bc1b5e7132 vkd3d-shader/spirv: Handle DISCARD and TEXKILL in spirv_compiler_handle_instruction(). 2024-01-17 22:28:31 +01:00
Conor McCarthy
db0d51675c vkd3d-shader/spirv: Emit descriptor offset loads in the function entry block.
Ensures they are loaded only once per function independent of the
control flow graph.
2024-01-17 22:28:29 +01:00
Henri Verbeet
68b898fcb6 vkd3d-shader/tpf: Store the "precise" mask as a uint32_t in shader_sm4_read_instruction(). 2024-01-15 19:58:22 +01:00
Henri Verbeet
ad2af68d2a vkd3d-shader/tpf: Store the "recognized_bits" mask as a uint32_t in shader_sm4_read_instruction_modifier(). 2024-01-15 19:58:21 +01:00
Henri Verbeet
b8903f5526 vkd3d-shader/tpf: Store the current token as a uint32_t in shader_sm4_read_dst_param(). 2024-01-15 19:58:20 +01:00
Henri Verbeet
fd854bc0c0 vkd3d-shader/tpf: Store the current token as a uint32_t in shader_sm4_read_src_param(). 2024-01-15 19:58:19 +01:00
Henri Verbeet
c5facd4e03 vkd3d-shader/tpf: Store the "addressing" token as a uint32_t in shader_sm4_read_param(). 2024-01-15 19:58:18 +01:00