Commit Graph

3508 Commits

Author SHA1 Message Date
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