Giovanni Mascellani
33972998a9
vkd3d-shader/ir: Validate the allowed data type and component count for SV_ClipDistance.
2024-10-14 19:39:12 +02:00
Giovanni Mascellani
0465549c9d
vkd3d-shader/ir: Validate the allowed signatures and stages for SV_ClipDistance.
2024-10-14 19:39:12 +02:00
Giovanni Mascellani
20b3a4c362
vkd3d-shader/ir: Validate the allowed data type and component count for SV_Position.
2024-10-14 19:39:12 +02:00
Giovanni Mascellani
962ce961d4
vkd3d-shader/ir: Validate the allowed signatures and stages for SV_Position.
2024-10-14 19:39:12 +02:00
Giovanni Mascellani
2d452842ed
vkd3d-shader/ir: Introduce a helper for validating MISCTYPE registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
15d8591a26
vkd3d-shader/ir: Introduce a helper for validating RASTOUT registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
7021a57193
vkd3d-shader/ir: Introduce a helper for validating UAV registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
c60eecbac8
vkd3d-shader/ir: Introduce a helper for validating RESOURCE registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
edbf7349bd
vkd3d-shader/ir: Introduce a helper for validating SAMPLER registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
52761e689b
vkd3d-shader/ir: Introduce a helper for validating registers without indices.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
ce638b9cca
vkd3d-shader/ir: Introduce a helper for validating LABEL registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
92d1ba9188
vkd3d-shader/ir: Introduce a helper for validating SSA registers.
2024-10-14 15:42:00 +02:00
Giovanni Mascellani
1c43b2e55f
vkd3d-shader/ir: Introduce a helper for validating TEMP registers.
2024-10-14 15:42:00 +02:00
Nikolay Sivov
35d2df14d8
vkd3d-shader/fx: Add support for tracing string variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-14 15:40:46 +02:00
Nikolay Sivov
907b6705fe
vkd3d-shader/fx: Add support for parsing constant buffer elements.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-14 15:40:14 +02:00
Nikolay Sivov
6801ad9b7a
vkd3d-shader/fx: Introduce a parser/disassembler.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-14 15:20:41 +02:00
Elizabeth Figura
1e3c1392bd
vkd3d-shader/ir: Allow controlling FFP point size clamping through vkd3d-shader parameters.
2024-10-10 22:44:26 +02:00
Elizabeth Figura
54092286be
vkd3d-shader/ir: Allow controlling FFP point size through a vkd3d-shader parameter.
2024-10-10 22:25:09 +02:00
Elizabeth Figura
6ee17cf77e
vkd3d-shader/spirv: Implement shader point size.
2024-10-10 22:14:45 +02:00
Elizabeth Figura
56e5fca501
vkd3d-shader/spirv: Always write the point size in vertex shaders.
...
Vulkan requires that point size be written.
There should be no backwards compatibility concern here, since the vertex shader
supplies point size with the lowest priority.
2024-10-10 21:50:30 +02:00
Giovanni Mascellani
f0e31dd6b3
vkd3d-shader/ir: Only allow PATCHCONST registers as destination parameteres in Hull Shaders.
2024-10-10 20:04:13 +02:00
Giovanni Mascellani
f2d181e65c
vkd3d-shader/ir: Only allow PATCHCONST registers as source parameteres in Hull and Domain Shaders.
2024-10-10 20:04:13 +02:00
Giovanni Mascellani
6cbe5ffa15
vkd3d-shader/ir: Disallow OUTPUT registers in source parameters.
2024-10-10 20:04:13 +02:00
Giovanni Mascellani
5b5a27dccb
vkd3d-shader/ir: Disallow INPUT registers in destination parameters.
2024-10-10 20:04:13 +02:00
Henri Verbeet
bf71b13797
vkd3d-shader/glsl: Implement support for compute shaders.
2024-10-10 20:00:45 +02:00
Henri Verbeet
fb17ba18ae
vkd3d-shader/glsl: Implement VKD3DSIH_STORE_UAV_TYPED.
2024-10-10 20:00:45 +02:00
Henri Verbeet
8e47ecbd92
vkd3d-shader/glsl: Use the semantic index for shader_out_* declarations.
...
Because that's what we use in shader_glsl_print_sysval_name(). Fragment
shaders like the ones from uav-rwtexture.shader_test that output to
sv_target1 would declare "shader_out_0", but then store to
"shader_out_1" in the epilogue.
2024-10-10 20:00:45 +02:00
Henri Verbeet
afb1a2610e
vkd3d-shader/glsl: Use VKD3D_SHADER_ERROR_GLSL_UNSUPPORTED for unsupported CBV descriptor arrays.
2024-10-10 20:00:45 +02:00
Henri Verbeet
845d6f9134
vkd3d-shader/ir: Remove VKD3DSIH_DCL_UAV_TYPED instructions.
2024-10-10 20:00:45 +02:00
Giovanni Mascellani
080f25c583
vkd3d-shader/ir: Do not search for signature elements using a scalar write mask.
...
The fallback code was added when shader_signature_find_element_for_reg()
would crash when unable to find the requested signature element.
Now it doesn't any more, and the second search is redundant.
2024-10-10 20:00:19 +02:00
Giovanni Mascellani
690c47dbf8
vkd3d-shader/ir: Validate that constant interpolation is used with integer types.
2024-10-10 19:58:00 +02:00
Giovanni Mascellani
e366fc3ad6
vkd3d-shader/ir: Validate interpolation mode in shader signatures.
2024-10-10 19:58:00 +02:00
Giovanni Mascellani
831a797837
vkd3d-shader/ir: Validate minimum precision in shader signatures.
2024-10-10 19:58:00 +02:00
Giovanni Mascellani
7b1bc5ca74
vkd3d-shader/ir: Validate component types in shader signatures.
2024-10-10 19:58:00 +02:00
Giovanni Mascellani
5034e1eeb5
vkd3d-shader/ir: Validate system value semantics in shader signatures.
2024-10-10 19:58:00 +02:00
Giovanni Mascellani
6e14d7ab90
vkd3d-shader/ir: Validate usage masks in shader signatures.
2024-10-10 19:58:00 +02:00
Giovanni Mascellani
71dccc0132
vkd3d-shader/ir: Do not emit an instruction number before starting validating instructions.
2024-10-10 19:58:00 +02:00
Feifan He
ccc48291b3
vkd3d-shader/msl: Implement support for VKD3DSPR_OUTPUT registers.
2024-10-10 19:45:34 +02:00
Feifan He
48a2207511
vkd3d-shader/msl: Implement support for VKD3DSPR_INPUT registers.
2024-10-10 19:43:12 +02:00
Feifan He
75e0cde045
vkd3d-shader/msl: Implement support for VKD3DSPR_CONSTBUFFER registers.
2024-10-10 19:41:31 +02:00
Feifan He
2d7832e738
vkd3d-shader/msl: Generate shader descriptor structure declarations.
2024-10-10 19:40:34 +02:00
Giovanni Mascellani
9cb4207c92
vkd3d-shader/spirv: Write spirv_compiler_emit_variable() in terms of spirv_compiler_emit_array_variable().
...
Essentially for code clarity, so that it's more obvious that a
non-array variable is indeed an array variable with no indices.
2024-10-09 13:15:25 +02:00
Henri Verbeet
aba45d0386
vkd3d-shader/glsl: Implement VKD3DSIH_CONTINUE.
2024-10-09 13:14:31 +02:00
Henri Verbeet
bc4aacd21e
vkd3d-shader/glsl: Implement VKD3DSIH_ULT.
2024-10-09 13:14:31 +02:00
Henri Verbeet
27eb3c07ad
vkd3d-shader/glsl: Implement switches.
2024-10-09 13:14:31 +02:00
Henri Verbeet
93f1af721f
vkd3d-shader/glsl: Implement loops.
2024-10-09 13:14:31 +02:00
Henri Verbeet
790f35533b
vkd3d-shader/glsl: vkd3d-shader/glsl: Implement support for VKD3D_SHADER_COMPONENT_INT inputs.
2024-10-09 13:14:31 +02:00
Giovanni Mascellani
bb0e4506a6
vkd3d-shader/ir: Validate masks in shader signatures.
2024-10-09 13:13:00 +02:00
Giovanni Mascellani
c3b31b96e1
vkd3d-shader/ir: Validate register counts in patch constant signatures.
2024-10-09 13:13:00 +02:00
Giovanni Mascellani
a29270fa64
vkd3d-shader/ir: Validate register counts in output signatures.
2024-10-09 13:13:00 +02:00
Giovanni Mascellani
118f494de3
vkd3d-shader/ir: Validate register counts in input signatures.
2024-10-09 13:13:00 +02:00
Giovanni Mascellani
7202e6e2f3
vkd3d-shader/ir: Allow a patch constant signature only for Hull and Domain Shaders.
2024-10-09 13:13:00 +02:00
Giovanni Mascellani
16efb7c0c6
vkd3d-shader: Ignore the patch constant signature when it doesn't make sense.
2024-10-09 13:13:00 +02:00
Giovanni Mascellani
cd74461d6d
vkd3d-shader/ir: Set the signature sort indices in shader_signature_merge().
...
Since the sort index is just a convenience field it is more
appropriate to only set it where it is required, instead of
requiring all frontends and passes to retain sensible values for
it.
2024-10-08 22:05:38 +02:00
Giovanni Mascellani
c332adaa68
vkd3d-shader/d3d-asm: Dump signatures when tracing a VSIR program.
2024-10-08 22:04:59 +02:00
Giovanni Mascellani
c7d09bba97
vkd3d-shader/d3d-asm: Rename dump_signatures() to dump_dxbc_signatures().
2024-10-08 22:04:59 +02:00
Giovanni Mascellani
b21ae8d9c2
vkd3d-shader/d3d-asm: Rename dump_signature() to dump_dxbc_signature().
...
To stress the fact that only the fields that appear in the DXBC
signature sections are considered.
2024-10-08 22:04:59 +02:00
Giovanni Mascellani
1256b4f862
vkd3d-shader/d3d-asm: Rename vkd3d_shader_trace() to vsir_program_trace().
2024-10-08 22:04:59 +02:00
Giovanni Mascellani
3428ed7a64
vkd3d-shader/dxil: Emit double arithmetic operations when appropriate.
2024-10-08 22:04:32 +02:00
Henri Verbeet
cf92d9f398
vkd3d-shader/ir: Store the thread group size in struct vsir_program.
2024-10-08 22:03:05 +02:00
Henri Verbeet
fc8384462f
vkd3d-shader/glsl: Implement VKD3DSIH_IMAX.
2024-10-08 22:01:56 +02:00
Henri Verbeet
c2a42214ff
vkd3d-shader/glsl: Implement VKD3DSIH_INEG.
2024-10-08 22:01:56 +02:00
Henri Verbeet
e55bc76fd2
vkd3d-shader/glsl: Implement support for VKD3D_SHADER_COMPONENT_UINT inputs.
2024-10-08 22:01:56 +02:00
Henri Verbeet
0acebd6e09
vkd3d-shader/glsl: Implement support for VKD3D_SHADER_COMPONENT_UINT outputs.
2024-10-08 22:01:56 +02:00
Henri Verbeet
95a46fb0f0
vkd3d-shader/glsl: Handle SV_POSITION inputs in fragment shaders.
2024-10-08 22:01:56 +02:00
Evan Tang
c571a45e65
vkd3d-shader/ir: Don't shift register write masks by the component index in shader_dst_param_io_normalise().
...
This loses information about which source elements they want, making
"o.yzw = reg.xxyz" compile to "o = reg.xxy" instead of "o = reg.xyz".
2024-10-07 17:36:11 +02:00
Evan Tang
b5ccc0e705
vkd3d-shader/ir: Remove an unnecessary typecast in shader_instruction_eliminate_phase_instance_id().
2024-10-07 17:34:54 +02:00
Elizabeth Figura
34fdb304bb
vkd3d-shader/hlsl: Handle error expressions in increments.
2024-10-07 17:33:07 +02:00
Elizabeth Figura
84685fb56d
vkd3d-shader/hlsl: Handle error expressions in subscripts.
2024-10-07 17:33:07 +02:00
Elizabeth Figura
c66f25016b
vkd3d-shader/hlsl: Handle error expressions in array indexes.
2024-10-07 17:33:07 +02:00
Elizabeth Figura
41ff4343e1
vkd3d-shader/hlsl: Handle error expressions in explicit casts.
2024-10-07 17:33:07 +02:00
Elizabeth Figura
10efdd3f63
vkd3d-shader/hlsl: Introduce an add_explicit_conversion() helper.
2024-10-07 17:33:07 +02:00
Elizabeth Figura
aa79bfa681
vkd3d-shader/preproc: Store argument values per expansion, not per macro.
2024-10-07 17:32:27 +02:00
Henri Verbeet
e7c4867359
vkd3d-shader/glsl: Implement support for VKD3DSPR_IDXTEMP registers.
2024-10-07 17:31:20 +02:00
Henri Verbeet
944929d0da
vkd3d-shader/glsl: Implement VKD3DSIH_IADD.
2024-10-07 17:31:20 +02:00
Henri Verbeet
4eed6b8887
vkd3d-shader/glsl: Add interpolation modifiers to interstage inputs and outputs.
2024-10-07 17:31:20 +02:00
Henri Verbeet
7b47528e4b
vkd3d-shader/glsl: Handle SV_VERTEX_ID inputs.
2024-10-07 17:31:20 +02:00
Henri Verbeet
79455041f0
vkd3d-shader/glsl: Implement VKD3DSIH_EQO.
2024-10-07 17:31:19 +02:00
Nikolay Sivov
d1c2ae3f0e
vkd3d-shader/hlsl: Remove the type equality assertion for binary expression arguments.
2024-10-07 17:29:40 +02:00
Francisco Casas
0b989c9f37
vkd3d-shader/hlsl: Fix the conditions to discard default values.
...
Otherwise default_values for strings are lost.
Thanks to Nikolay Sivov for pointing this out.
2024-10-07 17:28:07 +02:00
Feifan He
b7314e2438
vkd3d-shader/msl: Handle signature element masks in the prologue and epilogue.
2024-10-07 17:21:52 +02:00
Feifan He
7c42da465a
vkd3d-shader/msl: Generate the shader entry point prologue.
2024-10-07 17:21:52 +02:00
Feifan He
cd070f9995
vkd3d-shader/msl: Generate the shader entry point epilogue.
2024-10-07 17:21:52 +02:00
Feifan He
a88f3168e5
vkd3d-shader/msl: Generate the shader entry point.
2024-10-07 17:21:52 +02:00
Feifan He
577cc47740
vkd3d-shader/msl: Generate shader input structure declarations.
2024-10-07 17:21:52 +02:00
Feifan He
cd5917c648
vkd3d-shader/msl: Generate shader output structure declarations.
2024-10-07 17:21:27 +02:00
Henri Verbeet
25232f2b2b
vkd3d-shader/glsl: Implement VKD3DSIH_IMUL.
2024-10-03 19:20:14 +02:00
Henri Verbeet
4dec4e9959
vkd3d-shader/glsl: Implement VKD3DSIH_ILT.
2024-10-03 19:18:15 +02:00
Henri Verbeet
68492e704f
vkd3d-shader/glsl: Implement VKD3DSIH_IGE.
2024-10-03 19:15:48 +02:00
Henri Verbeet
cf6a3ad676
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE.
2024-10-03 19:15:48 +02:00
Henri Verbeet
eb10f0897e
vkd3d-shader/glsl: Implement VKD3DSIH_LD.
2024-10-03 19:14:43 +02:00
Giovanni Mascellani
0e50825b83
vkd3d-shader/ir: Validate indices for UAV registers.
2024-10-03 19:08:33 +02:00
Giovanni Mascellani
3ab68c1e46
vkd3d-shader/ir: Validate indices for RESOURCE registers.
2024-10-03 19:08:33 +02:00
Giovanni Mascellani
ab23038367
vkd3d-shader/ir: Validate indices for SAMPLER registers.
2024-10-03 19:08:33 +02:00
Giovanni Mascellani
da7c9694f1
vkd3d-shader/dxil: Emit SAMPLER, UAV and RESOURCE registers with only 2 indices.
...
DXIL handles are used to represent descriptors. Currently they are
translated to registers of the appropriate type (depending on the
descriptor type) and three indices. The first two indices are used
to represent the descriptor itself (through its signature and array
index), and are filled when the handle itself is created. The last
index is used with constant buffers to address the data inside the
buffer itself, and it goes unused with other descriptor types.
As currently implemented, however, registers for descriptors other
than constant buffers are still created with three indices, even if
the last one is useless and set to -1. In the interest of creating
more sensible VSIR code, this is now removed: DXIL handles are
created with just two indices; a third one is added when accessing
constant buffers, and nothing is changed for other descriptor types.
2024-10-03 19:08:33 +02:00
Elizabeth Figura
cebe0a8b95
vkd3d-shader/hlsl: Handle error expressions in method calls.
2024-10-03 17:47:26 +02:00
Elizabeth Figura
600f90e8b0
vkd3d-shader/hlsl: Handle error expressions in assignments.
2024-10-03 17:47:26 +02:00
Elizabeth Figura
c94aa5e03c
vkd3d-shader/hlsl: Handle error expressions in binary expressions.
2024-10-03 17:47:26 +02:00
Elizabeth Figura
d6052bc31b
vkd3d-shader/hlsl: Handle error expressions in function calls.
2024-10-03 17:47:26 +02:00
Elizabeth Figura
5d52bef19d
vkd3d-shader/hlsl: Return an "error" expression when using an undeclared variable.
2024-10-03 17:47:26 +02:00
Elizabeth Figura
67093c5833
vkd3d-shader/hlsl: Free static initializers after functions.
...
We need users of a value to be freed before the value itself is.
Due to copy propagation or use of the pre-allocated error instruction,
static_initializers can contain values that will be used in function blocks.
2024-10-03 17:47:26 +02:00
Giovanni Mascellani
ae27fded1a
vkd3d-shader/spirv: Handle all possible destination modifiers.
...
Historically the SPIR-V backend was only fed by the TPF parser,
which only generates _sat destination modifiers. Now it is fed
by the D3DBC parser too (among others), so it mustn't assert on
other modifiers.
Modifier _pp can be trivially ignored. Modifier _centroid would
probably require some handling, but I'm not immediately sure of
what should happen and it doesn't look like a very urgent thing
anyway, so I'm degrading the assertion to FIXME().
2024-10-02 22:31:50 +02:00
Henri Verbeet
fc4c9b7a95
vkd3d-shader/glsl: Implement VKD3DSIH_USHR.
2024-10-02 22:30:58 +02:00
Henri Verbeet
babbf11d52
vkd3d-shader/glsl: Implement VKD3DSIH_ISHR.
2024-10-02 22:30:58 +02:00
Henri Verbeet
7f1c78f8e2
vkd3d-shader/glsl: Implement VKD3DSIH_ISHL.
2024-10-02 22:30:58 +02:00
Henri Verbeet
f501b8c661
vkd3d-shader/glsl: Implement VKD3DSIH_MAD.
2024-10-02 22:30:58 +02:00
Henri Verbeet
4103e76245
vkd3d-shader/glsl: Implement support for VKD3DSPDM_SATURATE modifiers.
2024-10-02 22:30:58 +02:00
Nikolay Sivov
79aa75e98f
vkd3d-shader/fx: Implement writing fx_2_0 object initializer data sections.
...
Object data is used for strings, textures, and shaders. Samplers are handled separately.
The section is a contigious stream of <id><size><object-data>, size field is used
to advance to the next <id> position.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:17:41 +02:00
Giovanni Mascellani
7e9dc8da97
vkd3d-shader/ir: Validate index count for MISCTYPE registers.
2024-10-02 22:12:47 +02:00
Giovanni Mascellani
99aebb1b31
vkd3d-shader/ir: Validate index count for RASTOUT registers.
2024-10-02 22:12:47 +02:00
Giovanni Mascellani
19d35d89cd
vkd3d-shader/ir: Validate index count for DEPTHOUTLE registers.
2024-10-02 22:12:47 +02:00
Giovanni Mascellani
6259832680
vkd3d-shader/ir: Validate index count for DEPTHOUTGE registers.
2024-10-02 22:12:47 +02:00
Giovanni Mascellani
c3757e6930
vkd3d-shader/ir: Validate index count for DEPTHOUT registers.
2024-10-02 22:12:47 +02:00
Giovanni Mascellani
53e35f2d76
vkd3d-shader/d3dbc: Do not emit indices for DEPTHOUT registers.
2024-10-02 22:11:48 +02:00
Francisco Casas
caa2a9d314
vkd3d-shader/hlsl: Parse sampler_state.
2024-10-02 22:07:34 +02:00
Francisco Casas
f47d523e0b
vkd3d-shader/hlsl: Process 'texture' as a valid stateblock lhs.
2024-10-02 22:07:34 +02:00
Nikolay Sivov
994e994231
vkd3d-shader/fx: Handle assignments with array RHS indexed with a constant or a single variable.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:05:46 +02:00
Nikolay Sivov
2722346ffb
vkd3d-shader/hlsl: Do not lower index expressions for effects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:05:24 +02:00
Elizabeth Figura
4400315c4b
vkd3d-shader: Allow controlling clip planes through vkd3d-shader parameters.
2024-10-02 21:49:54 +02:00
Elizabeth Figura
85b8503995
vkd3d-shader/ir: Remove newlines from some vkd3d_shader_error() calls.
2024-10-02 21:49:54 +02:00
Henri Verbeet
3452d126a8
vkd3d-shader/glsl: Implement VKD3DSIH_ELSE.
2024-10-01 17:29:48 +02:00
Henri Verbeet
01ba2ba6db
vkd3d-shader/glsl: Implement VKD3DSIH_NOT.
2024-10-01 17:29:48 +02:00
Henri Verbeet
1812258f37
vkd3d-shader/glsl: Implement VKD3DSIH_RSQ.
2024-10-01 17:29:48 +02:00
Henri Verbeet
5cf8562124
vkd3d-shader/glsl: Implement VKD3DSIH_MIN.
2024-10-01 17:29:48 +02:00
Henri Verbeet
4f054aed48
vkd3d-shader/glsl: Implement VKD3DSIH_MAX.
2024-10-01 17:29:48 +02:00
Victor Chiletto
2ea5f187f9
vkd3d-shader/hlsl: Allow cbuffer reservations to overlap if only one of them is allocated.
2024-10-01 17:28:41 +02:00
Nikolay Sivov
5e52ccbf3d
vkd3d-shader/hlsl: Move default values indexing fixup to the tpf writer stage.
...
The primary goal here is to move compilation profile type and version
check outside of a parsing stage. Default values for parameters were
never subjected to this fixup, and it does look tpf-specific, so moving
it where it belongs.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-01 17:27:12 +02:00
Giovanni Mascellani
6822f1fe6c
vkd3d-shader/dxil: Trace the program when validation fails after parsing.
2024-09-30 20:48:43 +02:00
Giovanni Mascellani
5f20103518
vkd3d-shader/d3dbc: Trace the program when validation fails after parsing.
2024-09-30 20:48:43 +02:00
Giovanni Mascellani
8acaa3a62c
vkd3d-shader/tpf: Propagate validation errors after parsing.
...
Also, trace the program when validation fails after parsing, mostly
to make debugging easier.
2024-09-30 20:48:43 +02:00
Giovanni Mascellani
0f91149260
vkd3d-shader/d3d-asm: Dump all indices when tracing VSIR code.
...
Our ASM dumper currently hides or interprets some register indices
in order to match users expectations. This can be inconvenient for
developers, though, because it makes it harder to understand what's
really going on in the VSIR code when reading logs. With this change
the whole index structure is dumped.
2024-09-30 20:22:53 +02:00
Henri Verbeet
10559fa17a
vkd3d-shader/glsl: Implement VKD3DSIH_LOG.
2024-09-30 20:21:14 +02:00
Henri Verbeet
700eba0b01
vkd3d-shader/glsl: Handle SV_IS_FRONT_FACE inputs.
2024-09-30 20:20:11 +02:00
Henri Verbeet
0cc0b68fb4
vkd3d-shader/glsl: Implement VKD3DSIH_ROUND_NE.
2024-09-30 20:08:58 +02:00
Henri Verbeet
308121ba04
vkd3d-shader/glsl: Implement VKD3DSIH_IF and VKD3DSIH_ENDIF.
2024-09-30 20:08:58 +02:00
Henri Verbeet
e911433e0c
vkd3d-shader/glsl: Implement VKD3DSIH_ROUND_NI.
2024-09-30 20:08:58 +02:00
Giovanni Mascellani
5c2b057b56
vkd3d-shader/ir: Validate UAV registers.
2024-09-30 20:05:52 +02:00
Giovanni Mascellani
b7b5b0cff8
vkd3d-shader/ir: Validate RESOURCE registers.
2024-09-30 20:05:52 +02:00
Giovanni Mascellani
a0b98c1610
vkd3d-shader/ir: Validate SAMPLER registers.
2024-09-30 20:05:52 +02:00
Giovanni Mascellani
7404fa5285
vkd3d-shader/dxil: Emit RESOURCE and UAV registers with data type UNUSED.
2024-09-30 20:05:39 +02:00
Nikolay Sivov
300e4e0d12
vkd3d-shader/fx: Add support for writing annotations for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-30 20:02:51 +02:00
Nikolay Sivov
c9c537faa0
vkd3d-shader/fx: Add initial support for writing default values for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-30 20:02:05 +02:00
Nikolay Sivov
da0469f190
vkd3d-shader/fx: Handle the 'half' type in fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-30 20:01:57 +02:00
Conor McCarthy
2bf517782d
vkd3d-shader/dxil: Load forward-referenced sources as value/type pairs in sm6_parser_emit_store().
2024-09-30 19:58:06 +02:00
Conor McCarthy
6a86e1a8d9
vkd3d-shader/dxil: Load forward-referenced comparands as value/type pairs in sm6_parser_emit_cmpxchg().
2024-09-30 19:57:55 +02:00
Giovanni Mascellani
828e5f1249
vkd3d-shader/ir: Disallow RESOURCE registers in destination parameters.
2024-09-26 17:44:52 +02:00
Giovanni Mascellani
674ad7d655
vkd3d-shader/ir: Disallow SAMPLER registers in destination parameters.
2024-09-26 17:44:52 +02:00
Giovanni Mascellani
6de741e5e7
vkd3d-shader/ir: Do not allow NULL registers in source parameters.
2024-09-26 17:44:52 +02:00
Giovanni Mascellani
8d85ea2dc5
vkd3d-shader: Get rid of the RESOURCE data type.
2024-09-26 17:42:16 +02:00
Giovanni Mascellani
e58726310b
vkd3d-shader: Get rid of the UAV data type.
2024-09-26 17:42:16 +02:00
Giovanni Mascellani
2934f820a9
vkd3d-shader: Get rid of the SAMPLER data type.
2024-09-26 17:42:16 +02:00
Giovanni Mascellani
afa2fd527c
vkd3d-shader/dxil: Release memory on exceptional paths when parsing DXIL code. (Valgrind)
2024-09-26 17:41:21 +02:00
Henri Verbeet
466c8bfbb7
vkd3d-shader/glsl: Implement VKD3DSIH_LTO.
2024-09-26 17:40:07 +02:00
Henri Verbeet
44e96ad4d6
vkd3d-shader/glsl: Implement VKD3DSIH_EXP.
2024-09-26 17:40:07 +02:00
Henri Verbeet
d68e60a78a
vkd3d-shader/glsl: Implement VKD3DSIH_IEQ.
2024-09-26 17:40:07 +02:00
Henri Verbeet
55de9ea405
vkd3d-shader/glsl: Implement VKD3DSIH_DCL_INPUT_PS.
2024-09-26 17:40:07 +02:00
Henri Verbeet
f0c8b4a3c5
vkd3d-shader/glsl: Implement VKD3DSIH_SQRT.
2024-09-26 17:40:07 +02:00
Giovanni Mascellani
5ad83a05ff
vkd3d-shader/dxil: Release memory on exceptional paths in sm6_parser_read_signature(). (Valgrind)
2024-09-26 01:05:35 +02:00
Henri Verbeet
92a7cc3420
vkd3d-shader/glsl: Implement VKD3DSIH_DP2.
2024-09-26 01:04:32 +02:00
Henri Verbeet
b9d8b84b06
vkd3d-shader/glsl: Implement VKD3DSIH_DP4.
2024-09-26 01:04:32 +02:00
Henri Verbeet
93cd63bc93
vkd3d-shader/glsl: Implement VKD3DSIH_DP3.
2024-09-26 01:04:32 +02:00
Henri Verbeet
929010ffd7
vkd3d-shader/glsl: Implement support for the VKD3DSPR_DEPTHOUT register.
2024-09-26 01:04:32 +02:00
Henri Verbeet
459f141e81
vkd3d-shader/glsl: Implement VKD3DSIH_ROUND_Z.
2024-09-26 01:04:32 +02:00
Feifan He
e8b14d765d
vkd3d-shader/msl: Implement support for VKD3DSPR_TEMP registers.
2024-09-24 13:56:11 +02:00
Henri Verbeet
f37be27bdc
vkd3d-shader/ir: Properly check the register bounds in shader_signature_find_element_for_reg().
...
Perhaps the existing code is safe in practice, but doing the check
properly avoids having to make that determination.
2024-09-24 13:39:43 +02:00
Henri Verbeet
8e39783770
vkd3d-shader/glsl: Implement VKD3DSIH_ROUND_PI.
2024-09-24 13:38:26 +02:00
Henri Verbeet
58472e7404
vkd3d-shader/glsl: Implement VKD3DSIH_FTOU.
2024-09-24 13:38:26 +02:00
Atharva Nimbalkar
f441d3e112
vkd3d-shader/glsl: Implement VKD3DSIH_UTOF.
2024-09-24 13:38:26 +02:00
Henri Verbeet
a3d06c8f12
vkd3d-shader/glsl: Implement VKD3DSIH_FTOI.
2024-09-24 13:38:26 +02:00
Atharva Nimbalkar
b81cdcb488
vkd3d-shader/glsl: Implement VKD3DSIH_ITOF.
2024-09-24 13:38:26 +02:00
Giovanni Mascellani
e2c6058734
vkd3d-shader/spirv: Do not specify depth for SPIR-V images.
...
SPIR-V images have a "depth" parameter that, as far as I understand
(the spec doesn't look terribly clear in that regard), specifies
whether the image can be used for depth-comparison operations.
In TPF (and therefore in VSIR) the same information is specified
on the sampler type instead of on the image type. This puts us in
a hard spot, because in principle an image can be used with
many different samplers, and the mapping might even be unknown
at compilation time, so it's not clear how we should define our
images.
We currently have some algorithms to deal with that, but they are
incomplete and lead to SPIR-V validation errors like:
Expected Image to have the same type as Result Type Image
%63 = OpSampledImage %62 %59 %61
The problem here is that the image has a non-depth type, but is
being sampled as a depth image. This check was added recently to
SPIRV-Tools, so we became aware of the problem.
As I said, it's not easy in general to decide whether an image is
going to be sampled with depth-comparison operators or not.
Fortunately the SPIR-V spec allow to mark the depth parameter as
unknown (using value 2), so until we come up with something better
we use that for all images to please the validator and avoid
giving misleading hints to the driver.
2024-09-24 13:19:17 +02:00
Arkadiusz Hiler
a3017fe9d5
vkd3d-shader/preproc: Support namespaces in macro identifiers.
2024-09-24 13:17:24 +02:00
Giovanni Mascellani
a2aeb3a142
vkd3d-shader/spirv: Cache numeric types without through the general declaration cache.
...
Numeric types are used very frequently, and doing a tree search
each time one is needed tends to waste a lot of time.
I ran the compilation of ~1000 DXBC-TPF shaders randomly taken from
my collection and measured the performance using callgrind and the
kcachegrind "cycle count" estimation.
BEFORE:
* 1,764,035,136 cycles
* 1,767,948,767 cycles
* 1,773,927,734 cycles
AFTER:
* 1,472,384,755 cycles
* 1,469,506,188 cycles
* 1,470,191,425 cycles
So callgrind would estimate a 16% improvement at least.
2024-09-23 15:48:35 +02:00
Giovanni Mascellani
3a21daa49e
vkd3d-shader/spirv: Rewrite vkd3d_spirv_get_type_id_for_data_type() in terms of vkd3d_spirv_get_type_id().
2024-09-23 15:48:35 +02:00
Elizabeth Figura
650bf4d83f
vkd3d-shader/hlsl: Fix a corner case in ternary type conversion.
...
If the condition and argument types are compatible, i.e. there is no broadcast,
the resulting shape should be the shape of the arguments, not the shape of the
condition.
2024-09-23 15:43:15 +02:00
Elizabeth Figura
b2cddecfc5
vkd3d-shader/hlsl: Use add_cast() in append_conditional_break().
...
Instead of creating a cast node directly.
This specifically handles the 1x1 matrix case, which currently the backend code does not expect.
2024-09-23 15:43:15 +02:00
Henri Verbeet
1e97e1203f
vkd3d-shader/d3dbc: Write the actual constant info offset in write_sm1_uniforms().
2024-09-23 15:42:25 +02:00
Atharva Nimbalkar
ee8e005209
vkd3d-shader/glsl: Implement VKD3DSIH_MOVC.
2024-09-23 15:41:07 +02:00
Henri Verbeet
7b99c33510
vkd3d-shader/glsl: Implement VKD3DSIH_FRC.
2024-09-23 15:41:07 +02:00
Henri Verbeet
36c08b47e9
vkd3d-shader/glsl: Implement VKD3DSIH_GEO.
2024-09-23 15:41:07 +02:00
Henri Verbeet
28ef331704
vkd3d-shader/glsl: Implement support for VKD3DSPSM_NEG modifiers.
2024-09-23 15:41:07 +02:00
Henri Verbeet
b9366def96
vkd3d-shader/glsl: Implement VKD3DSIH_DIV.
2024-09-23 15:41:07 +02:00
Elizabeth Figura
43b714d896
vkd3d-shader/hlsl: Handle error expressions in unary expressions.
2024-09-23 15:28:47 +02:00
Elizabeth Figura
7e3231c749
vkd3d-shader/hlsl: Return an "error" expression when constructing an arithmetic expression from incompatible types.
2024-09-23 15:28:47 +02:00
Elizabeth Figura
c43e5c8eb5
vkd3d-shader/hlsl: Introduce the "error" type.
...
Currently, if an expression successfully parses according to the bison grammar,
but for one reason or another cannot generate a meaningful IR instruction, we
abort parsing with YYABORT. This includes, for example, an undefined variable or
function, invalid swizzle or field reference, or a constructor with a complex or
non-numeric data type.
Aborting parsing is unfortunate, however, because it means that any further
errors in the program cannot be caught by the programmer, increasing the number
of times they will need to fix errors and recompile.
The idea of this patch is that any such expression will instead generate an IR
node whose data type is of HLSL_CLASS_ERROR. Any further expression which would
consume an "error" typed instruction will instead immediately return an
expression of type "error" (probably the same one) instead of aborting or doing
any other type-checking.
Currently these "error" instructions should not pass the parsing stage, since
hlsl_compile_shader() will immediately notice that compilation has failed and
skip any optimization, lowering, or bytecode-writing.
A further direction to take this is to pre-allocate one "error" expression
immediately when creating the HLSL parser, and return that expression when we
fail to allocate an hlsl_ir_node of any type. This means we do not need to
handle allocation errors when constructing nodes, saving us quite a lot of error
handling (which is not only tedious but currently often broken, if nothing else
by virtue of neglecting cleanup of local variables).
2024-09-23 15:28:47 +02:00
Elizabeth Figura
7daaaf6386
vkd3d-shader/hlsl: Clarify a comment.
2024-09-23 15:28:47 +02:00
Elizabeth Figura
010aa53bfa
vkd3d-shader/hlsl: Do not handle HLSL_CLASS_CONSTANT_BUFFER in copy_propagation_transform_load().
2024-09-23 15:28:47 +02:00
Elizabeth Figura
f73a23f735
vkd3d-shader/hlsl: Do not create a copy in add_assignment().
2024-09-23 15:28:47 +02:00
Elizabeth Figura
eb7f5f7f68
vkd3d-shader/hlsl: Return bool from add_assignment().
2024-09-23 15:28:47 +02:00
Elizabeth Figura
8975933aff
vkd3d-shader/hlsl: Store a pointer to the block's "value" instruction in the block.
2024-09-23 15:28:47 +02:00
Nikolay Sivov
799e6105a4
vkd3d-shader/d3dbc: Add an option to treat doubles as floats.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55448
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-23 15:26:35 +02:00
Nikolay Sivov
d7def84253
vkd3d-shader/hlsl: Remove the 'double' keyword.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-23 15:26:35 +02:00
Nikolay Sivov
b5c5783293
vkd3d-shader: Explicitly set indices for the numeric type names array.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-23 15:25:36 +02:00
Nikolay Sivov
f64689eed8
vkd3d-shader/tpf: Set temps count in the STAT section.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-20 17:20:02 +02:00
Nikolay Sivov
478e28ea79
vkd3d-shader/tpf: Move STAT fields update to a separate helper.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-20 17:20:02 +02:00
Henri Verbeet
bc70d575ae
vkd3d-shader/glsl: Implement VKD3DSIH_OR.
2024-09-20 17:16:33 +02:00
Henri Verbeet
e289c3999d
vkd3d-shader/glsl: Implement VKD3DSIH_INE.
2024-09-20 17:16:33 +02:00
Henri Verbeet
3b3fe1da2c
vkd3d-shader/glsl: Implement VKD3DSIH_MUL.
2024-09-20 17:16:33 +02:00
Atharva Nimbalkar
2fc35da940
vkd3d-shader/glsl: Implement support for VSIR_DIMENSION_VEC4 immediate constants.
2024-09-20 17:16:33 +02:00
Henri Verbeet
2409966ff2
vkd3d-shader/glsl: Implement VKD3DSIH_NEU.
2024-09-20 17:16:33 +02:00