Commit Graph

4240 Commits

Author SHA1 Message Date
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
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
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
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
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
Nikolay Sivov
cb1a271151 vkd3d-shader/fx: Set texture count in the header.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:01 +02:00
Nikolay Sivov
162d8760be vkd3d-shader/fx: Set RTV counter in the header.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:00 +02:00
Nikolay Sivov
a879ac5536 vkd3d-shader/fx: Write depth stencil view object variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:07:59 +02:00
Zebediah Figura
c2eb563e50 vkd3d-shader/fx: Skip uniform copy logic for global variables. 2024-05-08 21:07:58 +02:00
Francisco Casas
68483d070f vkd3d-shader/hlsl: Turn hlsl_state_block_entry arguments into hlsl_src.
This allows to apply passes that replace instructions in
hlsl_state_block_entry.instrs.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:07:57 +02:00
Zebediah Figura
cefd6f9de6 vkd3d-utils: Implement ID3D12ShaderReflection::GetResourceBindingDesc(). 2024-05-06 22:12:50 +02:00
Zebediah Figura
35d388eedd vkd3d-utils: Initialize the null type vtbl. 2024-05-06 22:12:50 +02:00
Zebediah Figura
7b3c47ba2e vkd3d-shader/tpf: Write the field offset in bytes. 2024-05-06 22:12:48 +02:00
Zebediah Figura
68562d375e vkd3d-utils: Fix bounds comparison against element counts. 2024-05-06 22:12:48 +02:00
Zebediah Figura
2480eec98b vkd3d-shader/hlsl: Move the "base_type" member to the class-specific union. 2024-05-06 22:12:41 +02:00
Zebediah Figura
4fd3f46109 vkd3d-shader/hlsl: Use a switch in hlsl_types_are_equal(). 2024-05-06 22:12:39 +02:00
Zebediah Figura
d9f7a88329 vkd3d-shader/hlsl: Make HLSL_TYPE_PIXELSHADER into a separate class. 2024-05-06 22:12:37 +02:00
Zebediah Figura
874937dab4 vkd3d-shader/hlsl: Make HLSL_TYPE_VERTEXSHADER into a separate class. 2024-05-06 22:12:34 +02:00
Zebediah Figura
e904b4596a vkd3d-shader/hlsl: Ensure that the type is numeric before calling expr_common_base_type(). 2024-05-06 22:12:33 +02:00
Conor McCarthy
cfcc789b42 vkd3d-shader/spirv: Implement the WAVE_OP_* instructions. 2024-05-06 22:12:27 +02:00
Conor McCarthy
c71751edc9 vkd3d-shader/dxil: Implement DX intrinsics WaveActiveOp and WavePrefixOp. 2024-05-06 22:12:25 +02:00
Conor McCarthy
fef5760af0 vkd3d-shader/spirv: Implement the WAVE_ACTIVE_BIT_* instructions. 2024-05-06 22:12:24 +02:00
Conor McCarthy
af208135f3 vkd3d-shader/dxil: Implement DX intrinsic WaveActiveBit. 2024-05-06 22:12:22 +02:00
Conor McCarthy
1c49b3a779 vkd3d-shader/spirv: Implement the WAVE_ACTIVE_BALLOT instruction. 2024-05-06 22:12:21 +02:00
Conor McCarthy
174a692a17 vkd3d-shader/dxil: Implement DX intrinsic WaveActiveBallot. 2024-05-06 22:12:19 +02:00
Henri Verbeet
592e902d47 vkd3d-shader: Pass a struct vsir_program to vkd3d_shader_parser_compile(). 2024-05-02 22:19:18 +02:00
Henri Verbeet
fa7b623eac vkd3d-shader: Pass a struct vsir_program to scan_with_parser(). 2024-05-02 22:19:18 +02:00
Henri Verbeet
f948520504 vkd3d-shader/spirv: Pass a struct vsir_program to spirv_compile(). 2024-05-02 22:19:17 +02:00
Henri Verbeet
e21215f466 vkd3d-shader/spirv: Pass a struct vsir_program to spirv_compiler_generate_spirv(). 2024-05-02 22:19:16 +02:00
Giovanni Mascellani
5d78eeb6d3 vkd3d: Simplify control flow for swapchain images. 2024-05-02 22:19:08 +02:00
Conor McCarthy
95489899be vkd3d-shader/spirv: Handle the WAVE_ANY_TRUE instruction. 2024-05-02 22:19:02 +02:00
Conor McCarthy
fb5eb3159d vkd3d-shader/dxil: Implement DX intrinsic WaveAnyTrue. 2024-05-02 22:19:00 +02:00
Conor McCarthy
77ec2a5caa vkd3d-shader/spirv: Handle the WAVE_ALL_TRUE instruction. 2024-05-02 22:18:59 +02:00
Conor McCarthy
8e2b351538 vkd3d-shader/dxil: Implement DX intrinsic WaveAllTrue. 2024-05-02 22:18:58 +02:00
Conor McCarthy
78f2d2936d vkd3d-shader/spirv: Handle the WAVE_ACTIVE_ALL_EQUAL instruction. 2024-05-02 22:18:57 +02:00
Conor McCarthy
9aa9b112e6 vkd3d-shader/dxil: Implement DX intrinsic WaveActiveAllEqual. 2024-05-02 22:18:55 +02:00
Conor McCarthy
c770efc530 vkd3d-shader/spirv: Handle the WAVELANEINDEX register. 2024-05-02 22:18:54 +02:00
Conor McCarthy
fd590c2593 vkd3d: Initialise wave ops feature options.
Based in part on a vkd3d-proton patch by Philip Rebohle.
2024-05-02 22:18:50 +02:00
Conor McCarthy
a130c970a6 vkd3d-shader/spirv: Handle the WAVELANECOUNT register. 2024-05-02 22:18:49 +02:00
Conor McCarthy
6a56b4e5d8 vkd3d-shader/dxil: Implement DX intrinsics WaveGetLaneCount and WaveGetLaneIndex. 2024-05-02 22:18:48 +02:00
Conor McCarthy
127bcf90e4 vkd3d-shader/dxil: Implement DX intrinsic Coverage. 2024-04-30 16:32:10 +02:00
Conor McCarthy
36c76e1557 vkd3d-shader/dxil: Handle SV_PrimitiveId. 2024-04-30 16:32:10 +02:00
Conor McCarthy
eef0f7c29e vkd3d-shader/dxil: Handle SV_InstanceId. 2024-04-30 16:32:10 +02:00
Conor McCarthy
fb730b11cf vkd3d-shader/dxil: Handle constexpr pointer cast. 2024-04-30 16:31:44 +02:00
Conor McCarthy
05510c118a vkd3d-shader/dxil: Emit an error if a CMPXCHG instruction uses a forward-referenced pointer. 2024-04-30 16:31:42 +02:00
Conor McCarthy
b67a68b486 vkd3d-shader/dxil: Emit an error if a ATOMICRMW instruction uses a forward-referenced pointer. 2024-04-30 16:31:41 +02:00
Conor McCarthy
9615c38968 vkd3d-shader/dxil: Emit an error if a STORE instruction uses a forward-referenced pointer. 2024-04-30 16:31:40 +02:00
Conor McCarthy
b4b5af66ef vkd3d-shader/dxil: Emit an error if a LOAD instruction uses a forward-referenced pointer. 2024-04-30 16:31:39 +02:00
Alexandre Julliard
91762a62c6 vkd3d-shader: Avoid non-constant initializer.
Fixes "initializer element is not constant" error with gcc < 8.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56508
2024-04-30 16:31:32 +02:00
Henri Verbeet
87c83e2ae2 vkd3d-shader: Get rid of struct vkd3d_shader_desc. 2024-04-30 16:31:19 +02:00
Henri Verbeet
b761f1a263 vkd3d-shader/spirv: Use location information from the current instruction. 2024-04-30 16:31:14 +02:00
Henri Verbeet
8b8ad07057 vkd3d-shader/hlsl: Use vkd3d_string_buffer_printf() in declare_predefined_types(). 2024-04-30 16:31:09 +02:00
Francisco Casas
ee735e8eed vkd3d-shader/hlsl: Fold x * 1 identities. 2024-04-30 16:31:05 +02:00
Francisco Casas
b14f935d0f vkd3d-shader/hlsl: Fold x + 0 identities. 2024-04-30 16:31:02 +02:00
Stefan Dösinger
cb6c868460 vkd3d: Implement cache locking. 2024-04-24 23:49:20 +02:00
Stefan Dösinger
71f1955cd6 vkd3d: Implement vkd3d_shader_cache_get. 2024-04-24 23:49:20 +02:00
Stefan Dösinger
aad76f4ed2 vkd3d: Implement vkd3d_shader_cache_put. 2024-04-24 23:49:15 +02:00
Henri Verbeet
af33caf036 vkd3d-common: Introduce vkd3d_atomic_exchange_ptr(). 2024-04-24 23:49:12 +02:00
Henri Verbeet
b1c326ce56 vkd3d-common: Introduce vkd3d_atomic_exchange_u32(). 2024-04-24 23:49:11 +02:00
Henri Verbeet
5c8a90a6c9 vkd3d-common: Introduce vkd3d_atomic_compare_exchange_u32(). 2024-04-24 23:49:11 +02:00
Henri Verbeet
bfbd29efe6 vkd3d: Get rid of vkd3d_atomic_compare_exchange_pointer().
The only uses of this were remove by commit
3ca2259807.
2024-04-24 23:49:10 +02:00
Henri Verbeet
11db8c1719 vkd3d-common: Use WIDL_C_INLINE_WRAPPERS. 2024-04-24 23:48:44 +02:00
Henri Verbeet
534044181b vkd3d-utils: Use WIDL_C_INLINE_WRAPPERS. 2024-04-24 23:48:44 +02:00
Henri Verbeet
d5717d333b vkd3d: Use WIDL_C_INLINE_WRAPPERS. 2024-04-24 23:48:44 +02:00
Conor McCarthy
075979fa21 vkd3d-shader/ir: Always check for undominated SSA use in register relative addresses. 2024-04-24 23:48:13 +02:00
Francisco Casas
5e3515f191 vkd3d-shader/d3dbc: Support SM1 if conditionals.
According to the documentation, if_comp is available from 2_x pixel
and vertex shaders and, unlike "if bool" it doesn't expect a constant
boolean register (from the input signature), so:

