Commit Graph

3324 Commits

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