Commit Graph

5650 Commits

Author SHA1 Message Date
Conor McCarthy
936d8e4f61 vkd3d-shader/spirv: Implement the WAVE_READ_LANE_AT instruction. 2024-05-14 20:44:04 +02:00
Conor McCarthy
e41643ab8f vkd3d-shader/dxil: Implement DX intrinsic WaveReadLaneAt. 2024-05-14 20:44:02 +02:00
Conor McCarthy
5790056c44 tests/hlsl: Add a test for WaveReadLaneAt() with a non-uniform index. 2024-05-14 20:44:00 +02:00
Victor Chiletto
c9af34ab28 vkd3d-shader/hlsl: Avoid a null pointer dereference in hlsl_block_cleanup (UBSan).
destroy_block() is called with a NULL block from:

* create_loop, through the loop rules for while and do-while loops.
* The selection_statement rule, in the case $6.else_block is NULL.
* free_parse_initializer.
2024-05-14 20:43:48 +02:00
Conor McCarthy
98f73ca2e5 vkd3d-shader/ir: Allow all DCL instructions to occur outside hull shader phases. 2024-05-13 22:27:13 +02:00
Conor McCarthy
def87539de vkd3d-shader/dxil: Delete bool not-equal-to-false comparison instructions. 2024-05-13 22:27:13 +02:00
Conor McCarthy
f47ac703ab vkd3d-shader/spirv: Emit a trace instead of a warning message for ignored alignment. 2024-05-13 22:27:13 +02:00
Conor McCarthy
e340855122 vkd3d-shader/spirv: Do not warn if no global flags are unhandled. 2024-05-13 22:27:13 +02:00
Conor McCarthy
ea5624e5e8 vkd3d-shader/dxil: Emit bool inputs and outputs as uint.
DXIL reads/writes uint for these.
2024-05-13 22:27:13 +02:00
Francisco Casas
5b7191280b vkd3d-shader: Return a valid pointer when count=0 in param allocator (ubsan).
After compiling and linking with '-fsanitize=undefined' the following
error pops up in many tests:

    vkd3d_shader_main.c:2024:12: runtime error: member access within null pointer of type 'struct vkd3d_shader_param_node'

This happens in the scenario where shader_param_allocator_get() gets
called with 'count = 0' but no allocation has been made yet, so
allocator->current is NULL.

In this case the result of the function, given by:

    params = &allocator->current->param[allocator->index * allocator->stride];

is an invalid non-NULL pointer.

Functions like shader_sm4_read_instruction() may call
vsir_program_get_src_params() or vsir_program_get_dst_params() with 0
counts for various DCL_ instructions, as well as things like NOP,
ELSE, and SYNC.

We could avoid calling the functions in question with 0 counts, but it
doesn't seem worth the effort.

Alternatively, we could just return NULL on 'count == 0', but this is
also complicated because NULL is interpreted as a memory allocation
failure on the callers.

