Giovanni Mascellani
1f536238a8
vkd3d-shader: Use 64 bit swizzles for 64 bit data types in VSIR.
...
The handling of write masks and swizzles for 64 bit data types is
currently irregular: write masks are always 64 bit, while swizzles
are usually 32 bit, except for SSA registers with are 64 bit.
With this change we always use 64 bit swizzles, in order to make
the situation less surprising and make it easier to convert
registers between SSA and TEMP.
64 bit swizzles are always required to have X in their last two
components.
2024-01-29 22:33:33 +01:00
Conor McCarthy
92f0b37133
vkd3d-shader/spirv: Support 64-bit source value for bitfield instructions.
2024-01-29 22:33:22 +01:00
Giovanni Mascellani
378109051c
vkd3d-shader/ir: Lower monolithic switches to selection ladders.
...
PHI nodes must be fixed up after this pass, because the block references
might have become broken. For simplicitly this is not handled yet.
The goal for this pass is to make the CFG structurizer simpler, because
only conditional and unconditional branches must be supported.
Eventually this limitation might be lifted if there is advantage in
doing so.
2024-01-29 22:33:15 +01:00
Giovanni Mascellani
b97edee03d
vkd3d-shader/spirv: Emit an error if merge information is missing.
...
Instead of crashing.
2024-01-29 22:33:14 +01:00
Conor McCarthy
f954724870
vkd3d-shader/spirv: Handle the TAN instruction in spirv_compiler_emit_ext_glsl_instruction().
2024-01-25 22:24:44 +01:00
Conor McCarthy
8ae69c745b
vkd3d-shader/spirv: Handle thread group UAV barriers.
2024-01-25 22:24:23 +01:00
Conor McCarthy
18e9148f58
vkd3d-shader/spirv: Include Uniform in the memory semantics for UAV barriers.
...
The UniformMemory semantic applies the constraints to Uniform storage
class memory, which matches how UAV variables are declared.
2024-01-25 22:24:22 +01:00
Conor McCarthy
adfbecef3c
vkd3d-shader/spirv: Handle globally coherent UAVs.
2024-01-25 22:24:20 +01:00
Conor McCarthy
54f6e6dd67
vkd3d-shader/spirv: Check for FEATURE_FLOAT64 when double precision use is flagged.
2024-01-24 22:38:09 +01:00
Conor McCarthy
e973271a40
vkd3d-shader/spirv: Handle the ISINF and ISNAN instructions in spirv_compiler_emit_alu_instruction().
2024-01-24 22:38:04 +01:00
Conor McCarthy
cd674d593e
vkd3d-shader/spirv: Implement the ISFINITE instruction.
2024-01-24 22:38:03 +01:00
Francisco Casas
b92f6c448a
vkd3d-shader/ir: Lower texkill instructions to discard_nz.
2024-01-24 22:37:41 +01:00
Henri Verbeet
bf628f0c74
vkd3d-shader/ir: Store block names in struct vsir_program.
2024-01-23 20:27:35 +01:00
Henri Verbeet
f3c7d2d05c
vkd3d-shader/ir: Store the block count in struct vsir_program.
2024-01-23 20:27:34 +01:00
Henri Verbeet
98c6e85b33
vkd3d-shader/ir: Store control point counts in struct vsir_program.
2024-01-23 20:27:32 +01:00
Conor McCarthy
e4660fe0e6
vkd3d-shader/spirv: Emit DISCARD as a function call.
2024-01-23 20:26:59 +01:00
Giovanni Mascellani
de9725b6ba
vkd3d-shader/ir: Remove DCL_TEMPS instructions.
...
We have to do work to keep it updated across passes and we never read it.
2024-01-23 20:26:38 +01:00
Giovanni Mascellani
45495f54f2
vkd3d-shader/spirv: Use capability ShaderViewportIndexLayerEXT for decoration ViewportIndex.
2024-01-22 22:19:11 +01:00
Giovanni Mascellani
6ac525d6c3
vkd3d-shader/spirv: Use capability ShaderViewportIndexLayerEXT for decoration Layer.
...
Capability Geometry allows to use the Layer builtin in geometry and pixel
shaders. For vertex and domain shaders ShaderLayer should be used, but it's only
available starting from SPIR-V 1.5. ShaderViewportIndexLayerEXT can be used
instead with extension SPV_EXT_shader_viewport_index_layer.
2024-01-22 22:19:09 +01:00
Henri Verbeet
adc02eada8
vkd3d-shader/ir: Store the temporary register count in struct vsir_program.
2024-01-22 22:18:53 +01:00
Henri Verbeet
94ca46916a
vkd3d-shader/ir: Store the SSA register count in struct vsir_program.
2024-01-22 22:18:52 +01:00
Henri Verbeet
7b85cd6a31
vkd3d-shader/ir: Store the "use_vocp" field in struct vsir_program.
2024-01-22 22:18:51 +01:00
Henri Verbeet
23dcd4f22b
vkd3d-shader/ir: Store the shader version in struct vsir_program.
2024-01-22 22:18:50 +01:00
Henri Verbeet
fc9043be3c
vkd3d-shader/ir: Introduce struct vsir_program.
2024-01-22 22:18:48 +01:00
Conor McCarthy
ca7487a56d
vkd3d-shader/spirv: Handle UINT32_MAX result from FIRSTBIT_HI and FIRSTBIT_SHI instructions.
2024-01-22 22:18:27 +01:00
Conor McCarthy
5ebe0cc717
vkd3d-shader/spirv: Do not assert VKD3D_DATA_UINT in spirv_compiler_emit_ld_raw_structured_srv_uav().
2024-01-22 22:18:17 +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
Conor McCarthy
ba1ee27b4b
vkd3d-shader/dxil: Handle the DXIL PHI instruction.
2024-01-18 23:15:12 +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
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
Conor McCarthy
52902b042f
vkd3d-shader/spirv: Support vector source param for FIRSTBIT_HI and FIRSTBIT_SHI instructions.
2024-01-15 19:56:35 +01:00
Henri Verbeet
fd8a0d7fb6
vkd3d-shader/spirv: Pass a uint32_t write mask to spirv_compiler_emit_neg().
2024-01-11 23:05:03 +01:00
Henri Verbeet
b4da553d28
vkd3d-shader/spirv: Pass a uint32_t write mask to spirv_compiler_emit_abs().
2024-01-11 23:05:02 +01:00
Henri Verbeet
97acca715e
vkd3d-shader/spirv: Pass a uin32_t write mask to spirv_compiler_emit_load_src().
2024-01-11 23:05:01 +01:00
Henri Verbeet
5c2d0f42b5
vkd3d-shader/spirv: Pass a uint32_t write mask to vkd3d_symbol_set_register_info().
2024-01-11 23:05:00 +01:00
Giovanni Mascellani
7f9803620f
vkd3d-shader/spirv: Specify behavior for bit field instructions.
...
Bit field instructions in SPIR-V do not specify what happens when
offset + count exceeds the type bit width. After this commit we
refine the emitted code's behavior to match TPF.
This fixes a few failures on MoltenVK.
2024-01-08 21:44:52 +01:00
Henri Verbeet
60842b7181
vkd3d-shader/ir: Store source parameter swizzles as a uint32_t.
2024-01-04 22:23:51 +01:00
Henri Verbeet
9f4ca3bc9c
vkd3d-shader/ir: Store instruction flags as a uint32_t.
2024-01-04 22:23:49 +01:00
Henri Verbeet
7f94fda05c
vkd3d-shader/ir: Rename the "immconst_uint64" field of struct vkd3d_shader_register to "immconst_u64".
2024-01-03 22:37:43 +01:00
Henri Verbeet
e33d3b3954
vkd3d-shader/ir: Rename the "immconst_uint" field of struct vkd3d_shader_register to "immconst_u32".
...
For consistency with the rest of vkd3d-shader; e.g. put_u32() and
read_u32().
2024-01-03 22:37:39 +01:00
Conor McCarthy
78343dcf87
vkd3d-shader/spirv: Decorate non-float32 non-built-in pixel shader inputs as Flat.
...
As per VUID-StandaloneSpirv-Flat-04744. Not strictly a regression, but
revealed by 66cb2815f
because it declares unused inputs.
2024-01-02 23:03:59 +01:00