if_neq cond -cond

seems like a convenient way to write these, for profiles above 2.0.
2024-04-24 23:48:06 +02:00
Francisco Casas
d2427ea1bd vkd3d-shader/ir: Lower IFC instructions to IF instructions. 2024-04-24 23:48:05 +02:00
Francisco Casas
e370ce5bf2 vkd3d-shader/d3dbc: Pass hlsl_block instead of function declaration. 2024-04-24 23:48:04 +02:00
Henri Verbeet
46fca3f9f4 vkd3d-common: Introduce VKD3D_BITMAP_SIZE. 2024-04-23 22:41:25 +02:00
Francisco Casas
aa35b2cecb vkd3d-shader/hlsl: Cleanup parse_attribute_list structs (valgrind). 2024-04-23 22:38:03 +02:00
Conor McCarthy
e3dde09bb9 vkd3d-shader/ir: Accept undefined PHI incomings as valid.
An incoming can be undefined if the PHI result is not used if the
incoming's path was taken, or if the undefined value is consumed by
an instruction (dxc will compile such code without errors).
2024-04-23 22:37:33 +02:00
Zebediah Figura
d7da278693 vkd3d-shader/hlsl: Make HLSL_TYPE_RENDERTARGETVIEW into a separate class. 2024-04-23 22:37:09 +02:00
Zebediah Figura
ee2bde3aba vkd3d-shader/hlsl: Make HLSL_TYPE_DEPTHSTENCILVIEW into a separate class. 2024-04-23 22:37:06 +02:00
Zebediah Figura
76971d811e vkd3d-shader/hlsl: Make HLSL_TYPE_TECHNIQUE into a separate class. 2024-04-23 22:36:51 +02:00
Zebediah Figura
3c8c7426df vkd3d-shader/hlsl: Make HLSL_TYPE_PASS into a separate class. 2024-04-23 22:36:38 +02:00
Zebediah Figura
24d3a352a6 vkd3d-shader/hlsl: Make HLSL_TYPE_EFFECT_GROUP into a separate class. 2024-04-23 22:36:32 +02:00
Giovanni Mascellani
6b841486d4 vkd3d-shader/ir: Materialize SSAs in each function of a hull shader. 2024-04-23 22:36:17 +02:00
Giovanni Mascellani
c8af142bb0 vkd3d-shader/ir: Structurize each function of a hull shader. 2024-04-23 22:36:16 +02:00
Giovanni Mascellani
d8e4b19cdc vkd3d-shader/ir: Skip invalid blocks when materializing undominated SSAs. 2024-04-23 22:36:14 +02:00
Henri Verbeet
7b4a1fdfbc vkd3d: Move the vkd3d_cond implementation to vkd3d-common.
Much like the vkd3d_mutex implementation.
2024-04-22 23:15:20 +02:00
Henri Verbeet
8345b9b6f5 vkd3d-shader/glsl: Implement VKD3DSIH_NOP. 2024-04-22 23:14:30 +02:00
Conor McCarthy
079f8e4d52 vkd3d-shader/dxil: Implement DX intrinsic OutputControlPointID. 2024-04-22 23:13:31 +02:00
Conor McCarthy
3976738baf vkd3d-shader/dxil: Implement DX intrinsic DomainLocation. 2024-04-22 23:13:30 +02:00
Conor McCarthy
e165f9cefc vkd3d-shader/dxil: Implement DX intrinsic StorePatchConstant. 2024-04-22 23:13:29 +02:00
Conor McCarthy
3479962983 vkd3d-shader/dxil: Implement DX intrinsics LoadOutputControlPoint and LoadPatchConstant. 2024-04-22 23:13:28 +02:00
Conor McCarthy
4457181b2a vkd3d-shader/dxil: Support patch constant functions and signatures. 2024-04-22 23:13:26 +02:00
Zebediah Figura
833c897aac vkd3d-shader/hlsl: Parse register space reservations. 2024-04-22 23:13:15 +02:00
Zebediah Figura
29f6a7e5f7 vkd3d-shader/hlsl: Rename register_opt and packoffset_opt to register_reservation and packoffset_reservation.
"opt" seems to imply "optional", but the optional aspect of these reservations
is not (and never has been) encoded into these rules.
2024-04-22 23:13:13 +02:00
Henri Verbeet
4a209efb62 vkd3d-shader/hlsl: Support spirv-binary and spirv-text as target formats. 2024-04-19 22:24:07 +02:00
Henri Verbeet
0116e49d9b vkd3d-shader/hlsl: Support d3d-asm as target format. 2024-04-19 22:24:06 +02:00
Henri Verbeet
414bb99542 vkd3d-shader/glsl: Add vkd3d-shader version information to the generated shader. 2024-04-19 22:23:55 +02:00
Conor McCarthy
3205e08fb1 vkd3d-shader/dxil: Support SV_Depth, SV_DepthGreaterEqual and SV_DepthLessEqual. 2024-04-19 22:23:43 +02:00
Giovanni Mascellani
296edf0d68 vkd3d-utils: Make all extensions optional in D3D12CreateDeviceVKD3D().
A D3D12 device can be useful even without a surface and swapchain.
On the other hand, just having the surface and swapchain extensions
doesn't give any feature (the client still has to manage them), so
there is no point in making them a requirement.
2024-04-19 22:23:28 +02:00
Zebediah Figura
171e097268 vkd3d-shader/hlsl: Make HLSL_TYPE_UAV into a separate class. 2024-04-19 22:23:20 +02:00
Zebediah Figura
93d7cd1785 vkd3d-shader/hlsl: Make HLSL_TYPE_TEXTURE into a separate class. 2024-04-19 22:23:19 +02:00
Zebediah Figura
220362cbad vkd3d-shader/hlsl: Make HLSL_TYPE_SAMPLER into a separate class. 2024-04-19 22:23:18 +02:00
Zebediah Figura
f57db442b0 vkd3d-shader/hlsl: Make HLSL_TYPE_STRING into a separate class. 2024-04-19 22:23:16 +02:00
Zebediah Figura
cdcf2da2eb vkd3d-shader/hlsl: Make HLSL_TYPE_VOID into a separate class. 2024-04-19 22:23:14 +02:00
Henri Verbeet
e17e481130 vkd3d-shader/glsl: Call vkd3d_shader_normalise(). 2024-04-17 22:52:20 +02:00
Henri Verbeet
c7fc60a237 vkd3d: Avoid leaking "messages" when "error_blob" is NULL in vkd3d_serialize_versioned_root_signature(). (Valgrind). 2024-04-17 22:52:07 +02:00
Henri Verbeet
8a7cb0295a vkd3d: Avoid leaking "messages" when "error_blob" is NULL in vkd3d_serialize_root_signature(). (Valgrind). 2024-04-17 22:52:05 +02:00
Conor McCarthy
742288127f vkd3d: Support DXGI_FORMAT_B4G4R4A4_UNORM. 2024-04-17 22:51:57 +02:00
Conor McCarthy
8879521679 vkd3d: Support DXGI_FORMAT_B5G5R5A1_UNORM. 2024-04-17 22:51:57 +02:00
Conor McCarthy
4cdf38d392 vkd3d: Support DXGI_FORMAT_B5G6R5_UNORM. 2024-04-17 22:51:57 +02:00
Conor McCarthy
270aa22d0b vkd3d: Use Vulkan 1.1 if available. 2024-04-17 22:51:51 +02:00
Conor McCarthy
6975a8d726 vkd3d-shader: Introduce SPIRV_ENVIRONMENT_VULKAN_1_1.
The SPIR-V backend may emit SPIR-V 1.3 if Vulkan 1.1 is available.
Some extensions which provide wave op instructions are available in
SPIR-V 1.0, but these are not sufficient to implement all Shader Model 6
wave op intrinsics. SPIR-V 1.3 has all of the required instructions, but
does not support reading from a quad at a non-constant (but uniform) lane
index, so it may later prove necessary to introduce a Vulkan 1.2
environment.
2024-04-17 22:51:49 +02:00
Conor McCarthy
a7870e1793 vkd3d-shader/spirv: Emit a compiler warning if an atomic op is flagged volatile. 2024-04-17 22:51:43 +02:00
Conor McCarthy
d9f42b2c51 vkd3d-shader/dxil: Implement the DXIL CMPXCHG instruction. 2024-04-17 22:51:41 +02:00
Conor McCarthy
99996ed5b5 vkd3d-shader/dxil: Implement DX intrinsic RenderTargetGetSampleCount. 2024-04-17 22:51:34 +02:00
Conor McCarthy
fe5e821cca vkd3d-shader/dxil: Implement DX intrinsics Texture2DMSGetSamplePosition and RenderTargetGetSamplePosition. 2024-04-17 22:51:32 +02:00
Henri Verbeet
1d6c3eae78 vkd3d-shader/ir: Remove VKD3DSIH_DCL_CONSTANT_BUFFER instructions. 2024-04-16 22:18:52 +02:00
Henri Verbeet
8a9364c124 vkd3d-shader/d3d-asm: Get rid of shader_addline(). 2024-04-16 22:18:44 +02:00
Giovanni Mascellani
a359c42795 vkd3d-shader/ir: Only emit launchers when needed. 2024-04-16 22:18:33 +02:00
Giovanni Mascellani
df4731dc17 vkd3d-shader/ir: Only emit trampolines when needed. 2024-04-16 22:18:26 +02:00
Giovanni Mascellani
d6ba8b88fa vkd3d-shader/ir: Swap selection branches if the if branch is empty. 2024-04-16 22:18:25 +02:00
Conor McCarthy
0515482e82 vkd3d-shader/ir: Validate tessellation declarations. 2024-04-16 22:18:18 +02:00
Conor McCarthy
e1abf1e48a vkd3d-shader/dxil: Implement DX intrinsic PrimitiveID. 2024-04-16 22:18:17 +02:00
Conor McCarthy
54016b3ced vkd3d-shader/dxil: Load hull shader properties. 2024-04-16 22:18:15 +02:00
Conor McCarthy
02cbc511bb vkd3d-shader/dxil: Load domain shader properties. 2024-04-16 22:18:14 +02:00
Henri Verbeet
7d6f0f2592 vkd3d: Implement creating compute pipeline states from shaders with embedded root signatures. 2024-04-15 21:34:09 +02:00
Henri Verbeet
b8eadf4bab vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_interpolation_mode(). 2024-04-15 21:33:58 +02:00
Henri Verbeet
1ad524072d vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_primitive_type(). 2024-04-15 21:33:57 +02:00
Henri Verbeet
7d72accce2 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_decl_usage(). 2024-04-15 21:33:56 +02:00
Henri Verbeet
4d8c966ff4 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_shader_input_sysval_semantic(). 2024-04-15 21:33:55 +02:00
Henri Verbeet
37401fa11c vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_reg_type(). 2024-04-15 21:33:54 +02:00
Henri Verbeet
7c66c9122d vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_register(). 2024-04-15 21:33:52 +02:00
Conor McCarthy
23db066922 vkd3d-shader/ir: Implement MAD in two operations if flagged as precise.
With some changes by Giovanni Mascellani.
2024-04-15 21:33:35 +02:00
Giovanni Mascellani
9112a5be58 vkd3d-shader/ir: Move DCL_TEMPS removal to the generic instruction lowering pass. 2024-04-15 21:33:34 +02:00
Giovanni Mascellani
8a17a5a08b vkd3d-shader/ir: Introduce vsir_program_lower_instructions().
It is meant as generic pass to host all program changes to single
instructions that do not require keeping a global state, intstead
of having to loop through the whole program many times.
2024-04-15 21:33:32 +02:00
Giovanni Mascellani
a7dc6dcce2 vkd3d-shader/ir: Split handling jumps when emitting a structured program. 2024-04-15 21:33:28 +02:00
Giovanni Mascellani
1a8a4c7787 vkd3d-shader/ir: Split handling selections when emitting a structured program. 2024-04-15 21:33:26 +02:00
Giovanni Mascellani
052df4d693 vkd3d-shader/ir: Split handling loops when emitting a structured program. 2024-04-15 21:33:16 +02:00
Giovanni Mascellani
5e42f6779a vkd3d-shader/ir: Split handling blocks when emitting a structured program. 2024-04-15 21:33:15 +02:00
Giovanni Mascellani
b4cfc24f67 vkd3d-shader/ir: Refactor declaration emission outside of the CFG structure.
This is in preparation of handling more than one function (as
it happens for Hull Shaders), which will require having a single
row of declarations, but handling more than one CFG.
2024-04-15 21:33:14 +02:00
Giovanni Mascellani
27801e5612 vkd3d-shader/ir: Split undominated SSA materialization. 2024-04-15 21:33:13 +02:00
Giovanni Mascellani
d891ac5017 vkd3d-shader/ir: Split program structurization. 2024-04-15 21:33:12 +02:00
Giovanni Mascellani
eb15f97083 vkd3d-shader/ir: Move breaks out of selections again after having optimized loops. 2024-04-15 21:33:08 +02:00
Giovanni Mascellani
be7eec75dc vkd3d-shader/ir: Append code to the non-breaking branch if there is breaking one. 2024-04-15 21:33:07 +02:00
Giovanni Mascellani
a2c6b5450b vkd3d-shader/ir: Prepare for changing the destination list in vsir_cfg_optimize_recurse(). 2024-04-15 21:33:05 +02:00
Petrichor Park
1fb9e7526b vkd3d-shader/hlsl: Implement tanh. 2024-04-15 21:32:59 +02:00
Petrichor Park
c4182cc272 vkd3d-shader/hlsl: Implement hyperbolic sin and cos. 2024-04-15 21:32:56 +02:00
Giovanni Mascellani
aad040af05 vkd3d-shader/ir: Remove loops that terminate with a `break'. 2024-04-11 09:22:14 -05:00
Giovanni Mascellani
105ccc4769 vkd3d-shader/ir: Count how many jumps target each loop. 2024-04-11 09:22:13 -05:00
Giovanni Mascellani
f5d1b5d263 vkd3d-shader/ir: Move `break's out of selection constructs when possible. 2024-04-11 09:22:11 -05:00
Nikolay Sivov
8d78e3a821 vkd3d-shader/hlsl: Support refract() intrinsic.
With some changes by Giovanni Mascellani.
2024-04-10 08:55:27 -05:00
Giovanni Mascellani
ecad299ba4 vkd3d-shader/hlsl: Emit half results when operating on half arguments. 2024-04-10 08:55:24 -05:00
Zebediah Figura
280bea9033 vkd3d-shader/fx: Use a switch in write_fx_2_initial_value(). 2024-04-10 08:55:20 -05:00
Zebediah Figura
6c6106f780 vkd3d-shader/fx: Move unimplemented type checks into is_type_supported_fx_2(). 2024-04-10 08:55:19 -05:00
Zebediah Figura
047040fc63 vkd3d-shader/fx: Don't use an array to write the type class. 2024-04-10 08:55:18 -05:00
Zebediah Figura
285059ef11 vkd3d-shader/d3dbc: Consider the class in sm1_base_type().
We want the base type to stop being a property of all types, and to stop using
the same enumeration for objects and numeric types. The backend should do the
work of translation; we want a more sensible and convenient representation for
the compiler itself.
2024-04-10 08:55:17 -05:00
Zebediah Figura
a882d60534 vkd3d-shader/hlsl: Map HLSL_TYPE_DOUBLE to D3DXPT_FLOAT. 2024-04-10 08:55:15 -05:00
Conor McCarthy
9d7f63dc26 vkd3d: Validate that a resource with initial state RENDER_TARGET is a render target. 2024-04-10 08:55:11 -05:00
Conor McCarthy
78301d7202 vkd3d: Validate presence of flag ALLOW_RENDER_TARGET or ALLOW_DEPTH_STENCIL for multisampled resources. 2024-04-10 08:55:11 -05:00
Stefan Dösinger
a7860ae752 vkd3d: Implement reopening existing caches. 2024-04-10 08:54:58 -05:00
Stefan Dösinger
f24005507c vkd3d: Implement opening and closing shader caches. 2024-04-10 08:54:58 -05:00
Giovanni Mascellani
a2bb4ef301 vkd3d-shader/d3d-asm: Reset indent level on HS phases. 2024-04-10 08:54:29 -05:00
Conor McCarthy
cb5411408a vkd3d-shader/dxil: Implement DX intrinsic CalculateLOD. 2024-04-10 08:54:23 -05:00
Francisco Casas
e9559c394b vkd3d-shader/hlsl: Allow KW_PIXELSHADER and KW_VERTEXSHADER as stateblock lhs. 2024-04-10 08:54:23 -05:00
Francisco Casas
ef9ae22ed0 vkd3d-shader/hlsl: Store state block on pass variables. 2024-04-10 08:54:23 -05:00
Francisco Casas
a99bcb1196 vkd3d-shader/hlsl: Parse list of state blocks. 2024-04-10 08:54:23 -05:00
Francisco Casas
80320f6129 vkd3d-shader/hlsl: Introduce hlsl_ir_stateblock_constant. 2024-04-10 08:54:23 -05:00
Francisco Casas
ee0d439a1b vkd3d-shader/hlsl: Parse and store state blocks on variables. 2024-04-10 08:54:23 -05:00
Francisco Casas
4dedcc5885 vkd3d-shader/hlsl: Also call dce before lowering deref paths. 2024-04-10 08:54:23 -05:00
Francisco Casas
5ab1ef1cad vkd3d-shader/hlsl: Properly release string buffer on write_atan_or_atan2().
vkd3d_string_buffer_cleanup() doesn't do the same as
hlsl_release_string_buffer(). The former only frees the char array
inside the string buffer and not the string buffer itself.
2024-04-09 12:28:03 -05:00
Zebediah Figura
0e3377a1be vkd3d-shader/hlsl: Avoid using HLSL_CLASS_OBJECT without checking the base type.
As the diffstat shows, HLSL_CLASS_OBJECT does not really have much in common.
Resource types (TEXTURE, SAMPLER, UAV) sometimes behave similarly to each other,
but do not generally behave similarly to effect-specific types (string, shader,
state, view). Most consumers of HLSL_CLASS_OBJECT subsequently check the base
type anyway.

Hence we want to replace HLSL_TYPE_* with individual classes for object types.
As a first step, change the last few places that only check HLSL_CLASS_OBJECT.
2024-04-09 12:27:55 -05:00
Zebediah Figura
269cdad7b9 vkd3d-shader/hlsl: Consider any valid register reservation to invoke manual packing.
Regardless of the type of the variable.
2024-04-09 12:27:53 -05:00
Zebediah Figura
ce50c3a186 vkd3d-shader/hlsl: Use hlsl_type_is_resource() for unbounded array checks.
Not all objects can be unbounded descriptors.
2024-04-09 12:27:51 -05:00
Zebediah Figura
c5f507ac38 vkd3d-shader/hlsl: Add SM5.1 shader target strings. 2024-04-09 12:27:47 -05:00
Zebediah Figura
843968cd63 vkd3d-shader/hlsl: Use hlsl_version_ge() when checking for unbounded arrays.
6.x also allows them.
2024-04-09 12:27:45 -05:00
Zebediah Figura
5fbd2708c0 vkd3d-shader/hlsl: Move shader version helpers to hlsl.h. 2024-04-09 12:27:43 -05:00