So we force allocation of the next node even if 'count = 0' when
allocator->current is NULL.
2024-05-13 22:27:13 +02:00
Francisco Casas
28d267b7c0 vkd3d-shader/hlsl: Allocate SM1 numeric uniforms in decreasing bind count. 2024-05-13 22:26:21 +02:00
Francisco Casas
e7450ce539 vkd3d-shader/d3dbc: Write used bind count for numeric uniforms. 2024-05-13 22:26:13 +02:00
Francisco Casas
f548644222 vkd3d-shader/hlsl: Only allocate numeric bind count for SM1 numeric uniforms.
Unless they have register reservations, in which case the whole
variable is still reserved.
2024-05-13 22:26:08 +02:00
Francisco Casas
573d511344 vkd3d-shader/hlsl: Track bind count according to usage for uniforms.
Where bind count means the number of registers required to include all
dereferences to the variable within the shader as in
hlsl_ir_var.bind_count[].
2024-05-13 22:26:07 +02:00
Francisco Casas
e0a801e796 vkd3d-shader/hlsl: Improve tracking of used components running DCE before.
track_object_components_usage() had to be improved to also
register derefs on resource stores.
It was not doing it because it assumed that for every resource store
there was a resource load already, which was true, before calling DCE.
2024-05-13 22:26:05 +02:00
Francisco Casas
657e460d11 vkd3d-shader/hlsl: Allocate unused variables with register reservations on SM1. 2024-05-13 22:26:03 +02:00
Francisco Casas
7b3644d9f2 tests: Test SM1 const register allocation with relative addressing. 2024-05-13 22:26:03 +02:00
Francisco Casas
b56ae0f1c8 tests: Test SM1 constant register allocation with reservations. 2024-05-13 22:26:03 +02:00
Nikolay Sivov
9dcb74341f tests: Test SM1 constant register allocation with a row_major matrix.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
2024-05-13 22:26:01 +02:00
Francisco Casas
7debe25a8b tests: Test SM1 constant register allocation. 2024-05-13 22:26:01 +02:00
Giovanni Mascellani
05394b624a vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS18 in CheckFeatureSupport(). 2024-05-13 11:50:37 +02:00
Giovanni Mascellani
7c7503713a vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS17 in CheckFeatureSupport(). 2024-05-13 11:50:37 +02:00
Giovanni Mascellani
d528fdbebf vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS16 in CheckFeatureSupport(). 2024-05-13 11:50:37 +02:00
Giovanni Mascellani
5445c4c8aa vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS15 in CheckFeatureSupport(). 2024-05-13 11:50:37 +02:00
Giovanni Mascellani
761ee1e487 vkd3d: Handle D3D12_FEATURE_D3D12_OPTIONS14 in CheckFeatureSupport(). 2024-05-13 11:50:37 +02:00
Conor McCarthy
fb20639eb4 vkd3d: Return E_INVALIDARG if the requested shader model is unknown. 2024-05-13 11:50:33 +02:00
Conor McCarthy
d17956ced8 vkd3d: Return a shader model no higher than the requested one for D3D12_FEATURE_SHADER_MODEL. 2024-05-13 11:50:32 +02:00
Conor McCarthy
677c23f1fe tests: Add tests for D3D12_FEATURE_SHADER_MODEL. 2024-05-13 11:50:32 +02:00
Conor McCarthy
77259da1ad vkd3d-shader/spirv: Implement the WAVE_PREFIX_BIT_COUNT instruction. 2024-05-13 11:50:23 +02:00
Conor McCarthy
2810edf45b vkd3d-shader/dxil: Implement DX intrinsic WavePrefixBitCount. 2024-05-13 11:50:22 +02:00
Conor McCarthy
065ef0c5e4 vkd3d-shader/spirv: Implement the WAVE_IS_FIRST_LANE instruction. 2024-05-13 11:50:21 +02:00
Conor McCarthy
c30976e5c2 vkd3d-shader/dxil: Implement DX intrinsic WaveIsFirstLane. 2024-05-13 11:50:20 +02:00
Conor McCarthy
feef2577ef vkd3d-shader/spirv: Implement the WAVE_ALL_BIT_COUNT instruction. 2024-05-13 11:50:19 +02:00
Conor McCarthy
cb5163f9a4 vkd3d-shader/dxil: Implement DX intrinsic WaveAllBitCount. 2024-05-13 11:50:17 +02:00
Elizabeth Figura
4b3a948edc authors: Change the full form of my name. 2024-05-08 21:08:35 +02:00
Giovanni Mascellani
ca35023ed0 vkd3d: Only request properties and features when the corresponding extension is available.
This fixes a number of validation errors.
2024-05-08 21:08:30 +02:00
Giovanni Mascellani
ea090a34cd vkd3d: Init physical device information after checking available extensions. 2024-05-08 21:08:30 +02:00
Giovanni Mascellani
826b75722b vkd3d: Do not automatically succeed if no extensions are available.
So error messages for missing required extensions are emitted.
2024-05-08 21:08:28 +02:00
Giovanni Mascellani
dbe3384609 vkd3d: Move checking device extensions to a dedicated function. 2024-05-08 21:08:28 +02:00
Giovanni Mascellani
29c63906bc vkd3d: Warn about missing extensions only when meaningful. 2024-05-08 21:08:28 +02:00
Stefan Dösinger
d6b1e62ffc vkd3d: Add a win32 version of vkd3d_get_program_name. 2024-05-08 21:08:22 +02:00
Conor McCarthy
962096f179 vkd3d-shader/dxil: Implement DX intrinsics EmitStream, CutStream and EmitThenCutStream. 2024-05-08 21:08:16 +02:00
Conor McCarthy
cc49f26af1 vkd3d-shader/ir: Validate geometry shader properties. 2024-05-08 21:08:15 +02:00
Conor McCarthy
4fd2d5aa77 vkd3d-shader/dxil: Load geometry shader properties. 2024-05-08 21:08:14 +02:00
Conor McCarthy
00b0b8d65c tests/hlsl: Add a geometry shader test. 2024-05-08 21:08:13 +02:00
Conor McCarthy
e6c802e713 tests/shader-runner: Free the hull and domain shader source code. 2024-05-08 21:08:11 +02:00
Nikolay Sivov
0053cc52b7 vkd3d-shader/fx: Initial support for writing sample state objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:05 +02:00
Nikolay Sivov
3c6470e3b2 vkd3d-shader/fx: Set UAV count in the header.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:04 +02:00
Nikolay Sivov
1a79d1e945 vkd3d-shader/fx: Filter out unsupported object types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:03 +02:00
Nikolay Sivov
9bbed14987 vkd3d-shader/fx: Fix shader counter in the header.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:02 +02:00