Henri Verbeet
eabcaf15fb
vkd3d-shader/ir: Use vsir_instruction_is_dcl() in vsir_validate_instruction().
2024-01-24 22:38:36 +01:00
Henri Verbeet
365ad56888
vkd3d-shader/ir: Get rid of shader_instruction_is_dcl().
2024-01-24 22:38:34 +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
6446b6ea21
vkd3d-shader: Introduce VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64.
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
Conor McCarthy
41cce4cbf1
vkd3d-shader/dxil: Handle floating point special value comparisons in sm6_parser_emit_dx_unary().
2024-01-24 22:37:59 +01:00
Zebediah Figura
579e262d98
vkd3d-utils: Implement input and output signature reflection.
2024-01-24 22:37:53 +01:00
Zebediah Figura
53bd1f5419
vkd3d-utils: Add D3DReflect().
2024-01-24 22:37:53 +01:00
Francisco Casas
b92f6c448a
vkd3d-shader/ir: Lower texkill instructions to discard_nz.
2024-01-24 22:37:41 +01:00
Francisco Casas
7e75ac63a1
vkd3d-shader/d3dbc: Emit fixme for HLSL_RESOURCE_SAMPLE_LOD.
...
Currently, HLSL_RESOURCE_SAMPLE_LOD is not implemented for d3dbc,
but we are incorrectly writting a texld instruction to handle it.
This causes SM1 tests with the vulkan backend (in following patches)
to fail if VKD3D_SHADER_CONFIG="force_validation" is enabled.
For now a fixme is emited in these cases.
2024-01-24 22:37:38 +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
Henri Verbeet
e4cc4a336e
vkd3d: Use debugstr_hresult() in vkd3d_init_null_resources().
2024-01-23 20:27:28 +01:00
Henri Verbeet
d4b329e628
vkd3d: Use debugstr_hresult() in vkd3d_join_thread().
2024-01-23 20:27:28 +01:00
Henri Verbeet
e965701776
vkd3d: Use debugstr_hresult() in d3d12_device_init().
2024-01-23 20:27:28 +01:00
Henri Verbeet
8dc1239e14
vkd3d: Use debugstr_hresult() in vkd3d_create_vk_device().
2024-01-23 20:27:28 +01:00
Henri Verbeet
af160ef0c4
vkd3d: Use debugstr_hresult() in vkd3d_instance_init().
2024-01-23 20:27:28 +01:00
Conor McCarthy
e4660fe0e6
vkd3d-shader/spirv: Emit DISCARD as a function call.
2024-01-23 20:26:59 +01:00
Conor McCarthy
367a06d748
vkd3d-shader/dxil: Use strcmp() to find the handle type.
...
We use strcmp() on the same type name elsewhere, and case-insensitive
matching does not seem necessary.
2024-01-23 20:26:53 +01:00
Conor McCarthy
1cca18a228
vkd3d-shader/dxil: Use strcmp() to find function names.
...
Function names are case-sensitive.
2024-01-23 20:26:52 +01:00
Conor McCarthy
4dec25cbde
vkd3d-shader/dxil: Use strcmp() to check the entry point name.
...
Function names are case-sensitive.
2024-01-23 20:26:50 +01:00
Zebediah Figura
a8b0c03912
vkd3d-shader/hlsl: Always cast to bool in if() statements.
...
We emit sm4 if_nz for these, but that does a bitwise comparison to zero, which is wrong for floats.
2024-01-23 20:26:46 +01:00
Zebediah Figura
183172eff4
vkd3d-shader/hlsl: Validate that condition expressions are numeric.
2024-01-23 20:26:45 +01:00
Zebediah Figura
09220edd21
vkd3d-shader/hlsl: Validate the condition data type for loops as well.
2024-01-23 20:26:44 +01:00
Zebediah Figura
c18a349a3f
vkd3d-shader/hlsl: Copy some missing fields in hlsl_type_clone().
2024-01-23 20:26:42 +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
4b869f73bb
vkd3d-shader/ir: Run tracing and validation for DXIL code too.
2024-01-23 20:26:36 +01:00
Conor McCarthy
6df725718a
vkd3d-shader/ir: Refactor return code checking in vkd3d_shader_normalise().
...
We started with only one or two of these but it has become excessive.
Patch originally written by Conor McCarthy and updated by Giovanni Mascellani.
2024-01-23 20:26:34 +01:00
Conor McCarthy
b3903636f7
vkd3d-shader/dxil: Implement DX intrinsic Binary.
2024-01-23 20:26:29 +01:00
Conor McCarthy
6c71cd5a72
vkd3d-shader/dxil: Add an operand type code for the return type.
2024-01-23 20:26:28 +01:00
Nikolay Sivov
0117e4fb7e
vkd3d-shader/fx: Add initial support for writing passes for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:22 +01:00
Nikolay Sivov
b478f0a300
vkd3d-shader/fx: Add initial support for writing fx_2_0 binaries.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:21 +01:00
Nikolay Sivov
56100d36b1
vkd3d-shader/fx: Check technique type in global scope as well.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:20 +01:00
Nikolay Sivov
2c1905b780
vkd3d-shader/hlsl: Allow annotations on techniques.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:19 +01:00
Nikolay Sivov
76a689d43f
vkd3d-shader/hlsl: Allow annotations on passes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:18 +01:00
Nikolay Sivov
e72f8f9a30
vkd3d-shader/hlsl: Add passes variables to the techniques.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:16 +01:00
Nikolay Sivov
fe8881747b
vkd3d-shader/hlsl: Add initial support for parsing annotations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:15 +01:00
Giovanni Mascellani
232b2ad360
vkd3d-shader/ir: Validate PHI instructions.
2024-01-23 20:26:08 +01:00
Giovanni Mascellani
56f9057985
vkd3d-shader/ir: Do not allow IMMCONST and IMMCONST64 as destination registers.
2024-01-23 20:26:06 +01:00
Giovanni Mascellani
21633fcc52
vkd3d-shader/ir: Refactor register-type-specific code in parameter validation.
...
To better accommodate code for other register types.
2024-01-23 20:26:05 +01:00
Giovanni Mascellani
fb6409bda1
vkd3d-shader/ir: Check that all instructions appear in a block.
2024-01-23 20:26:03 +01:00
Giovanni Mascellani
dc56320b31
vkd3d-shader/tpf: Support SV_ViewportArrayIndex in pixel and vertex shaders.
2024-01-22 22:19:14 +01:00
Giovanni Mascellani
3a90f3e29d
vkd3d-shader/tpf: Support SV_InstanceID in vertex shaders.
2024-01-22 22:19:13 +01:00
Giovanni Mascellani
b500381b5c
vkd3d-shader/tpf: Support SV_RenderTargetArrayIndex in pixel and vertex shaders.
2024-01-22 22:19:12 +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
dd00e209ac
vkd3d: Use debugstr_hresult() in d3d12_command_queue_submit_locked().
2024-01-22 22:19:03 +01:00
Henri Verbeet
ebb2a31e50
vkd3d: Use debugstr_hresult() in d3d12_command_list_copy_incompatible_texture_region().
2024-01-22 22:19:03 +01:00
Henri Verbeet
f6ef7c3f46
vkd3d: Use debugstr_hresult() in vkd3d_wait_for_gpu_fence().
2024-01-22 22:19:03 +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
55c7cd5c22
vkd3d-shader/dxil: Handle semantic kind ISFRONTFACE.
2024-01-22 22:18:33 +01:00
Conor McCarthy
9f409b67d7
vkd3d-shader/dxil: Handle semantic kind VERTEXID.
2024-01-22 22:18:32 +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
bfdc8b31a3
vkd3d-shader/dxil: Implement DX intrinsic BufferLoad for typed buffers.
2024-01-22 22:18:21 +01:00
Conor McCarthy
85052ba93e
vkd3d-shader/dxil: Load typed UAV descriptors.
2024-01-22 22:18:19 +01:00
Conor McCarthy
89d1ef83f4
vkd3d-shader/dxil: Load typed SRV descriptors.
2024-01-22 22:18:18 +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
Conor McCarthy
80d7ea2924
vkd3d-shader/dxil: Pass the code block and instruction in a struct to intrinsic handlers.
...
Simplifies handling of intrinsics which need to emit more than one
instruction.
2024-01-22 22:18:16 +01:00
Henri Verbeet
14da4df99e
vkd3d-common: Use vkd3d_atomic_decrement_u32() in vkd3d_blob_Release().
2024-01-18 23:16:19 +01:00
Henri Verbeet
bb6b393c15
vkd3d-common: Use vkd3d_atomic_increment_u32() in vkd3d_blob_AddRef().
2024-01-18 23:16:19 +01:00
Henri Verbeet
5fe3c624d5
vkd3d-common: Use vkd3d_atomic_increment_u32() in get_buffer().
2024-01-18 23:16:19 +01:00
Henri Verbeet
f69c8b1cc4
vkd3d-shader/d3dbc: Store the "offset" field as an unsigned int in hlsl_sm1_register_from_semantic().
2024-01-18 23:16:06 +01:00
Giovanni Mascellani
67902d4304
vkd3d-shader/ir: Validate RET instructions.
2024-01-18 23:15:58 +01:00
Giovanni Mascellani
af96730276
vkd3d-shader/ir: Validate SWITCH_MONOLITHIC instructions.
2024-01-18 23:15:57 +01:00
Giovanni Mascellani
46ebb404d7
vkd3d-shader/ir: Validate BRANCH instructions.
2024-01-18 23:15:56 +01:00
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
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
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
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
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
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
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
Henri Verbeet
b1c538e0fe
vkd3d-shader/tpf: Store the "components" token as a uint32_t in shader_sm4_read_dcl_resource().
2024-01-15 19:58:17 +01:00
Henri Verbeet
9896394220
vkd3d-shader/tpf: Pass a uint32_t modifier token to shader_sm4_read_instruction_modifier().
2024-01-15 19:58:15 +01:00
Nikolay Sivov
1a036ddff6
vkd3d-shader/fx: Do not write the same string twice.
2024-01-15 19:57:43 +01:00
Nikolay Sivov
e7d65d39ba
vkd3d-shader/fx: Initial support for fx_5_0 output.
2024-01-15 19:57:42 +01:00
Nikolay Sivov
8014c11e88
vkd3d-shader/fx: Write empty passes blocks.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-15 19:57:41 +01:00
Nikolay Sivov
e1dca9b27a
vkd3d-shader/hlsl: Add a scope for technique variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-15 19:57:39 +01:00
Nikolay Sivov
0a6d842ed1
vkd3d-shader/hlsl: Rename the rule for an optional name.
...
Names are optional for both techniques and passes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-15 19:57:37 +01:00
Francisco Casas
43ff28b00b
vkd3d-shader/hlsl: Emit fixmes on non-constant vector addressing.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56162
Storing to a vector component using a non-constant index is not allowed
on profiles lower than 6.0. Unless this happens inside a loop that can be
unrolled, which we are not doing yet.
For this reason, a validate_nonconstant_vector_store_derefs pass is
added to detect these cases.
Ideally we would want to emit an hlsl_error on this pass, but before
implementing loop unrolling, we could reach this point on valid HLSL.
Also, as pointed out by Nikolay in the mentioned bug, currently
new_offset_from_path_index() fails an assertion when this happens,
because it expects an hlsl_ir_constant, so a check is added.
It also felt correct to emit an hlsl_fixme there, despite the
redundancy.
2024-01-15 19:57:12 +01:00
Giovanni Mascellani
b0c8a47f9d
vkd3d-shader/ir: Check that SSA registers are used validly.
...
Specifically, they are assigned only once and only assigned components
are used.
Right now we don't check that the assignment dominates all usages.
2024-01-15 19:57:01 +01:00
Giovanni Mascellani
26bebe8f91
vkd3d-shader/ir: Check that SSA registers have consistent dimensions.
2024-01-15 19:57:00 +01:00
Giovanni Mascellani
7503429555
vkd3d-shader/ir: Check that TEMP registers have consistent dimensions.
2024-01-15 19:56:59 +01:00
Giovanni Mascellani
fbd77486de
vkd3d-shader/ir: Use vkd3d_free() instead of free().
2024-01-15 19:56:58 +01:00
Giovanni Mascellani
26c6a87268
vkd3d-shader/ir: Simplify control flow in vsir_validate_register().
2024-01-15 19:56:56 +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
3e2ace8d33
vkd3d-shader/dxbc: Use sizeof(uint32_t) instead of sizeof(DWORD) in calls to require_space().
2024-01-11 23:05:56 +01:00
Henri Verbeet
69350e1ff0
vkd3d-shader/dxbc: Pass an unsigned int count to shader_parse_root_parameters1().
2024-01-11 23:05:54 +01:00
Henri Verbeet
04acc52496
vkd3d-shader/dxbc: Pass a size_t offset to shader_get_string().
2024-01-11 23:05:52 +01:00
Henri Verbeet
bf0fda7812
vkd3d: Trace GetLastError() results with %lu.
...
These are DWORDs, but this is all Windows code, so we can just use %lu.
2024-01-11 23:05:42 +01:00
Conor McCarthy
ac9b14599f
vkd3d-shader/dxil: Avoid null dereference on failure to find function pointer type.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55684
2024-01-11 23:05:17 +01:00
Giovanni Mascellani
78d95889bd
vkd3d-shader: Make *src and *dst mutable in vkd3d_shader_instruction.
...
They were originally made const because no optimization/normalization
pass existed. Now having to cast away const all the time is becoming
more and more burdening.
2024-01-11 23:05:11 +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
Henri Verbeet
9dd5b2840f
vkd3d-shader: Recognise DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS in shader_validate_descriptor_range1().
2024-01-11 23:04:54 +01:00
Nikolay Sivov
a0207436f2
vkd3d-shader/tpf: Add initial support for writing fx_4_0/fx_4_1 binaries.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:48 +01:00
Nikolay Sivov
9494b72224
vkd3d-shader: Add separate binary target type for effects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:48 +01:00
Nikolay Sivov
e527d7c1e7
vkd3d-shader/hlsl: Handle effect group statement.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:46 +01:00
Nikolay Sivov
f7a02a5da2
vkd3d-shader/hlsl: Add variables for techniques.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:45 +01:00
Nikolay Sivov
8494342fa0
vkd3d-shader/hlsl: Rename rule for top-level techniques.
...
Only technique10 and technique11 types could be nested in groups.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:43 +01:00
Nikolay Sivov
c3af1f9989
vkd3d-shader/hlsl: Add 'fxgroup' token.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:42 +01:00
Giovanni Mascellani
017f86aaaf
vkd3d-shader/d3d-asm: Guess a sensible data type for literals.
...
When the typing information is not reliable.
2024-01-11 23:04:34 +01:00
Giovanni Mascellani
e3fb4e7eac
vkd3d-utils: Support many different surface types when creating a device.
...
This is nice for the application, which can use our implementation of
D3D12CreateDevice() in more environments, and basically free for us,
because surface creation is still the application's business.
2024-01-09 23:00:58 +01:00
Conor McCarthy
b0d1fb7d98
vkd3d: Use mutable descriptors if available.
...
The mutable descriptor type allows six descriptor sets to be replaced
with one set for CBV/SRV/UAV heaps.
2024-01-09 22:59:46 +01:00
Henri Verbeet
bb64bfff63
vkd3d: Attempt to translate border colours to static border colours in d3d12_desc_create_sampler().
2024-01-08 21:45:39 +01:00
Henri Verbeet
9060baacec
vkd3d: Implement support for static border colours.
2024-01-08 21:45:39 +01:00
Henri Verbeet
3344c4e93d
vkd3d-shader/hlsl: Store modifier flags as a uint32_t.
2024-01-08 21:45:26 +01:00
Henri Verbeet
fafe2a1dba
vkd3d-shader/hlsl: Store swizzles as a uint32_t.
2024-01-08 21:45:24 +01:00
Fabian Maurer
49d5aecaa7
vkd3d: Unlock mutex in error case in d3d12_command_queue_CopyTileMappings.
2024-01-08 21:45:06 +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
Giovanni Mascellani
5e7f9d4d0d
vkd3d: Specify the aspect when creating NULL UAVs.
...
This fixes a crash on MoltenVK.
2024-01-08 21:44:49 +01:00
Henri Verbeet
50cebc7278
vkd3d: Slightly simplify debug_vk_memory_property_flags().
...
VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD and
VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD were introduced by
Vulkan-Headers 1.1.121; we currently require version 1.2.148.
2024-01-04 22:24:10 +01:00
Henri Verbeet
0fb1ef1e63
vkd3d: Recognise VK_QUEUE_VIDEO_DECODE_BIT_KHR in debug_vk_queue_flags().
...
This was introduced by Vulkan-Headers 1.3.238, which is a bit newer than
we currently require.
2024-01-04 22:24:07 +01:00
Henri Verbeet
659c870edc
vkd3d: Recognise VK_QUEUE_PROTECTED_BIT in debug_vk_queue_flags().
2024-01-04 22:24:07 +01:00
Henri Verbeet
5b9a0dfaea
vkd3d-shader/ir: Store destination parameter shifts as an unsigned int.
2024-01-04 22:23:54 +01:00
Henri Verbeet
4b5d3a078b
vkd3d-shader/ir: Store destination parameter modifier flags as a uint32_t.
2024-01-04 22:23: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
Giovanni Mascellani
bd9118cac4
vkd3d-shader/ir: Validate destination write masks depending on the dimension.
2024-01-04 22:23:25 +01:00
Giovanni Mascellani
15e7711786
vkd3d-shader/ir: Validate source swizzles depending on the dimension.
2024-01-04 22:23:24 +01:00
Giovanni Mascellani
e91da41dea
vkd3d-shader/ir: Validate SSA registers.
2024-01-04 22:23:23 +01:00
Giovanni Mascellani
e29ae1550c
vkd3d-shader/dxil: Create constant buffer registers with dimension vec4.
2024-01-04 22:23:21 +01:00
Giovanni Mascellani
df2ae56de8
vkd3d-shader/d3dbc: Override the write mask when the destination is not vec4.
2024-01-04 22:23:20 +01:00
Zebediah Figura
1ce7e3d8b1
vkd3d-shader/d3dbc: Assign unique register indices for VKD3DSPR_RASTOUT.
2024-01-04 22:23:09 +01:00
Zebediah Figura
3f52fda8ad
vkd3d-shader: Lower shader model 1/2 inter-stage I/O to a flat array.
...
An alternative is that we stash the reg_type in the signature, but this seems
far simpler for the backend to deal with.
2024-01-04 22:23:07 +01:00
Giovanni Mascellani
3bafee344d
vkd3d-shader/dxil: Use vkd3d_shader_parser_error() for error reporting when available.
2024-01-03 22:38:26 +01:00
Giovanni Mascellani
a02cd1cf64
vkd3d-shader/dxil: Do not use the parser before it is initialized.
2024-01-03 22:38:24 +01:00
Conor McCarthy
111818eabb
vkd3d-shader/dxil: Pre-allocate instruction space for globals in sm6_parser_globals_init().
...
For simplicity, declaration handlers assume instruction allocation will
not fail.
2024-01-03 22:38:21 +01:00
Conor McCarthy
8aa6e2228e
vkd3d-shader/dxil: Count global variables in dxil_block_compute_module_decl_count().
2024-01-03 22:38:19 +01:00
Henri Verbeet
4ec7f360d9
vkd3d: Add D3D_FEATURE_LEVEL_1_0_CORE as a valid feature level.
2024-01-03 22:38:10 +01:00
Henri Verbeet
6abcc27c97
vkd3d: Add D3D_FEATURE_LEVEL_12_2 as a valid feature level.
2024-01-03 22:38:10 +01:00
Henri Verbeet
ed4f3f3272
vkd3d-shader/ir: Rename the "immconst_double" field of struct vkd3d_shader_register to "immconst_f64".
2024-01-03 22:37: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
05a542ba00
vkd3d-shader/ir: Rename the "immconst_float" field of struct vkd3d_shader_register to "immconst_f32".
2024-01-03 22:37:41 +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
Conor McCarthy
812f01c2e2
vkd3d-shader/spirv: Handle ITOI and UTOU in spirv_compiler_map_alu_instruction().
...
These instructions perform integer casts to/from 64 bits.
2024-01-02 23:03:07 +01:00
Conor McCarthy
1eaa7d1dbe
vkd3d-shader/spirv: Support UINT64 source in spirv_compiler_emit_bool_cast().
2024-01-02 23:03:06 +01:00
Conor McCarthy
99924d913b
vkd3d-shader/spirv: Support 64-bit sources in spirv_compiler_emit_int_div().
2024-01-02 23:03:05 +01:00
Conor McCarthy
13459a55f1
vkd3d-shader/spirv: Introduce a UINT64 component type.
2024-01-02 23:03:04 +01:00
Conor McCarthy
fe44873979
vkd3d-shader/spirv: Introduce a data_type_is_64_bit() helper function.
2024-01-02 23:03:03 +01:00
Conor McCarthy
511c66d595
vkd3d-shader/spirv: Use data_type_is_integer() in spirv_compiler_emit_neg().
2024-01-02 23:03:02 +01:00
Conor McCarthy
cc43ef3bca
vkd3d: Pass int64 capability info to vkd3d-shader.
2024-01-02 23:03:00 +01:00
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
Zebediah Figura
4ff389854c
vkd3d-shader: Allow compiling d3d bytecode to SPIR-V.
2023-12-14 23:19:31 +01:00
Zebediah Figura
2bc40385d9
vkd3d-shader: Do not scan DCL instructions which do not declare resources.
2023-12-14 23:19:28 +01:00
Zebediah Figura
8af47a96ea
vkd3d-shader: Do not scan the shader in vkd3d_shader_parser_compile() for assembly targets.
2023-12-14 23:19:28 +01:00
Conor McCarthy
b8694fd879
vkd3d: Co-locate all descriptor-related members.
...
To optimise cache coherence, because decriptor updates use the most
performance-critical code paths.
2023-12-14 21:00:34 +01:00
Conor McCarthy
a2741babd9
vkd3d: Rename the device mutex to pipeline_cache_mutex.
...
It is used only for pipeline and render pass caching, and renaming it
helps prevent inappropriate or erroneous use.
2023-12-14 21:00:30 +01:00
Conor McCarthy
37e76618ca
vkd3d: Write Vulkan descriptors in a worker thread.
...
Raises framerate by 5-10% in games which write thousands of descriptors
per frame, e.g. Horizon Zero Dawn.
The worker thread is a generic device worker which can also be used for
other purposes if the need arises.
2023-12-14 21:00:28 +01:00
Conor McCarthy
70962ae7d8
vkd3d: Update the descriptor next
index before getting a reference for writing.
...
Fixes a race condition where the descriptor is modified between getting
its object and resetting the `next` index. The new object would never be
written. While it is invalid for the app to write descriptors used by a
command list which has been submitted to a queue, unused descriptors may
be written. This change also supports writing descriptors in a worker
thread.
2023-12-14 21:00:26 +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
a6317e5f3b
vkd3d: Pad push constant ranges to 16 bytes.
...
Because that's the granularity of Constant Buffer accesses in SM4.
This commit requires using more push constants, but without it the
generated SPIR-V can be invalid.
2023-12-13 22:32:23 +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
Giovanni Mascellani
e7fdf2e97f
vkd3d-shader/d3d-asm: Dump unknown types as "<unknown>".
...
In analogy with "<continued>" and "<unused>".
2023-12-12 23:16:24 +01:00
Giovanni Mascellani
1caaf90ee2
vkd3d-shader/d3d-asm: Dump recently added types.
2023-12-12 23:16:23 +01:00
Giovanni Mascellani
4b6e596740
vkd3d-shader/d3d-asm: Write a single type in shader_dump_data_type().
2023-12-12 23:16:22 +01:00
Giovanni Mascellani
bd50f15d31
vkd3d-shader/d3d-asm: Indent on IFC.
2023-12-12 23:16:21 +01:00
Conor McCarthy
cdb9eecfd1
vkd3d-shader/spirv: Introduce a compiler feature flag for int64 capability.
2023-12-12 22:50:53 +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
Fabian Maurer
9cb4372378
vkd3d-shader/dxil: Check null pointer before it is dereferenced (Coverity).
2023-12-11 23:18:58 +01:00
Conor McCarthy
2037daae32
vkd3d-shader/spirv: Bitcast if necessary in the spirv_compiler_emit_mov() general implementation.
...
In SM 6, this is needed when storing an asfloat() or asuint() result in
an indexable temp, because dxc performs the bitcast by casting the
destination pointer.
2023-12-11 23:18:52 +01:00
Conor McCarthy
3db7c2a62d
vkd3d-shader/dxil: Implement the DXIL STORE instruction.
2023-12-11 23:18:51 +01:00
Conor McCarthy
2d5f2bf7a4
vkd3d-shader/dxil: Implement the DXIL ALLOCA instruction.
2023-12-11 23:18:50 +01:00
Zebediah Figura
d49bccea9a
vkd3d-shader/dxil: No longer synthesize DCL instructions.
2023-12-11 23:18:45 +01:00
Zebediah Figura
66cb2815f0
vkd3d-shader/spirv: Declare I/O registers from the signature.
...
Instead of parsing DCL instructions.
This allows sm1 to work without further effort, and simplifies sm6 code.
2023-12-11 23:18:44 +01:00
Zebediah Figura
75348dff12
vkd3d-shader/dxil: Map SEMANTIC_KIND_TARGET to VKD3D_SHADER_SV_TARGET.
2023-12-11 23:18:43 +01:00
Zebediah Figura
cabf9996f9
vkd3d-shader/tpf: Do not uninvert used masks for domain shader patch constants.
2023-12-11 23:18:42 +01:00
Zebediah Figura
8876030590
vkd3d-shader/spirv: Do not use the output_info array for patch constants.
2023-12-11 23:18:40 +01:00
Conor McCarthy
45679a966c
vkd3d-shader/ir: Pass a local copy of location to control_point_normaliser_emit_hs_input().
2023-12-07 21:57:49 +01:00
Zebediah Figura
28f32349f4
vkd3d-shader: Add a helper to search the scan descriptor info.
...
Avoid shadowing "info" in vkd3d_shader_scan_combined_sampler_declaration().
2023-12-07 21:57:34 +01:00
Zebediah Figura
dfea1abbd8
vkd3d-shader/hlsl: Avoid shadowing "jump" in normalize_switch_cases().
2023-12-07 21:57:33 +01:00
Zebediah Figura
98a02ceffb
vkd3d-shader/hlsl: Avoid shadowing "load" in intrinsic_tex().
2023-12-07 21:57:31 +01:00
Zebediah Figura
a102e99897
vkd3d-shader/hlsl: Avoid shadowing "block" in resolve_loop_continue().
2023-12-07 21:57:30 +01:00
Zebediah Figura
ca8492c855
vkd3d-shader/d3dbc: Avoid shadowing "instr" in write_sm1_jump().
2023-12-07 21:57:28 +01:00
Zebediah Figura
46e135f6a7
vkd3d-shader/hlsl: Avoid shadowing "load" in lower_index_loads().
...
Found with -Wshadow.
2023-12-07 21:57:16 +01:00
Conor McCarthy
a4a1b4c557
vkd3d-shader/dxil: Set the result register data type for nop casts.
...
Casts from minimum precision types are emitted as nop, but the result
value type must be set to the cast result type.
2023-12-07 21:57:08 +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
a33a9127ca
vkd3d-shader/dxil: Implement DX intrinsic Unary.
2023-12-07 21:56:53 +01:00
Conor McCarthy
cc5e703802
vkd3d-shader/dxil: Emit constant global arrays as immediate constant buffers.
2023-12-07 21:56:47 +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
ef940cb778
vkd3d-shader/spirv: Support declared component type and count in immediate constant buffers.
2023-12-07 21:56:45 +01:00
Conor McCarthy
16cb6fdbad
vkd3d-shader/spirv: Support constant initialisers in indexable temps.
2023-12-07 21:56:44 +01:00
Conor McCarthy
ffae57eb8d
vkd3d-shader/dxil: Support null constant arrays.
2023-12-07 21:56:43 +01:00
Conor McCarthy
69c3946c85
vkd3d-shader/spirv: Support declared component type and count in indexable temps.
2023-12-07 21:56:41 +01:00
Henri Verbeet
0c33f82f72
Release 1.10.
2023-12-06 15:31:21 +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
b5c067b41a
vkd3d-shader/ir: Do not merge signature elements which have different interpolation modes.
...
Regression in signature normalisation, however the old code was not
correct either because it would apply the interpolation mode to all
components. Found in an Assassin's Creed: Valhalla shader.
2023-12-06 15:31:18 +01:00
Conor McCarthy
b4d03c0221
vkd3d-shader/spirv: Do not emit a fixme for SV_TARGET in vkd3d_get_spirv_builtin().
2023-12-04 22:22:55 +01:00
Conor McCarthy
f11e1461aa
vkd3d-shader/spirv: Do not emit a fixme for SV_TARGET in get_spirv_builtin_for_sysval().
2023-12-04 22:22:54 +01:00
Francisco Casas
736f3ae2df
vkd3d-shader/hlsl: Use values at the time of the swizzle's load in copy-propagation.
...
This preempts us from replacing a swizzle incorrectly, as in the
following example:
1: A.x = 1.0
2: A
3: A.x = 2.0
4: @2.x
were @4 ends up being 2.0 instead of 1.0, because that's the value stored in
A.x at time 4, and we should be querying it at time 2.
This also helps us to avoid replacing a swizzle with itself in copy-prop
which can result in infinite loops, as with the included tests this commit.
Consider the following sequence of instructions:
1 : A
2 : B = @1
3 : B
4 : A = @3
5 : @1.x
Current copy-prop would replace 5 so it points to @3 now:
1 : A
2 : B = @1
3 : B
4 : A = @3
5 : @3.x
But in the next iteration it would make it point back to @1, keeping it
spinning infinitively.
The solution is to index the instructions and don't replace the swizzle
if the new load happens after the current load.
2023-11-29 22:53:24 +01:00
Francisco Casas
d877b877b3
vkd3d-shader/hlsl: Record trace of stored values in copy-propagation.
...
Instead of only storing the value that each variable's component has at
the moment of the instruction currently handled by copy-prop, we store
the trace of all the historic values with their timestamps, i.e. the
instruction index on which the value was stored.
This would allow us to query the value that the variable had at the time
of execution of previous instructions.
2023-11-29 22:53:21 +01:00
Francisco Casas
539294daea
vkd3d-shader/hlsl: Move index_instructions() up.
2023-11-29 22:53:19 +01:00
Giovanni Mascellani
a52604da8c
vkd3d-shader/dxil: Declare IO registers as VEC4.
...
Otherwise, for instance, their write masks and swizzles are not written
in the D3D ASM dump.
2023-11-28 21:49:18 +01:00
Nikolay Sivov
6a4a9a4518
vkd3d-shader/hlsl: Handle 'linear centroid' modifier.
2023-11-28 00:10:12 +01:00
Zebediah Figura
10957bebbf
vkd3d-shader/tpf: Remove an unnecessary local variable declaration.
...
Found with -Wshadow.
2023-11-28 00:09:56 +01:00
Zebediah Figura
2d1825bb89
vkd3d-shader/hlsl: Remove an unnecessary local variable in copy_propagation_get_value().
...
Found with -Wshadow.
2023-11-28 00:09:53 +01:00
Jacek Caban
85f21f197c
vkd3d-shader: Avoid implicit enum pointer casts in allocate_semantic_register.
2023-11-28 00:09:29 +01:00
Jacek Caban
1edbc05745
vkd3d-shader: Use unsigned int type for tags passed to sm6_metadata_get_uint_value.
2023-11-28 00:09:29 +01:00
Jacek Caban
72bb5e8b02
vkd3d: Use VkPipelineStageFlags type for VkSubmitInfo.pWaitDstStageMask flags.
2023-11-28 00:09:28 +01:00
Alistair Leslie-Hughes
5c134d44d6
include: D3D12_RT_FORMAT_ARRAY remove typedef to make header compatible with windows.
...
windows d3d12.idl doesn't have this as a typedef.
2023-11-28 00:09:20 +01:00
Stefan Dösinger
2935ac5c7e
vkd3d: Forward MakeResident to EnqueueMakeResident.
2023-11-28 00:09:09 +01:00
Stefan Dösinger
bd35c91227
vkd3d: Improve the EnqueueMakeResident stub.
2023-11-28 00:09:06 +01:00
Francisco Casas
4e1bf5e163
vkd3d-shader/hlsl: Discern between signed and unsigned ints when parsing.
2023-11-22 22:08:05 +01:00
Francisco Casas
9a8f6e0edb
vkd3d-shader/hlsl: Parse integers with the 'u' postfix.
2023-11-22 22:08:04 +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
ae4341b565
vkd3d-shader/ir: Use location information from the instruction in vkd3d_shader_scan_instruction().
2023-11-21 22:41:58 +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
5b82afb83f
vkd3d-shader/ir: Decorate vkd3d_shader_scan_error() with VKD3D_PRINTF_FUNC.
2023-11-21 22:41:55 +01:00
Jacek Caban
078cf6a240
vkd3d-shader/dxbc: Use return type to return result from read_u32 and read_float.
...
Avoid implicit casts from enum pointers.
2023-11-20 22:07:45 +01:00
Giovanni Mascellani
b1123ed35f
vkd3d-shader/ir: Correctly compute the TEMP count after hull shader flattening.
...
The previous computation was incorrect because the count was taken
after resetting it to zero (as part of setting the instruction to NOP).
2023-11-20 22:07:41 +01:00
Giovanni Mascellani
5cb17cfd1c
vkd3d-shader/ir: Validate IFC instructions.
2023-11-20 22:07:36 +01:00
Giovanni Mascellani
849a8f3add
vkd3d-shader/ir: Expect two sources for LOOP in SM1-3.
2023-11-20 22:07:35 +01:00
Henri Verbeet
73c563ffb7
vkd3d-shader/d3dbc: Adjust the token count for DEF and DEFI instructions in shader_sm1_skip_opcode().
...
This was broken by commit e390bc35e2c9b0a2110370f916033eea2366317e; that
commit fixed the source count for these instructions, but didn't adjust
shader_sm1_skip_opcode(). Note that this only affects shader model 1;
later versions have a token count embedded in the initial opcode token.
2023-11-20 22:07:29 +01:00
Nikolay Sivov
e55b6a7fa1
vkd3d-shader/hlsl: Add constants to the block for log()/log10() builtins.
2023-11-20 22:07:24 +01:00
Akihiro Sagawa
aed2d142cf
vkd3d-shader/hlsl: Add degrees() function.
2023-11-20 22:07:19 +01:00
Akihiro Sagawa
e493627130
vkd3d-shader/hlsl: Add radians() function.
2023-11-20 22:07:17 +01:00
Nikolay Sivov
88caf87789
vkd3d-shader/hlsl: Add a helper to check for a numeric type.
2023-11-15 21:48:49 +01:00
Conor McCarthy
76eb0adf03
vkd3d: Support depth bounds test.
2023-11-15 21:48:45 +01:00
Conor McCarthy
d8ba0d2a11
vkd3d: Implement ID3D12Device2::CreatePipelineState().
2023-11-15 21:48:44 +01:00
Conor McCarthy
6196199a89
vkd3d: Use struct d3d12_pipeline_state_desc for compute pipelines.
2023-11-15 21:48:44 +01:00
Conor McCarthy
39afbb8e32
vkd3d: Introduce struct d3d12_pipeline_state_desc for graphics pipelines.
...
A generic container for both compute and graphics pipeline descriptions
to facilitate reading the description from a stream.
2023-11-15 21:48:42 +01:00
Conor McCarthy
fb588b8d1a
vkd3d-shader/spirv: Avoid invalid bool-to-bool conversion in spirv_compiler_emit_movc().
...
Shaders parsed from DXIL contain a bool condition register, so calling
spirv_compiler_emit_int_to_bool() results in an invalid bool/uint
comparison.
2023-11-15 21:48:36 +01:00
Conor McCarthy
3c4631a4d4
vkd3d-shader/dxil: Implement the DXIL VSELECT instruction.
2023-11-15 21:48:35 +01:00
Conor McCarthy
08b8730866
vkd3d-shader/spirv: Return an error if an invalid handler is encountered.
...
Prevents return of an invalid SPIR-V module.
2023-11-15 21:48:31 +01:00
Conor McCarthy
408f67c69c
vkd3d-shader/dxil: Handle missing flags as zero for CMP2.
...
The flag operand is omitted if IEEE strictness is specified.
2023-11-14 23:06:43 +01:00
Conor McCarthy
f1e9f40061
vkd3d-shader/dxil: Handle missing flags as zero for BINOP.
...
The flag operand is omitted if IEEE strictness is specified.
2023-11-14 23:06:41 +01:00
Henri Verbeet
9de793f180
vkd3d-shader: Implement scanning combined resource/sampler information.
2023-11-13 23:19:23 +01:00
Nikolay Sivov
d190fdf8c5
vkd3d-shader/dxil: Fully initialize instruction data in sm6_parser_emit_extractval().
...
Noticed after test runner started crashing when tracing is enabled.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-13 23:19:18 +01:00
Nikolay Sivov
e7422fdefb
vkd3d: Fix some spelling mistakes.
2023-11-13 23:19:15 +01:00
Nikolay Sivov
3203485a7c
vkd3d-shader: Fix some spelling mistakes.
2023-11-13 23:19:15 +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
Conor McCarthy
1dd141535c
vkd3d-shader/spirv: Support bool dst register in spirv_compiler_emit_comparison_instruction().
2023-11-10 20:23:48 +01:00
Nikolay Sivov
418c177a1b
vkd3d-shader/hlsl: Implement texCUBEproj().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-10 20:23:44 +01:00
Nikolay Sivov
81ff57e07c
vkd3d-shader/hlsl: Implement tex3Dproj().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-10 20:23:43 +01:00
Nikolay Sivov
dd6a9135f4
vkd3d-shader/hlsl: Implement tex2Dproj().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-10 20:23:41 +01:00
Giovanni Mascellani
0c5c18bdce
vkd3d-shader/ir: Validate index count for IMMCONST64 registers.
2023-11-09 21:15:51 +01:00
Giovanni Mascellani
b74470b9d2
vkd3d-shader/ir: Validate index count for IMMCONST registers.
2023-11-09 21:15:49 +01:00
Giovanni Mascellani
c867682982
vkd3d-shader/ir: Validate index count for NULL registers.
2023-11-09 21:15:47 +01:00
Giovanni Mascellani
12fcb8dcc6
vkd3d-shader/ir: Validate register indices.
2023-11-09 21:15:44 +01:00
Giovanni Mascellani
b7aeb5dd70
vkd3d-shader/ir: Use vsir_register_init() to initialize a register.
2023-11-09 21:15:42 +01:00
Giovanni Mascellani
a869069a48
vkd3d-shader/ir: Validate the TEMP register indices in each HS phase.
2023-11-09 21:15:40 +01:00
Giovanni Mascellani
0f4bda9c9d
vkd3d-shader/ir: Keep track of hull shader phases.
2023-11-09 21:15:38 +01:00
Conor McCarthy
5768c019c1
vkd3d-shader/ir: Check the handler before changing it to NOP in remove_dead_code().
2023-11-09 21:15:29 +01:00
Zebediah Figura
ade8899456
vkd3d-shader/hlsl: Use hlsl_types_are_equal() in func_decl_matches().
...
Besides reusing code, this now handles UAV types correctly.
2023-11-09 21:15:21 +01:00
Zebediah Figura
8f041fbe6f
vkd3d-shader/hlsl: Return bool from compare_function_decl().
2023-11-09 21:15:19 +01:00
Zebediah Figura
fef118555c
vkd3d-shader/hlsl: Do not prioritize an exact match when looking up functions.
...
Native does not always do this. For example, functions whose parameters are
float and float1 always result in an "ambiguous function call" error.
This does not fix any tests, because the relevant tests previously (incorrectly)
succeeded, and now fail with:
E5017: Aborting due to not yet implemented feature: Prioritize between multiple compatible function overloads.
when they should simply fail.
2023-11-09 21:15:17 +01:00
Zebediah Figura
514d179b70
vkd3d-shader/hlsl: Do not consider scalars and 1-dimensional vectors to be equivalent in function parameters.
2023-11-09 21:15:14 +01:00
Zebediah Figura
b1c2852cd7
vkd3d-shader/hlsl: Store function overloads in a list.
...
The choice to store them in an rbtree was made early on. It does not seem likely
that HLSL programs would define many overloads for any of their functions, but I
suspect the idea was rather that intrinsics would be defined as plain
hlsl_ir_function_decl structures [cf. 447463e590
]
and that some intrinsics that could operate on any type would therefore need
many overrides.
This is not how we deal with intrinsics, however. When the first intrinsics were
implemented I made the choice disregard this intended design, and instead match
and convert their types manually, in C. Nothing that has happened in the time
since has led me to question that choice, and in fact, the flexibility with
which we must accommodate functions has led me to believe that matching in this
way was definitely the right choice. The main other designs I see would have
been:
* define each intrinsic variant separately using existing HLSL types. Besides
efficiency concerns (i.e. this would take more space in memory, and would take
longer to generate each variant), the normal type-matching rules don't really
apply to intrinsics.
[For example: elementwise intrinsics like abs() return the same type as the
input, including preserving the distinction between float and float1. It is
legal to define separate HLSL overloads taking float and float1, but trying to
invoke these functions yields an "ambiguous function call" error.]
* introduce new (semi-)generic types. This is far more code and ends up acting
like our current scheme (with helpers) in a slightly more complex form.
So I think we can go ahead and rip out this vestige of the original design for
intrinsics.
As for why to change it: rbtrees are simply more complex to deal with, and it
seems unlikely to me that the difference is going to matter. I do not expect any
program to define large quantities of intrinsics; linked list search should be
good enough.
2023-11-09 21:15:11 +01:00
Zebediah Figura
2b59a759d5
vkd3d-shader/hlsl: Rename hlsl_get_func_decl() to hlsl_get_first_func_decl().
2023-11-09 21:15:09 +01:00
Zebediah Figura
011e31f624
vkd3d-shader/spirv: Remove no longer used private_output_variable_array_idx array.
2023-11-09 21:15:01 +01:00
Zebediah Figura
8513f567fa
vkd3d-shader/spirv: Look up builtins by vkd3d_shader_sysval_semantic.
...
Instead of by vkd3d_shader_input_sysval_semantic.
2023-11-09 21:14:57 +01:00
Zebediah Figura
87cb66dd43
vkd3d-shader/spirv: Simplify spirv_compiler_emit_dcl_input().
2023-11-09 21:14:55 +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
Zebediah Figura
133e313800
vkd3d-shader/dxil: Do not use COLOROUT for PS outputs.
...
sm4 does not use this; only sm1 does. In following patches we will normalize it
to OUTPUT.
2023-11-09 21:14:49 +01:00
Conor McCarthy
90d178bf12
vkd3d-shader/dxil: Implement the DXIL CAST instruction.
2023-11-09 21:14:42 +01:00
Conor McCarthy
bd77cbb33f
vkd3d-shader/spirv: Support double in spirv_compiler_emit_ftou().
2023-11-09 21:14:40 +01:00
Conor McCarthy
92d546f3a2
vkd3d-shader/spirv: Support double in spirv_compiler_emit_ftoi().
2023-11-09 21:14:37 +01:00
Conor McCarthy
169210558d
vkd3d-shader/spirv: Handle unsigned result in spirv_compiler_emit_ftoi().
2023-11-09 21:14:35 +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
Conor McCarthy
b43dab50c1
vkd3d-shader/spirv: Support bitcast in spirv_compiler_emit_load_ssa_reg().
2023-11-09 21:14:25 +01:00
Henri Verbeet
2252f012ea
vkd3d: Add support for the ID3D12Resource1 interface.
2023-11-09 21:14:20 +01:00
Henri Verbeet
e7eec3e023
vkd3d-shader/spirv: Allow the origin of fragment coordinates to be specified.
...
We typically want to use lower-left in OpenGL environments when rendering to
FBOs.
2023-11-09 21:14:12 +01:00
Henri Verbeet
c5cc467394
vkd3d: Report D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE for UAV formats.
2023-11-08 22:49:43 +01:00
Henri Verbeet
000843b7c8
vkd3d: Report D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD for UAV formats when we have "uav_read_without_format".
2023-11-08 22:49:43 +01:00
Nikolay Sivov
4778d051df
vkd3d-shader: Add constant folding for 'floor'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
634ec96b52
vkd3d-shader: Add a missing entry to instruction debug print helper.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
955932fb55
vkd3d-shader: Add constant folding for 'ceil'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
9a70ae5b6a
vkd3d-shader: Add support for floor() on SM1-3.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
aaef82e680
vkd3d-shader: Add support for ceil() on SM1-3.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
494f681bf6
vkd3d-shader/tpf: Add support for ceil().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:38 +01:00
Nikolay Sivov
4284b7c522
vkd3d-shader/hlsl: Parse ceil() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:37 +01:00
Nikolay Sivov
76e42fbd21
vkd3d-shader/hlsl: Implement ternary operator for SM1.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:31 +01:00
Nikolay Sivov
522a0dfb56
vkd3d-shader/hlsl: Add tex2Dlod() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:26 +01:00
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