Francisco Casas
affadf319c
vkd3d-shader/d3dbc: Write default values for SM1.
2024-06-11 15:46:40 +02:00
Francisco Casas
253c994155
vkd3d-shader/tpf: Write default values for SM4.
2024-06-11 15:46:40 +02:00
Francisco Casas
099a64aeb2
vkd3d-shader/hlsl: Initialize default values with braceless initializers.
...
It is hard to initialize default values on add_assignment() and calling
add_assignment() for initializers is not really necessary: the only
thing we need from it the implicit cast.
2024-06-11 15:46:40 +02:00
Francisco Casas
e8dbc36bd2
vkd3d-shader/hlsl: Record default values for uniforms and constant buffers.
2024-06-11 15:46:40 +02:00
Henri Verbeet
1fe7a6581b
vkd3d-shader/ir: Rename the "handler_idx" field of struct vkd3d_shader_instruction to "opcode".
2024-05-30 19:57:01 +02:00
Nikolay Sivov
5265fbb789
vkd3d-shader/fx: Do not write shared buffers block when not compiling as a child effect.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-30 19:56:50 +02:00
Nikolay Sivov
ea177a7750
vkd3d-shader/hlsl: Handle "unsigned int" type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-30 19:56:29 +02:00
Henri Verbeet
36c123c005
Release 1.12.
2024-05-29 22:05:28 +02:00
Nikolay Sivov
308d735923
vkd3d-shader/ir: Set texture register dimension as VEC4 when normalising combined samplers.
...
Thanks, Giovanni.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-27 21:07:51 +02:00
Nikolay Sivov
f090d1e80d
vkd3d-shader: Remove explicit newlines from hlsl_fixme() messages.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-23 23:12:10 +02:00
Henri Verbeet
b5ac6ac636
vkd3d-shader: Use a separate allocation for the "semantic_name" field of shader signature elements.
...
For tpf shader this would previously be a pointer into the original
shader code, and for d3dbc shaders we'd use static strings.
Unfortunately the dxil parser creates shader signatures where these
are pointers to metadata strings, and those go away when we call
sm6_parser_cleanup().
We could conceivably store a flag in the shader signature to indicate
whether shader_signature_cleanup()/vkd3d_shader_free_shader_signature()
should free the "semantic_name" field. It'd be a little ugly, and seems
unlikely to be worth it, but I'd be willing to be convinced.
2024-05-23 23:12:06 +02:00
Victor Chiletto
105ef28273
vkd3d-shader/preproc: Treat CR as whitespace.
2024-05-23 23:11:58 +02:00
Victor Chiletto
fa5708d3b5
vkd3d-shader/hlsl: Fix XOR assign operator lexing.
2024-05-22 22:15:20 +02:00
Nikolay Sivov
9c83caeda6
vkd3d-shader/fx: Use correct type name when reusing types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-16 21:49:50 +02:00
Nikolay Sivov
a913ac7844
vkd3d-shader/fx: Implement writing shared buffers.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-16 21:49:48 +02:00
Henri Verbeet
ce6f8a6a30
vkd3d-shader/dxil: Parse the shader into a vsir program in vkd3d_shader_sm6_parser_create().
2024-05-16 21:49:40 +02:00
Henri Verbeet
6474e8cc7b
vkd3d-shader/tpf: Parse the shader into a vsir program in vkd3d_shader_sm4_parser_create().
2024-05-16 21:49:39 +02:00
Henri Verbeet
402b96ef3b
vkd3d-shader/d3dbc: Parse the shader into a vsir program in vkd3d_shader_sm1_parser_create().
2024-05-16 21:49:38 +02:00
Henri Verbeet
efe9dfd73a
vkd3d-shader/ir: Do not store the vkd3d-shader configuration flags in struct vkd3d_shader_parser.
2024-05-16 21:49:37 +02:00
Henri Verbeet
19b552ce1b
vkd3d-shader/ir: Pass an initialised vsir_program structure to vkd3d_shader_parser_init().
2024-05-16 21:49:36 +02:00
Henri Verbeet
9e4a790de1
vkd3d-shader/ir: Use a separate allocation for the vsir program in struct vkd3d_shader_parser.
2024-05-16 21:49:34 +02:00
Francisco Casas
061dc39036
vkd3d-shader/hlsl: Also lower matrix swizzles and index loads in const passes.
2024-05-15 21:17:51 +02:00
Francisco Casas
0d252f894a
vkd3d-shader/hlsl: Run more constant passes on static expressions eval.
2024-05-15 21:17:50 +02:00
Francisco Casas
4f60c7167e
vkd3d-shader/hlsl: Run constant passes in a separate function.
2024-05-15 21:17:49 +02:00
Conor McCarthy
9e57039fce
vkd3d-shader/dxil: Handle SV_ClipDistance and SV_CullDistance.
2024-05-14 20:44:22 +02:00
Conor McCarthy
4f50af4c83
vkd3d-shader/dxil: Handle SV_Coverage out.
2024-05-14 20:44:18 +02:00
Conor McCarthy
e1c774bfeb
vkd3d-shader/spirv: Implement the WAVE_READ_LANE_FIRST instruction.
2024-05-14 20:44:10 +02:00
Conor McCarthy
47f0483267
vkd3d-shader/dxil: Implement DX intrinsic WaveReadLaneFirst.
2024-05-14 20:44:06 +02:00
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
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
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
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
7b3c47ba2e
vkd3d-shader/tpf: Write the field offset in bytes.
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
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
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
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
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
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
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
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
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
Conor McCarthy
e72c3bab71
vkd3d-shader/spirv: Ensure the data register is UINT in spirv_compiler_emit_store_tgsm().
2024-04-09 12:27:30 -05:00
Conor McCarthy
dc99159dd8
vkd3d-shader/spirv: Bitcast if necessary in spirv_compiler_emit_store_dst_components().
2024-04-09 12:27:29 -05:00
Conor McCarthy
85c8c6be4d
vkd3d-shader/dxil: Support constexpr GEP.
2024-04-09 12:27:26 -05:00
Conor McCarthy
7d5e3713f9
vkd3d-shader/ir: Materialise SSAs to temps before lowering switch instructions.
2024-04-09 12:27:20 -05:00
Conor McCarthy
cfcd57209b
vkd3d-shader/ir: Convert SSAs to temps only if the block of origin does not dominate all uses.
2024-04-09 12:27:19 -05:00
Conor McCarthy
1c61776c18
vkd3d-shader/spirv: Handle uint2 to double bitcast in spirv_compiler_emit_mov().
...
Necessary for MakeDouble if the dst is SSA.
2024-04-09 12:27:18 -05:00
Conor McCarthy
c8eb7e1c81
vkd3d-shader/spirv: Emit a uint result for RESINFO_UINT if the dst register is SSA.
2024-04-09 12:27:16 -05:00
Conor McCarthy
7bfc7410f2
vkd3d-shader/ir: Materialise phis to temps in the incoming blocks.
...
RADV converts temps to phi instructions, so converting phis to MOVC in
VSIR just translates back to phis feeding into a MOVC. This commit
eliminates the MOVC.
2024-04-09 12:27:15 -05:00
Francisco Casas
62bb12f322
vkd3d-shader/hlsl: Use LOGIC_AND instead of MUL in all().
2024-04-09 12:27:09 -05:00
Francisco Casas
53e4d6eedb
vkd3d-shader/hlsl: Use LOGIC_OR instead of BIT_OR in any().
...
Note that BIT_OR is not available for SM1 bools, so we must prefer
LOGIC_OR when possible.
2024-04-09 12:27:07 -05:00
Francisco Casas
2621fc9572
vkd3d-shader/ir: Add missing src swizzle in vsir_program_lower_texkills().
2024-04-09 12:27:06 -05:00
Francisco Casas
8fca801591
vkd3d-shader/tpf: Use the extra_bits field for _nz on discard.
2024-04-09 12:27:03 -05:00
Francisco Casas
3a0a4b625f
vkd3d-shader/hlsl: Merge HLSL_OP3_MOVC into HLSL_OP3_TERNARY.
2024-04-09 12:27:02 -05:00
Francisco Casas
8f6f875a59
vkd3d-shader/hlsl: Move lower of non-float expressions with the other SM1 passes.
2024-04-09 12:27:01 -05:00
Francisco Casas
19fd43214b
vkd3d-shader/hlsl: Ensure that TERNARY condition is always bool.
...
Also, properly casting it to float in lower_ternary() for SM1
avoids creating ABS and NEG on bool types.
2024-04-09 12:26:59 -05:00
Giovanni Mascellani
a278f32d3f
vkd3d-shader/ir: Synthesize selection constructs from conditional jumps.
2024-04-04 22:19:19 +02:00
Giovanni Mascellani
0d13b6afe9
vkd3d-shader/ir: Remove trailing `continue's.
2024-04-04 22:19:18 +02:00
Giovanni Mascellani
d8414302e8
vkd3d-shader/ir: Move `continue's to the false branch when possible.
2024-04-04 22:19:16 +02:00
Nikolay Sivov
4b0a328a2b
vkd3d-shader/hlsl: Allow 'export' modifier on functions.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-04-03 22:24:15 +02:00
Giovanni Mascellani
e6c20361ea
vkd3d-shader/ir: Drop a useless helper.
2024-04-03 22:23:08 +02:00
Giovanni Mascellani
9aff65c6d2
vkd3d-shader/ir: Open a loop when visiting the loop header.
...
Not when making the loop header available, which is too early and
might lead to open too many loops at once.
2024-04-03 22:23:06 +02:00
Nikolay Sivov
e1e6367210
vkd3d-shader/fx: Add an option to include empty buffers in the effect binary.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-04-02 23:10:42 +02:00
Nikolay Sivov
c509c85f63
vkd3d-shader/hlsl: Allow annotations on constant buffers.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-04-02 23:10:40 +02:00
Giovanni Mascellani
d10031911d
vkd3d-shader/ir: Move vsir_program_normalise() to the end of the file.
...
vsir_program_normalise() has function calls to basically everything in
ir.c, so it's useful to have it in an easily reachable place to
quickly jump to wherever you need using your favorite code editor's
features.
2024-04-02 23:10:07 +02:00
Zebediah Figura
106cbc02de
vkd3d-shader/hlsl: Use hlsl_is_numeric_type() in type_has_object_components().
2024-04-02 23:09:38 +02:00
Zebediah Figura
54f2dfe403
vkd3d-shader/hlsl: Simplify type_has_object_components().
...
The extra argument is not very easy to intuit. Since all we're trying to do here is check whether the type is a struct with object components in it, write that out explicitly.
2024-04-02 23:09:36 +02:00
Zebediah Figura
1e7d82798c
vkd3d-shader/hlsl: Move a hlsl_fixme() to a more relevant place.
2024-04-02 23:09:35 +02:00
Zebediah Figura
675d7b8cb6
vkd3d-shader/hlsl: Remove a redundant type check.
...
We already perform an implicit cast per component in initialize_var_components().
2024-04-02 23:09:33 +02:00
Conor McCarthy
d72d5c35d1
vkd3d-shader/dxil: Implement DX intrinsics Dot2, Dot3 and Dot4.
2024-04-02 23:09:28 +02:00
Conor McCarthy
2909a5aacc
vkd3d-shader/dxil: Implement DX intrinsic MakeDouble.
2024-04-02 23:09:23 +02:00
Conor McCarthy
11ee92ed7e
vkd3d-shader/dxil: Implement DX intrinsic Discard.
2024-03-27 22:37:42 +01:00
Conor McCarthy
8d947ce868
vkd3d-shader/spirv: Support bool source in spirv_compiler_emit_discard().
2024-03-27 22:37:40 +01:00
Zebediah Figura
6b6e4bc212
vkd3d-shader: Add a compile option to control whether implicit truncation warnings are printed.
...
d3dcompiler and d3dx9 versions before 42 don't emit this error; this will be
necessary to emulate that behaviour.
Other warnings exist that are introduced in different d3dcompiler versions,
although there are not very many distinct HLSL warnings to begin with.
We could of course group all these together under a single compiler option, but
I find that using separate top-level options is unilaterally friendlier to an
API consumer, and simpler to implement as well. It also in some sense maps
conceptually to e.g. "-Wno-implicit-conversion".
2024-03-27 22:37:34 +01:00
Nikolay Sivov
b382d1843d
vkd3d-shader/fx: Accept texture types when writing fx_2_0 effects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:29 +01:00
Nikolay Sivov
b09f919673
vkd3d-shader/hlsl: Treat "texture" type name as case-insensitive.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:28 +01:00
Nikolay Sivov
17dc23269e
vkd3d-shader/fx: Handle "uint" type for fx_2_0 parameters.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:27 +01:00
Nikolay Sivov
9117629e35
vkd3d-shader/fx: Handle "half" type for fx_2_0 parameters.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:25 +01:00
Nikolay Sivov
88d9cff407
vkd3d-shader/fx: Set initial object count to 1 for fx_2_0.
...
This is used for the object table at runtime. Object variable index is 1-based.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:24 +01:00
Nikolay Sivov
501aed43f3
vkd3d-shader/fx: Zero-pad strings when aligning them for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:23 +01:00
Nikolay Sivov
228d54efff
vkd3d-shader/fx: Mark shared variables as such for fx_2_0 effects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-27 22:37:21 +01:00
Francisco Casas
11e7265815
vkd3d-shader/spirv: Throw compiler error on unrecognized register.
...
This codepath path is currently triggered when transpiling d3dbc shaders
that use vPos (or other of these special registers).
While vPos gets added to the input signature and gets assigned an INPUT
register, the registers in the shader instructions are still of
VKD3DSPR_MISCTYPE type and are not propperly mapped yet. This gives
invalid results.
Some SM1 tests must be set back to "todo" but they only work because, by
coincidence, we are assigning vPos the input register with index 0.
Propper mapping of these registers is still required.
2024-03-27 22:37:15 +01:00
Zebediah Figura
172cb75872
vkd3d-shader/spirv: Implement VKD3DSIH_ABS.
2024-03-27 22:37:10 +01:00
Francisco Casas
9a222d2be1
vkd3d-shader/d3dbc: Implement HLSL_OP2_LOGIC_AND for SM1.
2024-03-27 22:37:09 +01:00
Francisco Casas
777bf772bf
vkd3d-shader/d3dbc: Implement HLSL_OP2_LOGIC_OR for SM1.
2024-03-27 22:37:08 +01:00
Francisco Casas
a838f97e3f
vkd3d-shader/hlsl: Cast to bool before applying LOGIC_NOT.
...
Before this commit, it is possible for one of the tests of
cf-cond-types.shader_test to pass a non-bool to LOGIC_NOT, which should
not be allowed.
2024-03-27 22:37:07 +01:00
Francisco Casas
ee5fc7e968
vkd3d-shader/hlsl: Support LOGIC_NOT for SM1.
2024-03-27 22:37:06 +01:00
Conor McCarthy
68b31b7396
vkd3d-shader/spirv: Handle the sequentially consistent ordering flag for atomic instructions.
2024-03-27 22:37:01 +01:00
Conor McCarthy
a8dd788f41
vkd3d-shader/spirv: Emit a warning if the atomic instruction volatile flag is unhandled.
2024-03-27 22:37:00 +01:00
Conor McCarthy
9e0b9c3a7a
vkd3d-shader/dxil: Implement the DXIL ATOMICRMW instruction.
2024-03-27 22:36:59 +01:00
Conor McCarthy
b708a9b3b5
vkd3d-shader/dxil: Implement DX instructions ThreadId, GroupId, ThreadIdInGroup and FlattenedThreadIdInGroup.
2024-03-27 22:36:58 +01:00
Conor McCarthy
0f332eb939
vkd3d-shader/dxil: Emit an error if a constant code is unhandled.
2024-03-27 22:36:56 +01:00
Conor McCarthy
47e56cdfed
vkd3d-shader/spirv: Support 64-bit register info component type in spirv_compiler_emit_load_reg().
...
For 64-bit indexable temps (and any other 64-bit declarations) the write
mask must not be converted.
2024-03-27 22:36:55 +01:00
Conor McCarthy
83a67366da
vkd3d-shader/spirv: Do not assert if a TGSM store data register is not UINT.
2024-03-27 22:36:54 +01:00
Conor McCarthy
9da375414e
vkd3d-shader/spirv: Do not assert if a TGSM load dst register is not UINT.
2024-03-27 22:36:52 +01:00
Zebediah Figura
2247288003
vkd3d-shader/tpf: Set the user-packed flag for sm5.0 resources as well.
2024-03-27 22:36:39 +01:00
Zebediah Figura
7b87895289
vkd3d-shader/tpf: Write the component count as the column count for structs.
2024-03-27 22:36:37 +01:00
Zebediah Figura
5bf23cb2f5
vkd3d-shader/tpf: Explicitly write the class and base type for non-numeric types.
...
Avoid relying on that information being stored in the hlsl_type.
2024-03-27 22:36:36 +01:00
Zebediah Figura
34e9c101e8
vkd3d-shader/tpf: Do not write structs with no numeric fields into the RDEF.
2024-03-27 22:36:35 +01:00
Zebediah Figura
0b1f11dd33
vkd3d-shader/hlsl: Allocate register reservations for structs as well.
2024-03-27 22:36:34 +01:00
Zebediah Figura
622fcda9ee
vkd3d-shader/tpf: Do not write non-numeric struct fields into the RDEF.
2024-03-27 22:36:33 +01:00
Henri Verbeet
5de5f241a6
vkd3d-shader/ir: Pass a struct vsir_program to vkd3d_shader_normalise().
2024-03-19 22:57:56 +01:00
Henri Verbeet
164608a007
vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_dst_param().
2024-03-18 23:08:03 +01:00
Henri Verbeet
e2d1a878a7
vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_src_param().
2024-03-18 23:08:02 +01:00
Henri Verbeet
939a7fbe88
vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_tessellator_partitioning().
2024-03-18 23:08:01 +01:00
Henri Verbeet
5f5145b8f8
vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_tessellator_output_primitive().
2024-03-18 23:08:00 +01:00
Henri Verbeet
f61a92b908
vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_tessellator_domain().
2024-03-18 23:07:58 +01:00
Henri Verbeet
b98171878f
vkd3d-shader/glsl: Keep track of the current indentation level.
2024-03-18 23:07:52 +01:00
Giovanni Mascellani
e5f486edd3
vkd3d-shader/ir: Use type "unused" for labels.
...
The label itself is certainly an unsigned integer, but the register
has no meaningful data type. It cannot be evaluated to anything.
The goal of this is to reduce cluttering in the internal ASM dumps.
2024-03-18 23:07:45 +01:00
Giovanni Mascellani
d418f49888
vkd3d-shader/d3d-asm: Do not dump a register's type if it's unused.
2024-03-18 23:07:44 +01:00
Giovanni Mascellani
22d19aed58
vkd3d-shader/d3d-asm: Indent instructions inside a block.
2024-03-18 23:07:43 +01:00
Conor McCarthy
0c01a55c7d
vkd3d-shader/dxil: Implement DX intrinsic Saturate.
2024-03-18 23:07:40 +01:00
Conor McCarthy
4599d3c1cf
vkd3d-shader/dxil: Implement DX intrinsic FAbs.
2024-03-18 23:07:39 +01:00
Conor McCarthy
33694f08fc
vkd3d-shader/dxil: Implement DX intrinsics FMa, FMad, IMad and UMad.
2024-03-18 23:07:38 +01:00
Conor McCarthy
421d311a49
vkd3d-shader/spirv: Use dst register data type in spirv_compiler_emit_imad().
2024-03-18 23:07:36 +01:00
Nikolay Sivov
f55b152811
vkd3d-shader/fx: Fail effect writing on unsupported annotations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:32 +01:00
Nikolay Sivov
206eeb0752
vkd3d-shader/fx: Remove newlines from fixme messages.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:31 +01:00
Nikolay Sivov
4fc15d4b4a
vkd3d-shader/fx: Add initial support for writing fx_2_0 parameters.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:30 +01:00
Nikolay Sivov
ed06e0bbef
vkd3d-shader/fx: Populate global variables list during context initialization.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:29 +01:00
Nikolay Sivov
ea686e8f5a
vkd3d-shader/fx: Fix an instruction block leak.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:28 +01:00
Nikolay Sivov
9c7fe62da6
vkd3d-shader/fx: Use type writing helper only for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:27 +01:00
Conor McCarthy
3f99719ff2
vkd3d-shader/dxil: Implement DX intrinsic BufferUpdateCounter.
2024-03-18 23:07:23 +01:00
Giovanni Mascellani
8c15377ffc
vkd3d-shader/ir: Emit multilevel jumps in the structured program.
...
The new structurizer therefore reaches feature parity with the
older simple one, except for a couple of points:
* the old structurizer accepts any CFG, without requiring reducibility;
however, the DXIL specification requires the CFG to be reducible
anyway, so we're not really losing anything;
* the new structurizer additionally requires that no block has two
incoming back arrows; AFAIK this is condition that can happen,
but in practice it seems to be rare; also, it's not hard to add
support for it, as soon as it is decided it is useful.
On the other hand, the new structurizer makes use of the merging
information that are reconstructed from the CFG, which is important
for downstream optimization and fundamental for correctly emitting
tangled instructions.
Taking these considerations into account, the old structurizer is
considered superseded and is therefore removed.
2024-03-18 23:07:17 +01:00
Giovanni Mascellani
c2aa01de6e
vkd3d-shader/ir: Emit the reconstructed structured program.
...
Multilevel jumps are not supported yet, and trigger a fallback to the
simple structurizer.
2024-03-18 23:07:15 +01:00
Henri Verbeet
abf76372e0
vkd3d-shader/ir: Pass a struct vsir_program to vsir_validate().
2024-03-14 23:24:29 +01:00
Henri Verbeet
7af3e9300f
vkd3d-shader/ir: Pass a struct vsir_program to flatten_control_flow_constructs().
2024-03-14 23:24:28 +01:00
Henri Verbeet
268989f5b9
vkd3d-shader/ir: Pass a struct vsir_program to normalise_combined_samplers().
2024-03-14 23:24:27 +01:00
Henri Verbeet
674bebe9c9
vkd3d-shader/ir: Pass a struct vsir_program to shader_normalise_io_registers().
2024-03-14 23:24:24 +01:00
Henri Verbeet
8a60814476
vkd3d-shader/glsl: Generate comments for unhandled instructions.
...
Mostly for debugging purposes; we'll fail compilation, but will still trace
the shader that would have been generated.
2024-03-14 23:24:19 +01:00
Henri Verbeet
9869fbb0ea
vkd3d-shader/glsl: Trace the generated shader.
...
Even if compilation ultimately failed.
2024-03-14 23:24:16 +01:00
Francisco Casas
619edb4c38
vkd3d-shader/hlsl: Lower CMP instructions for vertex shaders.
2024-03-14 22:49:29 +01:00
Francisco Casas
4c40deaac1
vkd3d-shader/hlsl: Use hlsl_fixme() on missing SM1 matrix writemask lowering.
...
Instead of FIXME(). Otherwise we compile invalid d3dbc.
2024-03-14 22:49:29 +01:00
Francisco Casas
5c986b9cde
vkd3d-shader/hlsl: Lower SLT instructions for pixel shaders.
...
Properly passing the inverse-trig.shader_test tests whose qualifiers
have been removed requires making spirv.c capable of handling ABS.
The same happens for the ps_3_0 equality test in
float-comparison.shader_test.
2024-03-14 22:49:29 +01:00
Francisco Casas
e9a4758648
vkd3d-shader/hlsl: Implement SM1 comparison operators.
2024-03-14 22:49:29 +01:00
Francisco Casas
7b883eef53
vkd3d-shader/d3dbc: Check profiles before writing SLT and CMP.
2024-03-14 22:48:56 +01:00
Giovanni Mascellani
d75dc76011
vkd3d-shader/ir: Dump the reconstructed structured program.
2024-03-14 22:48:53 +01:00
Giovanni Mascellani
2b3e21caeb
vkd3d-shader/ir: Add jumps to the structured programs.
2024-03-14 22:48:52 +01:00
Giovanni Mascellani
c25e4c47c3
vkd3d-shader/ir: Reconstruct a structured program.
...
For simplicity jumps are not currently processed.
2024-03-14 22:48:50 +01:00
Conor McCarthy
f08976be33
vkd3d-shader/dxil: Implement DX instruction Barrier.
2024-03-14 22:48:46 +01:00
Conor McCarthy
b22632ff1a
vkd3d-shader/spirv: Emit a trace message if TGSM alignment is ignored.
...
This would cause a lot of warning spam if it was a warning.
2024-03-14 22:48:45 +01:00
Conor McCarthy
5e63164d01
vkd3d-shader/dxil: Implement structured groupshared address space global variables.
2024-03-14 22:48:44 +01:00
Conor McCarthy
0965a3608a
vkd3d-shader/dxil: Implement raw groupshared address space global variables.
2024-03-14 22:48:43 +01:00
Conor McCarthy
6dd54eeb09
vkd3d-shader/spirv: Support zero-initialisation for workgroup memory.
2024-03-14 22:48:41 +01:00
Henri Verbeet
374c5fcbdd
vkd3d-shader/glsl: Store a pointer to the vsir program in struct vkd3d_glsl_generator.
2024-03-13 22:00:48 +01:00
Henri Verbeet
5f1f7ababb
vkd3d-shader/ir: Pass a struct vsir_program to remap_output_signature().
2024-03-13 22:00:42 +01:00
Henri Verbeet
0edf6d25f3
vkd3d-shader/ir: Pass a struct vsir_program to simple_structurizer_run().
2024-03-13 22:00:41 +01:00
Henri Verbeet
c3f3cb5ef9
vkd3d-shader/ir: Pass a struct vsir_program to materialize_ssas_to_temps().
2024-03-13 22:00:40 +01:00
Henri Verbeet
76791913d0
vkd3d-shader/ir: Pass a struct vsir_program to materialize_ssas_to_temps_process_reg().
2024-03-13 22:00:39 +01:00
Henri Verbeet
343a365c97
vkd3d-shader/ir: Pass a struct vsir_program to instruction_array_lower_texkills().
2024-03-13 22:00:37 +01:00
Conor McCarthy
0dc174ebd7
vkd3d-shader/spirv: Emit an error if a FIRSTBIT instruction has a 64-bit source.
2024-03-13 21:50:37 +01:00
Conor McCarthy
a64eb75c1d
vkd3d-shader/spirv: Emit an error if COUNTBITS has a 64-bit source.
2024-03-13 21:50:36 +01:00
Henri Verbeet
9b0d304f8f
vkd3d-shader/glsl: Introduce glsl_compile().
2024-03-12 22:15:41 +01:00
Henri Verbeet
bdc096d437
vkd3d-shader/d3d-asm: Get rid of the (now) redundant "shader_desc" parameter to vkd3d_dxbc_binary_to_text().
...
And rename the function to d3d_asm_compile() while we're touching it.
2024-03-12 22:15:34 +01:00
Nikolay Sivov
948cd2154a
vkd3d-shader/fx: Handle 'single' modifier for buffers.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Nikolay Sivov
e0ef45c0a3
vkd3d-shader: Parse a 'single' modifier.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Nikolay Sivov
cf7c05f431
vkd3d-shader: Remove a token for 'precise' modifier.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Giovanni Mascellani
f2b2040ff6
vkd3d-shader/ir: Sort loop intervals.
2024-03-12 22:14:47 +01:00
Giovanni Mascellani
070c4af8b3
vkd3d-shader/ir: Generate synthetic intervals for forward edges.
2024-03-12 22:14:46 +01:00
Giovanni Mascellani
1d60612340
vkd3d-shader/ir: Compute loop as intervals of the block order.
2024-03-12 22:14:45 +01:00
Nikolay Sivov
30cc6ceb44
vkd3d-shader/fx: Add support for writing shared object descriptions for fx_4_x.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:41 +01:00
Nikolay Sivov
13227f3852
vkd3d-shader: Add an option to enable child effects compilation.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:41 +01:00
Nikolay Sivov
7f1fdd447c
vkd3d-shader/fx: Add initial support for writing uninitialized vertex/pixel shader objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:40 +01:00
Henri Verbeet
038764985a
vkd3d-shader/glsl: Use location information from the current instruction.
2024-03-11 22:10:21 +01:00
Conor McCarthy
4f0e5b9069
vkd3d-shader/dxil: Support 16-bit types.
2024-03-11 22:10:06 +01:00
Conor McCarthy
066ea75945
vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
...
Minimum precision types must always be implemented as 32-bit to match how
reduced precision works in SPIR-V.
2024-03-11 22:10:05 +01:00
Conor McCarthy
58123c2e10
vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
2024-03-11 22:10:03 +01:00
Nikolay Sivov
25d353db91
vkd3d-shader/d3dbc: Do not write semantic declarations for unused variables.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55829
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56402
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-11 22:09:55 +01:00
Zebediah Figura
ad495970e0
vkd3d-shader/spirv: Implement SLT and SGE.
2024-03-11 22:09:48 +01:00
Zebediah Figura
27196d8b0f
vkd3d-shader/spirv: Implement CMP.
2024-03-11 22:09:44 +01:00
Francisco Casas
cfac67ccc2
vkd3d-shader/hlsl: Cast slt before multiplying on ternary operator.
...
Otherwise we may get a failing
"hlsl_types_are_equal(arg1->data_type, arg2->data_type)"
assertion on hlsl_new_binary_expr() when creating the MUL.
This happens in the test introducing in the following patch:
int a, b, c;
void main(out float4 res : COLOR1, in float4 pos : position, out float4 out_pos : sv_position)
{
out_pos = pos;
res = a ? b/1000.0 : c/1000.0;
}
2024-03-11 22:09:42 +01:00
Giovanni Mascellani
1690b0b554
vkd3d-shader: Remove the bytecode fields from vkd3d_shader_desc.
2024-03-11 22:09:32 +01:00
Giovanni Mascellani
204c8afb9c
vkd3d-shader/dxbc: Remove flag is_dxil.
...
The full shader profile is already available in vsir_program.
2024-03-11 22:09:31 +01:00
Giovanni Mascellani
470d83a9da
vkd3d-shader: Move shader signatures to vsir_program.
2024-03-11 22:09:31 +01:00
Giovanni Mascellani
56dc0c9842
vkd3d-shader/dxbc: Decouple vkd3d_shader_desc from DXBC parsing.
2024-03-11 22:09:30 +01:00
Giovanni Mascellani
5204b92fa0
vkd3d-shader/tpf: Remove a useless parameter to shader_sm4_init().
2024-03-11 22:09:28 +01:00
Conor McCarthy
7b4b0143bd
vkd3d-shader/dxil: Implement DX intrinsic TextureGatherCmp.
2024-03-11 22:09:20 +01:00
Conor McCarthy
5a6fd010ac
vkd3d-shader/dxil: Implement DX intrinsic TextureGather.
2024-03-11 22:09:18 +01:00
Giovanni Mascellani
75bc68962d
vkd3d-shader/dxbc: Add flag to ignore the DXBC checksum.
2024-03-11 22:08:55 +01:00
Giovanni Mascellani
23259263cf
vkd3d-shader/d3d-asm: Only emit signatures for SM4-6.
2024-03-08 23:36:44 +01:00
Henri Verbeet
1fc55d80cd
vkd3d-shader: Enable GLSL target support when VKD3D_SHADER_UNSUPPORTED_GLSL is defined.
2024-03-08 23:36:40 +01:00
Evan Tang
4553b2a0dc
vkd3d-shader/spirv: Implement support for rasteriser-ordered views.
...
Using SPV_EXT_fragment_shader_interlock.
2024-03-08 23:36:35 +01:00
Giovanni Mascellani
21f76257b0
vkd3d-shader/d3d-asm: Print labels in red.
...
They are substantially different from any other register type, so
it makes sense to have them stand out. Also, they help segmenting
visually the code into blocks, because labels are usually found
either at the beginning or at the end of a block.
2024-03-08 23:36:25 +01:00
Conor McCarthy
e65055b435
vkd3d-shader/spirv: Handle the ORD and UNO instructions.
2024-03-08 23:36:14 +01:00
Conor McCarthy
f212aad0ff
vkd3d-shader/dxil: Support FCMP_ORD and FCMP_UNO for CMP2.
2024-03-08 23:36:13 +01:00
Giovanni Mascellani
172e7edf2d
vkd3d-shader: Refactor common code for vkd3d_shader_compile().
2024-03-08 23:35:54 +01:00
Giovanni Mascellani
0e5d6a97cc
vkd3d-shader: Refactor common code for vkd3d_shader_scan().
2024-03-08 23:35:54 +01:00
Giovanni Mascellani
bbd37a76fc
vkd3d-shader: Treat the HLSL case specially in vkd3d_shader_compile().
2024-03-08 23:35:54 +01:00
Giovanni Mascellani
3a1c32acd4
vkd3d-shader: Treat the HLSL case specially in vkd3d_shader_scan().
...
The other cases are similar and common code can be refactored.
Ideally the HLSL parser will eventually fit the same model, but that
will require more extensive work.
2024-03-08 23:35:53 +01:00
Giovanni Mascellani
b940d79aa8
vkd3d-shader/ir: Keep loops contiguous in the topological sort.
2024-03-08 23:35:48 +01:00
Giovanni Mascellani
cf9a023566
vkd3d-shader/ir: Dump the topological order of the control flow graph.
2024-03-08 23:35:47 +01:00
Giovanni Mascellani
ed40646c8a
vkd3d-shader/ir: Topologically sort the control flow graph.
2024-03-08 23:35:46 +01:00
Giovanni Mascellani
880d781b57
vkd3d-shader/ir: Allow adding to a block list without checking for duplicates.
2024-03-08 23:35:45 +01:00
Nikolay Sivov
75c019074a
vkd3d-shader/hlsl: Allow modifiers on buffer declarations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-08 23:35:40 +01:00
Nikolay Sivov
b13d60d805
vkd3d-shader/hlsl: Add determinant() function.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-08 23:35:23 +01:00
Giovanni Mascellani
8723b5d266
vkd3d-shader/ir: Sort each loop by block label.
2024-03-07 23:08:36 +01:00
Giovanni Mascellani
3d4092d9dc
vkd3d-shader/ir: Dump the loops in the control flow graph.
2024-03-07 23:08:35 +01:00
Giovanni Mascellani
8241ca2b67
vkd3d-shader/ir: Keep track of loops by header block.
2024-03-07 23:08:34 +01:00
Giovanni Mascellani
088a6c49a2
vkd3d-shader/ir: Keep a reference to the message context inside struct vsir_cfg.
2024-03-07 23:08:33 +01:00
Giovanni Mascellani
9ac842b36b
vkd3d-shader/ir: Compute the loops in the control flow graph.
2024-03-07 23:08:32 +01:00
Giovanni Mascellani
de15f55477
vkd3d-shader/ir: Introduce a helper to express block domination.
2024-03-07 23:08:31 +01:00
Giovanni Mascellani
c3657c4799
vkd3d-shader/ir: Add a debug buffer to struct vsir_cfg.
2024-03-07 23:08:30 +01:00
Giovanni Mascellani
c5893288d9
vkd3d-shader/ir: Properly handle function-local indexable temps when flattening control flow.
...
They have to be considered code rather than declarations, as required
for instance by the SPIR-V backend.
2024-03-07 23:08:28 +01:00
Giovanni Mascellani
9aa86901e3
vkd3d-shader/d3d-asm: Support emitting the shader signature.
2024-03-07 23:08:24 +01:00
Giovanni Mascellani
01a687a7fc
vkd3d-shader/d3d-asm: Refactor dumping a write mask to a dedicated function.
2024-03-07 23:08:23 +01:00
Giovanni Mascellani
9d99389663
vkd3d-shader/d3d-asm: Describe the ASM dialect with a bunch of flags instead of a plain enum.
2024-03-07 23:08:22 +01:00
Giovanni Mascellani
94d641783b
vkd3d-shader/d3d-asm: Do not make a copy of the buffer before returning it.
2024-03-07 23:08:20 +01:00
Nikolay Sivov
a0d52dc385
vkd3d-shader/hlsl: Improve VertexShader/PixelShader types handling.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:04:25 +01:00
Nikolay Sivov
437ef0896f
vkd3d-shader/fx: Make sure to set error message for unimplemented cases.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:04:22 +01:00
Nikolay Sivov
8c5db57ea7
vkd3d-shader/fx: Reject fx_2_0 output without techniques.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:04:19 +01:00
Nikolay Sivov
dd5e42d347
vkd3d-shader/hlsl: Allow technique10 {} blocks for fx_2_0.
...
Such techniques are ignored later, but do not cause compilation errors.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:04:18 +01:00
Nikolay Sivov
5edbccd33b
vkd3d-shader/hlsl: Add keyword tokens for fx_5_0 shader object types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:04:16 +01:00
Conor McCarthy
5082893e5d
vkd3d-shader/spirv: Always use a 64-bit write mask for IMMCONST64 src params.
...
There is no way to tell in spirv_compiler_emit_load_reg() if the write
mask is 64-bit. All loads are 32-bit except for IMMCONST64 and SSA, and
the latter ignores the mask, so the only issue lies with IMMCONST64.
2024-03-06 23:04:12 +01:00
Francisco Casas
58c456ff2b
vkd3d-shader/d3dbc: Implement bool to float cast as MOV.
...
In SM1, bools are always represented as either 0.0f or 1.0f at runtime.
2024-03-06 23:04:07 +01:00
Francisco Casas
747511131d
vkd3d-shader/hlsl: Lower non-float operators for SM1.
2024-03-06 23:04:05 +01:00
Francisco Casas
a3319339e4
vkd3d-shader/hlsl: Lower casts to int using REINTERPRET instead.
...
I realized that it is better to lower casts to int to FLOOR+REINTERPET
instead of appending a FLOOR to all casts to int and assuming that this
is the case for all of them in d3dbc.c.
This in case we introduce new passes in the future that add casts that
we forget to lower, after the lower_casts_to_bool pass.
2024-03-06 23:04:04 +01:00
Nikolay Sivov
937d76507d
vkd3d-shader/hlsl: Implement ternary operator for older vertex profiles.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56333
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:03:59 +01:00
Henri Verbeet
f866fb95ad
Release 1.11.
2024-03-05 20:39:45 +01:00
Zebediah Figura
9177df883e
vkd3d-shader/hlsl: Write the SFI0 section and "REQUIRES_ROVS" flag when ROVs are used.
2024-03-04 22:34:46 +01:00
Victor Chiletto
7e27ae73af
vkd3d-shader/hlsl: Fix hlsl_ir_resource_store::resource cleanup.
2024-02-26 23:03:51 +01:00
Conor McCarthy
c083b1d0fc
vkd3d-shader/dxil: Implement DX intrinsic GetDimensions.
2024-02-26 23:03:48 +01:00
Conor McCarthy
292bbdefbf
vkd3d-shader/dxil: Move the resource kind helper functions up.
2024-02-26 23:03:46 +01:00
Henri Verbeet
d65f331efc
configure: Build with -Wwrite-strings.
...
libs/vkd3d-shader/hlsl.c: In function ‘declare_predefined_types’:
libs/vkd3d-shader/hlsl.c:3408:10: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
{"technique", 9},
^~~~~~~~~~~
...
programs/vkd3d-compiler/main.c: In function ‘parse_formatting’:
programs/vkd3d-compiler/main.c:303:10: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
{"colour", VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR},
^~~~~~~~
...
macOS tigetstr() takes a non-const char *, so account for that as well.
2024-02-22 22:46:29 +01:00
Henri Verbeet
7029d821be
configure: Build with -Wtype-limits.
...
libs/vkd3d-shader/tpf.c: In function ‘write_sm4_unary_op_with_two_destinations’:
libs/vkd3d-shader/tpf.c:4489:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
assert(1 - dst_idx >= 0);
^~
libs/vkd3d-shader/tpf.c: In function ‘write_sm4_binary_op_with_two_destinations’:
libs/vkd3d-shader/tpf.c:4549:24: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
assert(1 - dst_idx >= 0);
^~
2024-02-22 22:46:22 +01:00
Conor McCarthy
ba4bd651e5
vkd3d-shader/dxil: Implement DX intrinsics SampleCmp and SampleCmpLevelZero.
2024-02-22 22:45:36 +01:00
Conor McCarthy
2330ffdeda
vkd3d-shader/dxil: Implement DX intrinsics SampleBias and SampleLevel.
2024-02-22 22:45:34 +01:00
Zebediah Figura
87b1de94da
vkd3d-shader/hlsl: Check the resource format for UAVs also in hlsl_types_are_equal().
...
Spotted by Henri Verbeet.
2024-02-22 22:45:31 +01:00
Nikolay Sivov
5474d91804
vkd3d-shader/fx: Write DepthStencilView types.
2024-02-22 22:45:27 +01:00
Nikolay Sivov
371be3b60a
vkd3d-shader/hlsl: Add DepthStencilView object type.
2024-02-22 22:45:26 +01:00
Nikolay Sivov
9632adaaec
vkd3d-shader/fx: Handle fx_4+ UAV types.
2024-02-22 22:45:24 +01:00
Nikolay Sivov
e5f4f60214
vkd3d-shader/fx: Handle fx_4+ texture types.
2024-02-22 22:45:23 +01:00
Nikolay Sivov
a6057a1365
vkd3d-shader/fx: Add initial support for writing object variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-22 22:45:22 +01:00
Nikolay Sivov
c2b1714c5c
vkd3d-shader/hlsl: Add RenderTargetView object type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-22 22:45:21 +01:00
Giovanni Mascellani
9c678532a7
vkd3d-shader/ir: Dump the domination relationship.
2024-02-22 22:45:16 +01:00
Giovanni Mascellani
04c2852c1a
vkd3d-shader/ir: Compute the domination relationship.
2024-02-22 22:45:15 +01:00
Giovanni Mascellani
2573d86ccf
vkd3d-shader/ir: Dump the control flow graph in the GraphViz format.
2024-02-22 22:45:14 +01:00
Giovanni Mascellani
da037b61ba
vkd3d-shader/ir: Build a representation of the control flow graph.
2024-02-22 22:45:13 +01:00
Conor McCarthy
1dffc281c9
vkd3d-shader/dxil: Implement DX intrinsic RawBufferStore.
2024-02-22 22:45:08 +01:00
Conor McCarthy
cab8b781ab
vkd3d-shader/dxil: Handle raw and structured buffers in sm6_parser_emit_dx_buffer_store().
2024-02-22 22:45:07 +01:00
Conor McCarthy
ce1875c435
vkd3d-shader/dxil: Implement DX intrinsic BufferStore.
2024-02-22 22:45:06 +01:00
Petrichor Park
02a3667822
vkd3d-shader/hlsl: Implement atan and atan2.
...
Also narrows some more todos on the tests.
2024-02-21 23:23:13 +01:00
Petrichor Park
69294c290b
vkd3d-shader/hlsl: Implement acos and asin trig intrinsics.
...
Tests have already been implemented in 92044d5e; this commit also reduces
the scope of some of the todos (because now they're implemented!).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55154
2024-02-21 23:23:11 +01:00
Henri Verbeet
d4223a03c8
vkd3d-shader/hlsl: Replace HLSL_MODIFIER_RASTERIZER_ORDERED with a hlsl_type.e.resource flag.
2024-02-21 23:23:08 +01:00
Henri Verbeet
49d14613a5
vkd3d-shader/hlsl: Introduce hlsl_type.e.resource.
2024-02-21 23:23:06 +01:00
Conor McCarthy
d9c68ee481
vkd3d-shader/dxil: Handle resource descriptor additional tag/value pairs.
...
These are tag/value pairs, and the current code only works if an element
type or element stride pair is present at index zero.
2024-02-20 22:50:19 +01:00
Conor McCarthy
96a0685ba6
vkd3d-shader/dxil: Implement DX intrinsic AtomicCompareExchange.
2024-02-20 22:50:16 +01:00
Conor McCarthy
560c9413c3
vkd3d-shader/dxil: Implement DX intrinsic AtomicBinOp.
2024-02-20 22:50:15 +01:00
Evan Tang
7b41abaa1b
vkd3d-shader/hlsl: Support SV_PrimitiveID in pixel shaders.
2024-02-19 21:12:23 +01:00
Francisco Casas
8df34fce62
vkd3d-shader/hlsl: Emit fixme on non-direct resource stores.
...
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
These may happen when storing to structured buffers, and we are not
handling them properly yet. The included test reaches unreacheable code
before this patch.
Storing to buffers is complicated since we need to split the index
chain in two paths:
- The path within the variable where the resource is.
- The subpath to the part of the resource element that is being stored
to.
For now, we will emit a fixme when the index chain in the lhs is not a
direct resource access.
2024-02-19 21:12:14 +01:00