Giovanni Mascellani
51f13391e6
vkd3d-shader/ir: Introduce a simple control flow graph structurizer.
...
The structurizer is implemented along the lines of what is usually called
the "structured program theorem": the control flow is completely
virtualized by mean of an additional TEMP register which stores the
block index which is currently running. The whole program is then
converted to a huge switch construction enclosed in a loop, executing
at each iteration the appropriate block and updating the register
depending on block jump instruction.
The algorithm's generality is also its major weakness: it accepts any
input program, even if its CFG is not reducible, but the output
program lacks any useful convergence information. It satisfies the
letter of the SPIR-V requirements, but it is expected that it will
be very inefficient to run on a GPU (unless a downstream compiler is
able to devirtualize the control flow and do a proper convergence
analysis pass). The algorithm is however very simple, and good enough
to at least pass tests, enabling further development. A better
alternative is expected to be upstreamed incrementally.
Side note: the structured program theorem is often called the
Böhm-Jacopini theorem; Böhm and Jacopini did indeed prove a variation
of it, but their algorithm is different from what is commontly attributed
to them and implemented here, so I opted for not using their name.
2024-02-06 23:07:07 +01:00
Giovanni Mascellani
19aef21369
vkd3d-shader/ir: Handle PHI nodes when materializing SSA registers.
...
PHI nodes cannot be used with TEMP registers, so they have to be
converted to MOV/MOVC nodes and moved before the BRANCH node.
2024-02-06 23:07:03 +01:00
Giovanni Mascellani
e0d3e9c376
vkd3d-shader/ir: Materialize SSA registers to temporaries.
...
For simplicity PHI nodes are not currently handled.
The goal for this pass is to make the CFG structurizer simpler, because
it doesn't have to care about the more rigid rules SSA registers have
to satisfy than TEMP registers.
It is likely that the generated code will be harder for downstream
compilers to optimize and execute efficiently, so once a complete
structurizer is in place this pass should be removed, or at least
greatly reduced in scope.
2024-02-06 23:07:00 +01:00
Giovanni Mascellani
eb723a8d2b
vkd3d-shader/spirv: Support bool TEMP registers.
2024-02-06 23:06:58 +01:00
Giovanni Mascellani
49f0fd42b8
vkd3d-shader/spirv: Move bool casting helpers above register loading helpers.
2024-02-06 23:06:55 +01:00
Giovanni Mascellani
ee994e95dd
vkd3d-shader/spirv: Convert the swizzle according to the source bit width.
...
Fixes: 1f536238a8
2024-02-06 23:06:53 +01:00
Giovanni Mascellani
674f86042d
vkd3d-shader/dxil: Set the register before calling src_param_init_scalar().
...
Which uses the register to compute the appropriate swizzle.
Fixes: 1f536238a8
2024-02-06 23:06:49 +01:00
Henri Verbeet
06ddb10c40
vkd3d: Introduce a debug helper for CPU descriptor handles.
2024-02-01 22:25:36 +01:00
Henri Verbeet
feca006d6a
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_versioned_root_signature_deserializer_Release().
2024-02-01 22:25:27 +01:00
Henri Verbeet
f42411fe4a
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_versioned_root_signature_deserializer_AddRef().
2024-02-01 22:25:27 +01:00
Henri Verbeet
afd0e45cd6
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_root_signature_deserializer_Release().
2024-02-01 22:25:27 +01:00
Henri Verbeet
c2e82cf06a
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_root_signature_deserializer_AddRef().
2024-02-01 22:25:27 +01:00
Henri Verbeet
9434687c5b
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_pipeline_state_Release().
2024-02-01 22:25:27 +01:00
Henri Verbeet
c71fa87522
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_pipeline_state_AddRef().
2024-02-01 22:25:27 +01:00
Henri Verbeet
9e135f6143
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_root_signature_Release().
2024-02-01 22:25:27 +01:00
Henri Verbeet
37e8826301
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_root_signature_AddRef().
2024-02-01 22:25:27 +01:00
Jacek Caban
2ae9f18a3a
vkd3d: Use uint64_t for the size in vkd3d_gpu_va_allocator_allocate.
...
Avoids value truncation in 32-bit builds.
2024-02-01 22:25:20 +01:00
Conor McCarthy
eae4b7b4a2
vkd3d: Implement GetResourceAllocationInfo1().
2024-02-01 22:25:13 +01:00
Conor McCarthy
67b4ae658a
tests/d3d12: Add tests for GetResourceAllocationInfo1().
2024-02-01 22:25:12 +01:00
Conor McCarthy
7e84421b9c
vkd3d: Support multiple descriptions in GetResourceAllocationInfo().
2024-02-01 22:25:11 +01:00
Conor McCarthy
8d0331df6c
tests/d3d12: Test multiple descriptions in test_resource_allocation_info().
2024-02-01 22:25:10 +01:00
Conor McCarthy
92e19a7da3
vkd3d: Add ID3D12Device7 interface stubs.
2024-02-01 22:25:10 +01:00
Conor McCarthy
76fbbe980a
vkd3d: Add ID3D12Device6 interface stub.
2024-02-01 22:25:10 +01:00
Conor McCarthy
95e4222cc6
vkd3d-shader/spirv: Emit a vector bitcast if necessary in spirv_compiler_emit_load_ssa_reg().
2024-02-01 22:25:04 +01:00
Conor McCarthy
ebec0aa434
vkd3d-shader/dxil: Implement DX intrinsic TextureLoad.
2024-02-01 22:25:02 +01:00
Conor McCarthy
e6d52861e9
vkd3d-shader/dxil: Implement DX intrinsic SplitDouble.
2024-02-01 22:24:58 +01:00
Conor McCarthy
254e812b12
tests/shader-runner: Add an asuint() test to the 64-bit cast tests.
2024-02-01 22:24:57 +01:00
Evan Tang
13ac795061
tests/shader-runner: Support testing for integer pixel data.
...
Modified by Conor McCarthy to use read_uint() and read_uint4().
2024-02-01 22:24:54 +01:00
Henri Verbeet
6dea3d08b1
vkd3d: Use debugstr_hresult() in d3d12_device_mark_as_removed().
2024-02-01 00:08:39 +01:00
Henri Verbeet
920f5293e9
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_query_heap_Release().
2024-02-01 00:08:35 +01:00
Henri Verbeet
d66f61cd5f
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_query_heap_AddRef().
2024-02-01 00:08:35 +01:00
Henri Verbeet
334f60c281
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_descriptor_heap_Release().
2024-02-01 00:08:35 +01:00
Henri Verbeet
db37be2a70
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_descriptor_heap_AddRef().
2024-02-01 00:08:35 +01:00
Henri Verbeet
886c1fdcc4
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_resource_Release().
2024-02-01 00:08:35 +01:00
Henri Verbeet
84234a8875
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_resource_AddRef().
2024-02-01 00:08:35 +01:00
Henri Verbeet
201fab7d5d
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_resource_decref().
2024-02-01 00:08:35 +01:00
Henri Verbeet
a9582a7355
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_resource_incref().
2024-02-01 00:08:35 +01:00
Henri Verbeet
6f7aec58ea
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_heap_resource_destroyed().
2024-02-01 00:08:35 +01:00
Henri Verbeet
30a00160e2
vkd3d: Use vkd3d_atomic_increment_u32() in vkd3d_bind_heap_memory().
2024-02-01 00:08:35 +01:00
Henri Verbeet
06eb8e5f8c
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_heap_Release().
2024-02-01 00:08:35 +01:00
Henri Verbeet
fd385ab994
vkd3d: Use vkd3d_atomic_increment_u32() in d3d12_heap_AddRef().
2024-02-01 00:08:35 +01:00
Giovanni Mascellani
cc72a8d311
vkd3d-shader/spirv: Free binary SPIR-V code (Valgrind).
2024-02-01 00:08:28 +01:00
Giovanni Mascellani
8b11b4b37a
vkd3d-compiler: Free compilation options (Valgrind).
2024-02-01 00:08:28 +01:00
Giovanni Mascellani
896fc0c2ce
vkd3d-compiler: Exit the main function through a common code path.
2024-02-01 00:08:28 +01:00
Henri Verbeet
d38221bd68
vkd3d-shader/ir: Pass a struct vsir_program to shader_parser_get_src_params().
2024-02-01 00:08:23 +01:00
Henri Verbeet
47ec24ebad
vkd3d-shader/ir: Pass a struct vsir_program to shader_parser_get_dst_params().
2024-02-01 00:08:22 +01:00
Henri Verbeet
ced8543952
vkd3d-shader: Use vkd3d_atomic_increment_u32() in vkd3d_shader_dump_blob().
2024-02-01 00:08:18 +01:00
Henri Verbeet
fef30dac2c
vkd3d-shader/d3dbc: Do not fail parsing the shader when undeclared inputs are encountered.
...
These can be disassembled by D3DDisassemble() just fine, and perhaps
more importantly, shader model 1 vertex shaders do not require dcl_
instructions in Direct3D 8.
2024-01-29 22:33:46 +01:00
Henri Verbeet
8c6f5b847b
vkd3d-utils: Implement D3DDisassemble().
...
Very loosely based on Wine's d3dcompiler_43.
2024-01-29 22:33:44 +01:00
Henri Verbeet
4fd4ecc020
vkd3d: Use vkd3d_atomic_decrement_u32() in d3d12_device_Release().
2024-01-29 22:33:40 +01:00