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
Conor McCarthy
91475c684f
vkd3d: Clear the output pointer on failure in vkd3d_create_versioned_root_signature_deserializer().
2024-09-24 13:34:40 +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
Conor McCarthy
945e8a9024
vkd3d: Sort bounded descriptor ranges after unbounded ones of equal offset.
...
Enables the bounded range to be mapped to the unbounded one, instead of
being mapped to a separate binding which will be populated from the same
d3d12 descriptors as the unbounded one.
2024-09-23 15:45:26 +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
Andrey Gusev
2ac7f650a1
vkd3d: Recognise VK_QUEUE_VIDEO_ENCODE_BIT_KHR in debug_vk_queue_flags().
2024-09-20 17:21:44 +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
Giovanni Mascellani
9777c8bc65
vkd3d-shader/spirv: Do not reallocate the SPIR-V program.
...
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,846,641,596 cycles
* 1,845,635,336 cycles
* 1,841,335,225 cycles
AFTER:
* 1,764,035,136 cycles
* 1,767,948,767 cycles
* 1,773,927,734 cycles
So callgrind would estimate a 3.6% improvement at least.
The counterpoint is that the caller might get an allocation that
is potentially bigger than necessary. I would expect that allocation
to be rather short-lived anyway, so that's probably not a problem.
2024-09-20 17:14:49 +02:00
Giovanni Mascellani
35d3161f9d
vkd3d-shader/spirv: Propagate errors from vkd3d_spirv_stream_append().
2024-09-20 17:04:31 +02:00
Giovanni Mascellani
637a3cabe7
vkd3d-shader/ir: Allow failure in shader_signature_find_element_for_reg().
...
shader_signature_find_element_for_reg() is also used in the TPF parser,
where the program has not been validated yet, so it must not crash
on errors.
The I/O normaliser can instead assume that the shader is already
validated.
This fixes a crash with a shader used by The Falconeer. The bug is still
present, because the shader will be incorrectly rejected, but at least
the vkd3d-shader will fail gracefully.
2024-09-20 17:01:29 +02:00
Nikolay Sivov
32ced3bd8f
vkd3d-shader/tpf: Set 'gather' instructions counter in the STAT.
2024-09-19 14:38:59 +02:00
Nikolay Sivov
01f6ef5e6d
vkd3d-shader/tpf: Add a 'lod' counter to the STAT.
2024-09-19 14:38:59 +02:00
Nikolay Sivov
7c9695b261
vkd3d-shader/tpf: Handle barrier instructions in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-19 14:38:59 +02:00
Henri Verbeet
d4bc51b850
vkd3d-shader/d3dbc: Introduce enum vkd3d_sm1_rastout_register.
2024-09-19 14:38:03 +02:00
Atharva Nimbalkar
f8d403f330
vkd3d-shader/glsl: Implement VKD3DSIH_AND.
2024-09-19 14:35:24 +02:00
Henri Verbeet
c8acf285cb
vkd3d-shader/glsl: Implement support for VKD3DSPSM_ABS modifiers.
2024-09-19 14:35:20 +02:00
Atharva Nimbalkar
1d485cc8a9
vkd3d-shader/glsl: Implement support for VKD3DSPR_IMMCONST registers.
2024-09-19 14:32:29 +02:00
Atharva Nimbalkar
ab07637ee1
vkd3d-shader/glsl: Implement VKD3DSIH_ADD.
2024-09-19 14:29:46 +02:00
Henri Verbeet
ae40184631
vkd3d-shader/glsl: Implement support for VKD3DSPR_CONSTBUFFER registers.
2024-09-19 14:29:46 +02:00
Henri Verbeet
e9f0c6fef3
vkd3d-shader/glsl: Handle SV_TARGET outputs.
2024-09-18 15:04:52 +02:00
Henri Verbeet
6cae2d006c
vkd3d-shader/d3dbc: Introduce enum vkd3d_sm1_misc_register.
2024-09-18 15:04:10 +02:00
Feifan He
9b1b7e86cf
vkd3d-shader/msl: Implement VKD3DSIH_RET.
2024-09-18 15:02:57 +02:00
Feifan He
7aa0de27e9
vkd3d-shader/msl: Implement VKD3DSIH_MOV.
2024-09-18 14:48:03 +02:00
Henri Verbeet
a1487380bb
vkd3d-shader/glsl: Implement support for VKD3DSPR_OUTPUT registers.
2024-09-17 18:05:47 +02:00
Henri Verbeet
c462c62108
vkd3d-shader/glsl: Implement support for VKD3DSPR_INPUT registers.
2024-09-17 18:05:47 +02:00
Feifan He
deda49e501
vkd3d-shader/msl: Implement VKD3DSIH_NOP.
2024-09-17 11:30:26 +02:00
Feifan He
842841907e
vkd3d-shader/msl: Add vkd3d-shader version information to the generated shader.
2024-09-17 11:30:26 +02:00
Feifan He
c278c901b5
vkd3d-shader/msl: Keep track of the current indentation level
2024-09-17 11:30:26 +02:00
Giovanni Mascellani
56ec211d04
vkd3d-shader/ir: Introduce a helper for validating Hull Shader phases.
2024-09-16 19:32:32 +02:00
Giovanni Mascellani
259273a133
vkd3d-shader/ir: Introduce a helper for validating DCL_TESSELLATOR_PARTITIONING.
2024-09-16 19:32:32 +02:00
Giovanni Mascellani
a3c7bebc18
vkd3d-shader/ir: Introduce a helper for validating DCL_TESSELLATOR_OUTPUT_PRIMITIVE.
2024-09-16 19:32:32 +02:00
Giovanni Mascellani
48f512a83a
vkd3d-shader/ir: Introduce a helper for validating DCL_TESSELLATOR_DOMAIN.
2024-09-16 19:32:32 +02:00
Giovanni Mascellani
8aa2364381
vkd3d-shader/ir: Introduce a helper for validating DCL_OUTPUT_CONTROL_POINT_COUNT.
2024-09-16 19:32:32 +02:00
Nikolay Sivov
0e9fcb1431
vkd3d-shader/tpf: Handle tessellation stage fields in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-16 14:04:46 +02:00
Nikolay Sivov
947b151ed4
vkd3d-shader/tpf: Handle atomic instructions in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-16 14:01:29 +02:00
Nikolay Sivov
7c12371298
vkd3d-shader/tpf: Handle bitwise instructions in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-16 14:01:18 +02:00
Nikolay Sivov
90fc57ff89
vkd3d-shader/tpf: Handle GS reflection fields in the STAT section.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-16 14:01:07 +02:00
Nikolay Sivov
97cc27d33f
vkd3d-shader/d3d-asm: Tweak some GS declaration names.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-16 13:58:57 +02:00
Giovanni Mascellani
c45bb5badc
vkd3d-shader/ir: Introduce a helper for validating DCL_GL_INSTANCES.
2024-09-16 13:53:52 +02:00
Giovanni Mascellani
dec7a0dbd2
vkd3d-shader/ir: Introduce a helper for validating DCL_OUTPUT_TOPOLOGY.
2024-09-16 13:53:52 +02:00
Giovanni Mascellani
22ba37c8b9
vkd3d-shader/ir: Introduce a helper for validating DCL_VERTICES_OUT.
2024-09-16 13:53:51 +02:00
Giovanni Mascellani
936adff58b
vkd3d-shader/ir: Introduce a helper for validating DCL_INPUT_PRIMITIVE.
2024-09-16 13:53:51 +02:00
Giovanni Mascellani
0f07a2c512
vkd3d-shader/ir: Introduce a helper for validating DCL_HS_MAX_TESSFACTOR.
2024-09-16 13:53:51 +02:00
Giovanni Mascellani
e1c3266793
vkd3d-shader/ir: Record entering a block in the LABEL validation handler.
2024-09-16 13:53:51 +02:00
Giovanni Mascellani
1d21588de7
vkd3d-shader/ir: Record leaving a block in the relevant validation handlers.
2024-09-16 13:53:51 +02:00
Giovanni Mascellani
3e012c355d
vkd3d-shader/ir: Validate NOP instructions.
2024-09-14 16:44:17 +02:00
Giovanni Mascellani
27b421be6a
vkd3d-shader/ir: Do not access a missing destination register when validating PHI.
2024-09-14 16:44:17 +02:00
Giovanni Mascellani
e27cf68173
vkd3d-shader/ir: Introduce a helper for validating PHI.
2024-09-14 16:44:16 +02:00
Giovanni Mascellani
9696a0cd4a
vkd3d-shader/ir: Introduce a helper for validating SWITCH_MONOLITHIC.
2024-09-14 16:44:16 +02:00
Giovanni Mascellani
ce6306c6fb
vkd3d-shader/ir: Introduce a helper for validating BRANCH.
2024-09-14 16:44:16 +02:00
Giovanni Mascellani
504f4223c2
vkd3d-shader/ir: Introduce a helper for validating LABEL.
2024-09-14 16:44:16 +02:00
Giovanni Mascellani
c447a062c4
vkd3d-shader/ir: Introduce a helper for validating RET.
2024-09-14 16:44:16 +02:00
Giovanni Mascellani
88b3d4fb3a
vkd3d-shader/ir: Introduce a helper for validating ENDSWITCH.
2024-09-14 16:44:16 +02:00
Giovanni Mascellani
4939f580a4
vkd3d-shader/ir: Introduce a helper for validating SWITCH.
2024-09-14 16:44:16 +02:00
Francisco Casas
4b85e6b1f8
vkd3d-shader/d3dbc: Remove ctx and entry_func args in d3dbc_compile().
2024-09-14 16:39:24 +02:00
Francisco Casas
b72ef6038d
vkd3d-shader/hlsl: Remove hlsl_ir_vsir_instruction_ref.
2024-09-14 16:39:17 +02:00
Francisco Casas
6bd0390498
vkd3d-shader/hlsl: Save hlsl_ir_if in the vsir_program for SM1.
2024-09-14 16:33:25 +02:00
Henri Verbeet
6b0baeb6c2
vkd3d-shader/ir: Merge vsir_program_normalise_combined_samplers() into vsir_program_lower_instructions().
2024-09-14 16:11:45 +02:00
Henri Verbeet
3b68aa5b87
vkd3d-shader/ir: Introduce vsir_src_param_init_sampler().
2024-09-14 16:11:45 +02:00
Henri Verbeet
7ea8a29036
vkd3d-shader/ir: Introduce vsir_src_param_init_resource().
2024-09-14 16:11:45 +02:00
Henri Verbeet
ca445cd832
vkd3d-shader/ir: Move the instruction helpers together.
2024-09-14 16:11:45 +02:00
Henri Verbeet
d54e2ebd7d
vkd3d-shader/ir: Move the destination parameter helpers up.
2024-09-14 16:11:45 +02:00
Henri Verbeet
4bad83c9fb
vkd3d-shader/ir: Move the source parameter helpers up.
2024-09-14 16:11:45 +02:00
Francisco Casas
ffc1449412
vkd3d-shader/hlsl: Allow effect calls on default value initializers.
2024-09-14 16:09:12 +02:00
Francisco Casas
4aa262d773
vkd3d-shader/hlsl: Parse ConstructGSWithSO().
2024-09-14 16:09:08 +02:00
Francisco Casas
1f9fc2a422
vkd3d-shader/hlsl: Process GeometryShader as a valid stateblock lhs.
2024-09-14 16:02:43 +02:00
Francisco Casas
02b249d5e7
vkd3d-shader/hlsl: Introduce enum hlsl_compile_type.
2024-09-14 15:57:40 +02:00
Nikolay Sivov
4c03cda3c7
vkd3d-shader/tpf: Handle texture instructions in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-13 16:01:22 +02:00
Nikolay Sivov
9e4b2f5a1b
vkd3d-shader/tpf: Handle 'movc' in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-13 16:01:22 +02:00
Nikolay Sivov
7bd6c6b172
vkd3d-shader/tpf: Handle 'emit' and 'cut' in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-13 16:01:22 +02:00
Nikolay Sivov
908833fa6b
vkd3d-shader/tpf: Handle arithmetic instructions in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-13 16:01:22 +02:00
Nikolay Sivov
cfa8f0dccb
vkd3d-shader/tpf: Handle conversion instructions in STAT.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-13 16:01:22 +02:00
Giovanni Mascellani
44222ea739
vkd3d-shader/ir: Introduce a helper for validating ENDREP.
2024-09-13 15:59:49 +02:00
Giovanni Mascellani
e9fbbf26bb
vkd3d-shader/ir: Introduce a helper for validating REP.
2024-09-13 15:59:15 +02:00
Giovanni Mascellani
bf9022d3df
vkd3d-shader/ir: Introduce a helper for validating ENDLOOP.
2024-09-13 15:58:46 +02:00
Giovanni Mascellani
5ce10b9e68
vkd3d-shader/ir: Introduce a helper for validating LOOP.
2024-09-13 15:58:01 +02:00
Giovanni Mascellani
34c8aaad29
vkd3d-shader/ir: Introduce a helper for validating ENDIF.
2024-09-13 15:57:39 +02:00
Giovanni Mascellani
244838d344
vkd3d-shader/ir: Introduce a helper for validating ELSE.
2024-09-13 15:56:18 +02:00
Giovanni Mascellani
8af2d04dbc
vkd3d-shader/ir: Introduce a helper for validating IFC.
2024-09-13 15:54:51 +02:00
Giovanni Mascellani
af687c9522
vkd3d-shader/ir: Introduce a helper for validating IF.
2024-09-13 15:54:16 +02:00
Giovanni Mascellani
35fe5b48c8
vkd3d-shader/ir: Introduce a helper for validating DCL_TEMPS.
2024-09-13 15:52:07 +02:00
Henri Verbeet
d30160710b
vkd3d-shader/tpf: Include vkd3d_d3dcommon.h only from tpf.c.
2024-09-12 18:50:51 +02:00
Henri Verbeet
14ee3b3e4a
vkd3d-shader/d3dbc: Use VKD3D_SM1_DCL_USAGE_SHIFT and VKD3D_SM1_DCL_USAGE_INDEX_SHIFT in d3dbc_write_semantic_dcl().
2024-09-12 18:49:57 +02:00
Elizabeth Figura
1aa857735f
vkd3d-shader/hlsl: Preserve doubles in intrinsic_determinant().
2024-09-12 18:48:52 +02:00
Elizabeth Figura
e146cc4c8e
vkd3d-shader/hlsl: Preserve doubles in intrinsic_cross().
2024-09-12 18:48:52 +02:00
Elizabeth Figura
1176aaad22
vkd3d-shader/hlsl: Preserve doubles in elementwise_intrinsic_float_convert_args().
2024-09-12 18:48:52 +02:00
Elizabeth Figura
ebaf877b62
vkd3d-shader/hlsl: Preserve doubles in intrinsic_float_convert_arg().
2024-09-12 18:48:52 +02:00
Elizabeth Figura
534d546ed9
vkd3d-shader/hlsl: Use expr_common_base_type() in intrinsic_cross().
2024-09-12 18:48:52 +02:00
Elizabeth Figura
9260078300
vkd3d-shader/hlsl: Use intrinsic_float_convert_arg() in write_acos_or_asin().
2024-09-12 18:48:52 +02:00
Anna (navi) Figueiredo Gomes
e61046fb23
vkd3d-shader/hlsl: Implement the "earlydepthstencil" attribute.
2024-09-12 18:46:24 +02:00
Francisco Casas
0c621f9e4e
vkd3d-shader/hlsl: Save hlsl_ir_jump in the vsir_program for SM1.
2024-09-12 18:43:55 +02:00
Francisco Casas
08fb683784
vkd3d-shader/hlsl: Save hlsl_ir_resource_load in the vsir_program for SM1.
2024-09-12 18:42:25 +02:00
Francisco Casas
961c4f8b23
vkd3d-shader/hlsl: Save CAST hlsl_ir_exprs in the vsir_program for SM1.
2024-09-12 18:39:43 +02:00
Francisco Casas
8933620109
vkd3d-shader/hlsl: Save REINTERPRET hlsl_ir_exprs as vsir_program MOVs for SM1.
2024-09-12 18:33:19 +02:00
Giovanni Mascellani
866f138875
vkd3d-shader/ir: Record the control flow type in the program.
2024-09-12 18:31:32 +02:00
Giovanni Mascellani
dcee148b1a
vkd3d-shader/ir: Move the control flow type enumeration to vkd3d_shader_private.h.
2024-09-12 18:27:20 +02:00
Nikolay Sivov
ec644b395b
vkd3d-shader/tpf: Create a stub STAT section.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-12 18:26:08 +02:00
Feifan He
5df81049aa
vkd3d-shader/msl: Call vsir_program_transform() before generating code.
2024-09-12 18:09:00 +02:00
Feifan He
47981def0d
vkd3d-shader/msl: Generate comments for unhandled instructions.
...
Similar to commit 8a60814476
for the GLSL
target.
2024-09-12 18:04:44 +02:00
Feifan He
23ba1a5e07
vkd3d-shader: Introduce VKD3D_SHADER_TARGET_MSL.
2024-09-12 17:03:32 +02:00
Henri Verbeet
ab525f31e4
vkd3d-shader/d3dbc: Use enum vkd3d_shader_src_modifier in struct sm1_src_register.
2024-09-11 15:24:54 +02:00
Henri Verbeet
f3e6c75c89
vkd3d-shader/d3dbc: Use enum vkd3d_shader_dst_modifier in struct sm1_dst_register.
2024-09-11 15:19:29 +02:00
Giovanni Mascellani
b31c9831fa
vkd3d-shader/ir: Print results as signed numbers.
2024-09-11 15:13:14 +02:00
Giovanni Mascellani
096f133b09
vkd3d-shader/ir: Rename vsir_program_normalise() to vsir_program_transform().
2024-09-11 15:13:14 +02:00
Giovanni Mascellani
03ab0156a2
vkd3d-shader/ir: Run validation after inserting the alpha test.
2024-09-11 15:13:14 +02:00
Giovanni Mascellani
5c0d640d18
vkd3d-shader/ir: Run validation after flattening control flow constructs.
2024-09-11 15:13:14 +02:00
Giovanni Mascellani
4b06729be8
vkd3d-shader/ir: Run validation after normalising combined samplers.
2024-09-11 15:13:14 +02:00
Giovanni Mascellani
c2fd1e42fd
vkd3d-shader/ir: Run validation after removing dead code.
2024-09-11 15:13:14 +02:00
Elizabeth Figura
82773eb805
vkd3d-shader/hlsl: Use elementwise_intrinsic_float_convert_args() in refract().
2024-09-11 15:11:42 +02:00
Elizabeth Figura
2688a24bde
vkd3d-shader/hlsl: Preserve halves in intrinsic_step().
2024-09-11 15:11:42 +02:00
Elizabeth Figura
b23c172a47
vkd3d-shader/hlsl: Use elementwise_intrinsic_float_convert_args() in intrinsic_smoothstep().
2024-09-11 15:11:42 +02:00
Elizabeth Figura
e7eadb38b8
vkd3d-shader/hlsl: Use elementwise_intrinsic_float_convert_args() in intrinsic_faceforward().
2024-09-11 15:11:42 +02:00
Elizabeth Figura
24e29649c4
vkd3d-shader/hlsl: Use elementwise_intrinsic_convert_args() in intrinsic_dst().
...
This one preserves integer arguments.
2024-09-11 15:11:42 +02:00
Elizabeth Figura
7636f2a233
vkd3d-shader/hlsl: Use elementwise_intrinsic_float_convert_args() in write_atan_or_atan2().
2024-09-11 15:11:42 +02:00
Francisco Casas
6e6e2910d6
vkd3d-shader/hlsl: Save DP2ADD hlsl_ir_exprs in the vsir_program for SM1.
2024-09-11 15:10:16 +02:00
Francisco Casas
4ed16108f0
vkd3d-shader/hlsl: Save COS_REDUCED and SIN_REDUCED in the vsir_program for SM1.
2024-09-11 15:09:58 +02:00
Francisco Casas
5db2c2a949
vkd3d-shader/hlsl: Save DOT hlsl_ir_exprs in the vsir_program for SM1.
2024-09-11 15:09:17 +02:00
Francisco Casas
d70342d66d
vkd3d-shader/hlsl: Save per-component hlsl_ir_exprs in the vsir_program for SM1.
2024-09-11 15:07:35 +02:00
Francisco Casas
82dec5db46
vkd3d-shader/hlsl: Save simple hlsl_ir_exprs in the vsir_program for SM1.
2024-09-11 15:06:09 +02:00
Anna (navi) Figueiredo Gomes
127ae6cf12
vkd3d: Implement d3d12_command_list_OMSetDepthBounds().
...
Based on the design document, "The runtime will not clamp or validate
the input, but implementations may clamp to the range [0,1] if necessary.",
so we test for the EXT_depth_range_unrestricted extension, and only clamp if
it's not available (thus, necessary to do so).
NaNs are converted to zero as per "NaNs must be treated as 0, but the runtime
will convert NaNs to 0 on behalf of the implementation.", and a default bounds
are set to 0.0 and 1.0.
2024-09-11 14:53:33 +02:00
Nikolay Sivov
3b4e0ce8e9
vkd3d-shader/fx: Check modifiers when reusing types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-10 21:48:03 +02:00
Giovanni Mascellani
d71966c77e
vkd3d: Do not keep track of descriptor heaps when using virtual heaps.
...
Descriptors only need flushing when using Vulkan heaps, so let's avoid
uselessly scanning an array and taking and releasing a mutex if we're not.
2024-09-10 21:47:38 +02:00
Giovanni Mascellani
05a5bd620d
vkd3d: Directly call the function to update descriptors.
...
For better code clarity.
2024-09-10 21:46:46 +02:00
Conor McCarthy
e550901efa
vkd3d-shader/ir: Free the semantic names of deleted signature elements in shader_signature_merge(). (Valgrind)
2024-09-10 21:45:22 +02:00
Giovanni Mascellani
828dfdf1bd
vkd3d-shader/ir: Run validation after normalising flat constants.
2024-09-10 21:43:14 +02:00
Giovanni Mascellani
1c285d40bd
vkd3d-shader/ir: Run validation after normalising I/O registers.
2024-09-10 21:43:14 +02:00
Giovanni Mascellani
d8c41cc270
vkd3d-shader/ir: Run validation after normalising Hull Shader control points I/O registers.
2024-09-10 21:43:14 +02:00
Giovanni Mascellani
a3fdc447de
vkd3d-shader/ir: Run validation after flattening hull shader phases.
2024-09-10 21:43:14 +02:00
Giovanni Mascellani
5fd93c28c4
vkd3d-shader/ir: Run validation after remapping the output signature.
2024-09-10 21:43:14 +02:00
Anna (navi) Figueiredo Gomes
5ebbba6fff
vkd3d/state: Replace ERR with WARN in vkd3d_validate_descriptor_set_count().
2024-09-10 21:42:47 +02:00
Henri Verbeet
207664baca
vkd3d-shader/d3dbc: Use VKD3D_SM1_REGISTER_TYPE_SHIFT and related constants in sm1_encode_register_type().
2024-09-10 21:42:23 +02:00
Henri Verbeet
f163df787e
vkd3d-shader/d3dbc: Avoid D3DVS_VERSION and D3DPS_VERSION.
2024-09-10 21:41:33 +02:00
Nikolay Sivov
de6abd964e
vkd3d-shader/hlsl: Implement the mad() intrinsic.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-10 21:40:32 +02:00
Nikolay Sivov
75299c04fd
vkd3d-shader: Handle the SV_SampleIndex semantic.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-10 21:39:03 +02:00
Giovanni Mascellani
bfd1fc9cd6
vkd3d-shader/ir: Assume that Hull Shaders have a control point phase in vsir_program_normalise_io_registers().
...
The control point phase is always introduced, when missing, by the
earlier instruction_array_normalise_hull_shader_control_point_io()
pass.
2024-09-05 16:33:05 +02:00
Giovanni Mascellani
7b9a1bf6df
vkd3d-shader/ir: Run validation after materializing undominated SSAs to TEMPs.
2024-09-05 16:29:47 +02:00
Giovanni Mascellani
08c1f4d45e
vkd3d-shader/ir: Run validation after flattening control flow constructs.
2024-09-05 16:29:17 +02:00
Giovanni Mascellani
455c826a6a
vkd3d-shader/ir: Run validation after structurization.
2024-09-05 16:29:11 +02:00
Giovanni Mascellani
e935dcb88d
vkd3d-shader/ir: Run validation after lowering switches to selection ladders.
2024-09-05 16:29:02 +02:00
Giovanni Mascellani
4a28433ef5
vkd3d-shader/ir: Run validation after materializing PHI SSAs to TEMPs.
2024-09-05 16:26:52 +02:00
Giovanni Mascellani
fade5dd54c
vkd3d-shader/ir: Run validation after lowering instructions.
2024-09-05 16:25:33 +02:00
Giovanni Mascellani
ffb7284fb6
vkd3d-shader/ir: Do not decide the control flow type on NOPs.
2024-09-05 16:20:39 +02:00
Giovanni Mascellani
829e6f5cd0
vkd3d-shader/ir: Emit a warning instead of an error on validation failures.
2024-09-05 16:20:39 +02:00
Henri Verbeet
03d76f653b
vkd3d-shader/d3dbc: Use VKD3D_SM1_INSTRUCTION_LENGTH_SHIFT instead of D3DSI_INSTLENGTH_SHIFT.
2024-09-05 12:47:43 +02:00
Henri Verbeet
b9693393fd
vkd3d-shader/d3dbc: Store a enum vkd3d_sm1_opcode in struct sm1_instruction.
2024-09-05 12:45:43 +02:00
Nikolay Sivov
0a6bcf5da7
vkd3d-shader/tpf: Fix a typo when adding the SFI0 section.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-04 18:43:41 +02:00
Henri Verbeet
a214e96cf8
vkd3d-shader/tpf: Use enum vkd3d_sm4_data_type in sm4_resource_format().
2024-09-04 18:42:26 +02:00
Henri Verbeet
b61675d0f3
vkd3d-shader/tpf: Use enum vkd3d_shader_component_type in write_sm4_signature().
2024-09-04 18:40:56 +02:00
Shaun Ren
c1babbc8aa
vkd3d-shader/hlsl: Validate hull shader attributes.
2024-09-04 18:30:04 +02:00
Shaun Ren
6c1dc53d15
vkd3d-shader/hlsl: Parse the patchconstantfunc attribute.
2024-09-04 18:30:04 +02:00
Shaun Ren
41cb29c4c8
vkd3d-shader/hlsl: Parse the partitioning attribute.
2024-09-04 18:28:59 +02:00
Shaun Ren
615ffb823b
vkd3d-shader/hlsl: Parse the outputtopology attribute.
2024-09-04 18:28:57 +02:00
Shaun Ren
dae88bab52
vkd3d-shader/hlsl: Parse the outputcontrolpoints attribute.
2024-09-04 18:28:46 +02:00
Shaun Ren
4dfd682446
vkd3d-shader/hlsl: Parse the domain attribute.
2024-09-04 18:21:15 +02:00
Shaun Ren
51e9b05fe5
vkd3d-shader/hlsl: Introduce parse_entry_function_attributes() helper.
2024-09-04 18:18:23 +02:00
Shaun Ren
73ee5a135a
vkd3d-shader/hlsl: Check for duplicate attributes in function declaration.
2024-09-04 18:18:23 +02:00
Petrichor Park
855b9713b8
vkd3d-shader/hlsl: Implement the sincos() intrinsic.
2024-09-04 18:16:37 +02:00
Petrichor Park
384810b4ba
vkd3d-shader/hlsl: Implement the dst() intrinsic.
2024-09-04 18:08:24 +02:00
Francisco Casas
7ec44bd70b
vkd3d-shader/hlsl: Parse the CompileShader() syntax.
2024-09-04 17:59:34 +02:00
Francisco Casas
45f18a7838
vkd3d-shader/hlsl: Parse the shader 'compile' syntax.
...
The hlsl_ir_compile node is introduced to represent the "compile"
syntax, and later the CompileShader() and ConstructGSWithSO()
constructs.
It basically represents a function call that remembers its arguments
using hlsl_srcs and keeps its own instruction block, which is discarded
when working on non-effect shaders.
For shader compilations it can be asserted that args_count is 1, and
that this argument (and the last node in hlsl_ir_effect_call.instrs)
is a regular hlsl_ir_call pointing to the declaration of the function
to be compiled.
2024-09-04 17:58:56 +02:00
Francisco Casas
379cd9b7b5
vkd3d-shader/hlsl: Save hlsl_ir_swizzles in the vsir_program for SM1.
2024-09-04 17:51:32 +02:00
Francisco Casas
b46eac35c0
vkd3d-shader/hlsl: Save hlsl_ir_stores in the vsir_program for SM1.
2024-09-04 17:51:32 +02:00
Francisco Casas
9aace1ac4e
vkd3d-shader/hlsl: Save hlsl_ir_loads in the vsir_program for SM1.
2024-09-04 17:51:32 +02:00
Francisco Casas
23e3ec84f7
vkd3d-shader/hlsl: Save hlsl_ir_constants in the vsir_program for SM1.
2024-09-04 17:51:30 +02:00
Francisco Casas
a61846c28a
vkd3d-shader/hlsl: Store SM1 sampler dcls on the vsir_program.
2024-09-04 17:47:47 +02:00
Francisco Casas
9a564872c5
vkd3d-shader/hlsl: Store SM1 constant dcls on the vsir_program.
2024-09-04 17:44:46 +02:00
Francisco Casas
7abf3c3a37
vkd3d-shader/hlsl: Introduce hlsl_ir_vsir_instruction_ref.
...
This node type will be deleted once the hlsl->vsir->d3dbc translation is
complete. For now it serves the purpose of allowing to keep both real
hlsl_ir_nodes and vsir_instructions in the hlsl_block, until all the
former can be translated into the latter.
2024-09-04 16:49:00 +02:00
Anna (navi) Figueiredo Gomes
3d8fc1a467
vkd3d-shader/spirv: Break long assembly lines.
...
Avoid overflowing the (Wine) debug log buffer when output lines are too
long, and keep spirv-text output more legible. The output is still valid
SPIR-V asm, as the assembler does not care for which kind of whitespace
is used.
2024-09-03 17:06:20 +02:00
Victor Chiletto
a39227c79c
vkd3d-shader/hlsl: Fold logic AND and logic OR identities.
2024-09-03 15:11:16 +02:00
Elizabeth Figura
d507acb5ac
vkd3d-utils: Do not emit implicit truncation warnings from D3DCompile2VKD3D() before version 42.
2024-09-03 15:07:36 +02:00
Elizabeth Figura
8515fcbc70
vkd3d-utils: Add a D3DCompile2VKD3D() that allows configuring DLL version.
...
This would allow us to use vkd3d-utils directly in Wine [with the exception of
D3D_COMPILE_STANDARD_FILE_INCLUDE, but we can simply pass the ID3DInclude object
to D3DCompile2VKD3D().]
2024-09-03 15:06:29 +02:00
Nikolay Sivov
6d28cc131b
vkd3d-shader/fx: Fix the unpacked size and stride fields of the fx_4_0 types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
9673b660d4
vkd3d-shader/fx: Expand BlendState array fields for fx_4_1 as well.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
1ed4543007
vkd3d-shader/fx: Only add numeric variables when writing buffers.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
ee2da76e6d
vkd3d-shader/fx: Set structure field offsets in bytes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Henri Verbeet
7a74e79f2d
vkd3d-shader/d3dbc: Return a vkd3d_decl_usage from hlsl_sm1_usage_from_semantic().
2024-09-02 19:14:01 +02:00
Henri Verbeet
1c01560321
vkd3d-shader/tpf: Return a vkd3d_shader_sysval_semantic from hlsl_sm4_usage_from_semantic().
2024-09-02 19:12:53 +02:00
Anna (navi) Figueiredo Gomes
f5205da8e9
vkd3d-shader/spirv: Pass a vkd3d_shader_descriptor_info1 structure to spirv_compiler_build_descriptor_variable().
2024-09-02 19:10:19 +02:00
Anna (navi) Figueiredo Gomes
672a8f5ce9
vkd3d-shader/spirv: Pass a vkd3d_shader_descriptor_info1 structure to spirv_compiler_emit_sampler_declaration().
2024-09-02 18:59:37 +02:00
Anna (navi) Figueiredo Gomes
22aad955ec
vkd3d-shader/spirv: Pass a vkd3d_shader_descriptor_info1 structure to spirv_compiler_emit_cbv_declaration().
2024-09-02 18:58:29 +02:00
Anna (navi) Figueiredo Gomes
2a52ccf2c6
vkd3d-shader/spirv: Pass a vkd3d_shader_descriptor_info1 structure to spirv_compiler_emit_resource_declaration().
2024-09-02 18:54:19 +02:00
Giovanni Mascellani
527966580e
vkd3d-shader: Dump the converted shader too.
2024-08-29 19:17:07 +02:00
Giovanni Mascellani
1a0d6a4db4
vkd3d-shader: Use a hash to build the filename when dumping shaders.
...
This way the same shader is always dumped to the same path and when
launching the same program over and over we avoid both creating new
copies of the same file each time and overwriting different dumped
shaders.
2024-08-29 19:14:27 +02:00
Henri Verbeet
0e72aba0bc
Release 1.13.
2024-08-29 12:08:46 +02:00
Elizabeth Figura
eb71a1722a
vkd3d-shader: Use an extended version of vkd3d_shader_immediate_constant in vkd3d_shader_parameter1.
...
This is a proposed API change in 946, which won't make it into this release.
The intent is to allow slightly larger constants to be specified in the updated
vkd3d_shader_parameter1 structure. In particular, this is large enough to pass
4-dimensional integer or float vectors inline, which the proposed clip plane
implementation will use, as well as other Direct3D FFP parameters.
We could also simply add vkd3d_shader_immediate_constant1 as a separate union
member in vkd3d_shader_parameter1, but this API is a bit cleaner and simpler.
2024-08-28 12:08:37 +02:00
Henri Verbeet
f318e565f2
vkd3d-shader/spirv: Decorate non-array descriptor variables as well.
...
Commits 343c7942e1
and
94c74d2c00
moved applying the NonReadable
and Coherent decorations from spirv_compiler_emit_resource_declaration()
to spirv_compiler_build_descriptor_variable(), but unfortunately missed
the non-array path in the latter function.
The missing NonReadable decoration causes segmentation faults in
rasteriser-ordered-views.shader_test (among others) on my Intel SKL GT2
setup in particular.
2024-08-26 11:24:01 +02:00
Conor McCarthy
80e607e3e7
vkd3d: Free descriptor range information on error paths in d3d12_root_signature_info_from_desc(). (Valgrind)
...
Fixes memory leaks in test_create_root_signature().
2024-08-26 11:20:54 +02:00
Conor McCarthy
738ecc9eb1
vkd3d-shader/spirv: Free the spirv parameter info.
2024-08-20 21:27:58 +02:00
Anna (navi) Figueiredo Gomes
94c74d2c00
vkd3d-shader/spirv: Avoid decorating variables multiple times with Coherent.
2024-08-20 21:25:15 +02:00
Anna (navi) Figueiredo Gomes
a47c23fa1f
vkd3d-shader/spirv: Use unique SPIR-V variables for descriptors where visibility differs.
...
In the case two uav descriptors are mapped to the same variable, and one is
read from while the other is not, the variable would get the NonReadable
decorator, while being read from later.
2024-08-20 21:23:31 +02:00
Anna (navi) Figueiredo Gomes
343c7942e1
vkd3d-shader/spirv: Avoid decorating variables multiple times with NonReadable.
...
The existing code reuses the same SPIR-V variable for all descriptors mapped to
the same Vulkan binding, and applies the NonReadable decoration based on the
VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ only. This potentially causes the
decoration to be applied twice, should two non-read descriptors be mapped to
the same variable, which isn't allowed in SPIR-V, and the validator complains.
2024-08-20 21:20:33 +02:00
Nikolay Sivov
c8cc1b1a24
vkd3d-shader/fx: Fix the matrix type class for fx_2_0.
...
CTAB type correctly reflects matrix majority, unlike effects
type data that does not respond to majority modifiers at all.
It doesn't transpose default values either.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-19 14:21:59 +02:00
Nikolay Sivov
f0a2e4bc25
vkd3d-shader/glsl: Fix a typo in a few messages.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-19 14:20:21 +02:00
Nikolay Sivov
d1b8a7e745
vkd3d: Fix a few typos in the comments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-19 14:17:41 +02:00
Petrichor Park
4467c655f0
vkd3d-shader/hlsl: Factor out add_binary_expr() and use it for assignment operators.
...
This fixes a lot of internal compiler errors with assignment operators,
especially bitwise ones. The bitwise-assignment test has the motivating
examples.
2024-08-19 14:15:43 +02:00
Nikolay Sivov
ebc039d128
vkd3d-shader/fx: Resolve NULL values for SamplerState.Texture field.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
873b182021
vkd3d-shader/fx: Support NULL constants for object fields.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
c3075d6fb4
vkd3d-shader/hlsl: Adjust NULL type properties to make it usable in transformations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
aa0ea548e4
vkd3d-shader/fx: Handle SetPixelShader() and SetVertexShader().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
2c533e494a
vkd3d-shader/fx: Handle SetBlendState().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Anna (navi) Figueiredo Gomes
16e9872718
vkd3d: Use D3D12_SHADER_VISIBILITY_ALL for 32-bit root constants when using vk_heaps.
...
The existing code sets "stageFlags" to VK_SHADER_STAGE_ALL when
"use_vk_heaps" is true, but doesn't adjust the visibility. This
potentially violates the "Any two elements of pPushConstantRanges must
not include the same stage in stageFlags" constraint, and causes the
validation layers to complain accordingly.
2024-08-15 17:53:46 +02:00
Nikolay Sivov
60ce81112b
vkd3d-shader/fx: Support string annotations for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
d4ae844bb6
vkd3d-shader/fx: Enable writing string objects for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
89be723ad7
vkd3d-shader/hlsl: Treat "string" type name as case-insensitive.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
1ce68cee2c
vkd3d-shader/hlsl: Tokenize 'String' the same as 'string'.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Francisco Casas
412f91a14c
vkd3d-shader/hlsl: Always work with the extern resource's component type.
...
We need to distinguish between the data type of a resource and the data
type of its components. These are usually the same except for 4.0
profiles where an array (or multi-dimensional array) of resources is
still considered a single resource, so it is possible for it to hold
more than one component.
In the latter case, we often need to access the type of a single
component (all components have the same type) instead of the type of the
whole array which often doesn't contain the required information, such
as sampler dimension.
This patch replaces the extern_resource.data_type field with the
extern_resource.component_type field, which points to the type of a
single component in the resource. Using it relieves many other code
paths from considering the possibility of the resource being an array.
This fixes runtime errors reported by UBSan, such as this:
vkd3d/libs/vkd3d-shader/tpf.c:6075:87: runtime error: load of value 7, which is not a valid value for type '_Bool'
when trying to compile shaders that contain UAV arrays on 4.0 profiles.
Before this commit, tpf.c accesses the
hlsl_type->e.resource.rasteriser_ordered
field, but on 4.0 and 4.1 profiles these code paths can also be reached
by UAV arrays which are HLSL_CLASS_ARRAY and this field is not supposed
to be accessed.
By coincidence, the value of hlsl_type->e.array.elements_count was being
read because these fields have the same offset in the hlsl_type.e union.
2024-08-14 21:57:21 +02:00
Henri Verbeet
9cf479d4bb
vkd3d: Do not include assert.h.
2024-08-13 21:20:28 +02:00
Henri Verbeet
114578fc8a
vkd3d-shader/fx: Replace assert() with VKD3D_ASSERT().
2024-08-13 21:20:28 +02:00
Henri Verbeet
cd9879f237
vkd3d-common: Replace assert() with VKD3D_ASSERT().
2024-08-13 21:20:28 +02:00
Francisco Casas
355d4c4a86
vkd3d-shader/hlsl: Skip writing string default values.
...
This causes a crash in the native compiler, but can only happen in
ps_5_0 were it is possible to declare structs that are both used in the
shader and contain strings.
struct
{
float a;
string b;
} apple = {1, "foobar"};
float4 main() : sv_target
{
return apple.a;
}
In our case, hlsl_type_get_component_offset() triggered an assertion
failure because it does not expect the string type. So this is replaced
by an hlsl_error().
2024-08-13 21:19:04 +02:00
Francisco Casas
094e298c1c
vkd3d-shader/hlsl: Parse string default values.
2024-08-13 21:19:01 +02:00
Nikolay Sivov
b4d957f848
vkd3d-shader/hlsl: Handle NULL constants.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:45 +02:00
Nikolay Sivov
d945d5e78c
vkd3d-shader/hlsl: Check MS texture declaration without sample count only for used variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:29 +02:00
Anna (navi) Figueiredo Gomes
80b2a2eb55
vkd3d-shader/ir: Periodically flush buffers when tracing blocks.
...
Avoids overflowing the output buffer for the trace in cases where the
output is too long, which raises an exception.
2024-08-12 14:19:13 +02:00
Nikolay Sivov
b0ca3627bf
vkd3d-shader/fx: Turn assignments to arrays to element assignments for certain states.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
25e1c3e374
vkd3d-shader/fx: Explicitly handle bool values in state entries.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
c81223d086
vkd3d-shader/fx: Handle states of a BlendState object.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
2affc8f5c5
vkd3d-shader/fx: Run full set of constants passes on state block entries values.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
f1e65ecc83
vkd3d-shader/fx: Enable writing BlendState variables.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
91e88fac2e
vkd3d-shader/hlsl: Add parser support for BlendState type.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
1be0d99b76
vkd3d-shader/fx: Check destination array index when checking for duplicate state entries.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
b23874dad6
vkd3d-shader/hlsl: Add parser support for GeometryShader type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Nikolay Sivov
de48960b33
vkd3d-shader/fx: Add support for the OMSetRenderTargets() state.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
c565a60b9e
vkd3d-shader/fx: Add an array size field to the states description table.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
d55a709992
vkd3d-shader/fx: Use more descriptive names for FX-specific types.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
9fb23b9090
vkd3d-shader/fx: Handle "Texture" field of the sampler state objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Giovanni Mascellani
8b6ab9627d
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in vkd3d_shader_private.h.
2024-08-08 23:39:23 +02:00
Giovanni Mascellani
27bceec965
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in vkd3d_shader_main.c.
2024-08-08 23:39:23 +02:00
Giovanni Mascellani
0294aa62f3
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in tpf.c.
2024-08-08 23:38:02 +02:00
Giovanni Mascellani
d5126b4d98
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in spirv.c.
2024-08-08 23:36:23 +02:00
Victor Chiletto
8c3a5e5458
vkd3d-shader/hlsl: Implement f16tof32 intrinsic.
2024-08-08 23:35:02 +02:00
Victor Chiletto
693e89c74e
vkd3d-shader/hlsl: Push a new scope when compiling internal functions.
...
This allows for typedef usage without interfering with user code.
Thanks Zeb for the suggestion.
2024-08-08 23:35:02 +02:00
Francisco Casas
016be7e591
vkd3d-shader/hlsl: Lower non-constant row_major matrix loads for SM1.
2024-08-08 23:33:33 +02:00
Francisco Casas
87f01f5205
vkd3d-shader/hlsl: Remove SM1 fixme for matrix writemasks.
...
hlsl_ir_store instructions don't use writemasks for whole matrices.
2024-08-08 23:32:03 +02:00
Francisco Casas
9f515a9daa
vkd3d-shader/hlsl: Lower non-constant array loads for SM1.
...
This is achieved by means of creating a variable storing zero,
loading every array element, comparing if the non-constant index
matches the index of that element at runtime, and in that case
store the corresponding element in the variable.
This seems to be the same strategy that the native compiler uses.
2024-08-08 23:30:39 +02:00
Francisco Casas
eb2d320596
vkd3d-shader/hlsl: Avoid dereferencing rel_offset if it is NULL.
...
We are currently using &offset_node->loc when offset_node is NULL.
A NULL dereference of rel_offset can also happen if
hlsl_offset_from_deref() fails because the dereference is out of
bounds.
2024-08-08 23:28:31 +02:00
Francisco Casas
e8354ac499
vkd3d-shader/hlsl: Parse string type.
2024-08-07 15:53:07 +02:00
Francisco Casas
652db433e1
vkd3d-shader/hlsl: Parse string escape sequences.
2024-08-07 15:51:43 +02:00
Francisco Casas
090df488ba
vkd3d-shader/hlsl: Parse string constants.
2024-08-07 15:48:59 +02:00
Nikolay Sivov
c44a18b3d1
vkd3d-shader/fx: Add support for SetDomainShader(), SetComputeShader(), and SetHullShader() states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
1559237780
vkd3d-shader/fx: Fix state block entry array shifting when decomposing.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
7c3677b114
vkd3d-shader/hlsl: Add parser support for ComputeShader, DomainShader, and HullShader types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
2cbad81b55
vkd3d-shader/fx: Handle SetRasterizerState().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Giovanni Mascellani
784e69a366
vkd3d: Check the entire root signature for register conflicts.
...
Not just each descriptor table individually.
2024-08-06 16:53:06 +02:00
Nikolay Sivov
a3f4785720
vkd3d-shader/fx: Decompose function-style state assignments to individual states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-05 16:01:33 +02:00
Stefan Dösinger
d4c2a7f22b
vkd3d: Pass a proper struct shader_cache_key * to rb_put() in vkd3d_shader_cache_add_entry().
2024-08-05 15:59:53 +02:00
Giovanni Mascellani
46aec9fba8
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.y.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
625327653b
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.l.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
351220f182
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.h.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
4a04324ecc
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in ir.c.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
5e1ae5aaa3
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.y.
2024-08-05 15:57:56 +02:00
Giovanni Mascellani
97a7ec8914
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.h.
2024-08-05 15:57:56 +02:00
Conor McCarthy
969cae8b67
vkd3d: Add support for the ID3D12CommandList6 interface.
2024-08-05 15:56:09 +02:00
Giovanni Mascellani
9ff5b2ce7a
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
4e7d0faaf0
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl_constant_ops.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
eff30577af
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl_codegen.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
02ef731b9a
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in fx.c.
2024-08-01 15:18:15 +02:00
Giovanni Mascellani
7d3e8f49e4
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in dxil.c.
2024-08-01 15:18:15 +02:00
Francisco Casas
e6e82ad3f6
vkd3d-shader/hlsl: Add missing src1 and src2 constants to sincos on SM2.
...
The sincos instruction expects two specific constants on 2.0 and 2.1 profiles.
Consider the following shader:
uniform float u;
float4 main() : sv_target
{
return sin(u);
}
On native, with ps_2_0, this compiles as:
ps_2_0
def c3, 0.159154937, 0.5, 6.28318548, -3.14159274
def c1, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668
def c2, -0.020833334, -0.125, 1, 0.5
mov r0.xy, c3
mad r0.x, c0.x, r0.x, r0.y
frc r0.x, r0.x
mad r0.x, r0.x, c3.z, c3.w
sincos r1.y, r0.x, c1, c2
mov r0, r1.y
mov oC0, r0
We are not emitting the src1 and src2 constant arguments before this
patch.
2024-07-31 22:22:38 +02:00
Giovanni Mascellani
4094e5dbeb
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in dxbc.c.
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
bcffcb4a29
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in d3dbc.c
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
8e08fa6bf2
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in d3d_asm.c.
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
5af138b247
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in checksum.c.
2024-07-30 16:32:59 +02:00
Giovanni Mascellani
ba381497cc
vkd3d-common: Remove an assertion in vkd3d_dbg_printf().
...
We want to get rid of assertions and only use the new VKD3D_ASSERT(),
but this cannot be done here, because a failing VKD3D_ASSERT() would
call back again to vkd3d_dbg_printf().
At the same time the asserted condition should be simple enough to
debug even without the assertion, since logging with a bad level
will likely result in either a crash or writing garbage to the log.
2024-07-30 16:32:59 +02:00
Atharva Nimbalkar
2170fdc633
vkd3d-shader/glsl: Implement support for VKD3DSPR_TEMP registers.
2024-07-30 16:31:59 +02:00
Atharva Nimbalkar
337a030908
vkd3d-shader/glsl: Implement VKD3DSIH_MOV.
2024-07-30 16:31:59 +02:00
Henri Verbeet
c7589d8f19
vkd3d-shader/ir: Remove VKD3DSIH_DCL_SAMPLER instructions.
2024-07-30 16:31:44 +02:00
Henri Verbeet
fffe521b80
vkd3d-shader/ir: Remove VKD3DSIH_DCL instructions.
2024-07-30 16:31:44 +02:00
Giovanni Mascellani
240d31c793
vkd3d: Replace assert() with VKD3D_ASSERT() in vkd3d_private.h.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
529647142c
vkd3d: Replace assert() with VKD3D_ASSERT() in utils.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
bd75396b38
vkd3d: Replace assert() with VKD3D_ASSERT() in state.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
02b898bec0
vkd3d: Replace assert() with VKD3D_ASSERT() in resource.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
150bf69da9
vkd3d: Replace assert() with VKD3D_ASSERT() in command.c.
2024-07-29 19:12:13 +02:00
Giovanni Mascellani
51b65688e1
ci: Abort on assertions on the CI.
2024-07-29 13:17:19 +02:00
Giovanni Mascellani
d7fc2693c4
vkd3d: Introduce a softer form of assertion.
...
Triggering an ERR() instead of aborting the program.
2024-07-29 13:17:19 +02:00
Giovanni Mascellani
a484063cd2
vkd3d: Introduce debug severity MESSAGE.
...
That's intended for messages that it's pretty important that the
user receives, but that are not proper error messages.
2024-07-29 13:17:19 +02:00
Elizabeth Figura
ae5cd6573f
vkd3d-shader: Allow controlling d3d color shade mode through vkd3d-shader parameters.
2024-07-24 16:08:10 +02:00
Elizabeth Figura
d20d0fc69f
vkd3d-shader: Use the program parameters in spirv_compiler_alloc_spec_constant_id().
2024-07-24 16:07:13 +02:00
Victor Chiletto
a0de05f0b4
vkd3d-shader/hlsl: Implement the asint() intrinsic.
2024-07-24 16:06:03 +02:00
Nikolay Sivov
91dce79227
vkd3d-shader/fx: Correct one of the object counters in the fx_2_0 header.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-24 16:04:21 +02:00
Elizabeth Figura
97cd941710
vkd3d-shader: Do not make the alpha test ref parameter VSIR_DIMENSION_VEC4.
2024-07-23 21:12:28 +02:00
Elizabeth Figura
1db7c03185
vkd3d-shader/spirv: Pass a vkd3d_data_type to spirv_compiler_emit_shader_parameter().
2024-07-23 21:11:15 +02:00
Elizabeth Figura
f6dd6d52b3
vkd3d-shader: Factor out a vsir_program_get_parameter() helper.
2024-07-23 21:10:00 +02:00
Elizabeth Figura
6b58b6f261
vkd3d-shader/spirv: Allocate output_info after normalization.
...
Normalization may change the signatures.
2024-07-23 21:09:00 +02:00
Shaun Ren
49caeee1fd
vkd3d-shader/hlsl: Support default values for function parameters.
2024-07-23 15:36:32 +02:00
Nikolay Sivov
29699d3d22
vkd3d-shader/fx: Set total pass count for fx_2_0.
...
Binaries with that field set incorrectly fail to load on Windows.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Nikolay Sivov
dcf4ce753b
vkd3d-shader/fx: Correct empty pass check.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Nikolay Sivov
958117df2f
vkd3d-shader/hlsl: Allow annotations on global variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Giovanni Mascellani
ba0fec4c51
vkd3d: Propagate errors out of d3d12_root_signature_append_vk_binding().
2024-07-22 16:01:37 +02:00
Giovanni Mascellani
4b7fe26b33
vkd3d: Remove the temporary pointers in vkd3d_physical_device_info_init().
...
They were rather pointless now.
2024-07-22 16:00:28 +02:00
Giovanni Mascellani
75c64e55cd
vkd3d: Rebuild the vkd3d_physical_device_info chain before creating the device.
...
vkd3d might decide to disable some extensions after the chain is created,
so the chain must be recreated with only the structures corresponding to
enabled extensions.
2024-07-22 16:00:28 +02:00
Giovanni Mascellani
a876e0b192
vkd3d: Allocate temporary arrays on the stack in d3d12_command_list_update_push_descriptors().
2024-07-17 15:52:37 +02:00
Conor McCarthy
ae0faf4500
vkd3d: Limit the workgroup X count for buffer UAV clears to the supported max.
2024-07-17 15:51:39 +02:00
Conor McCarthy
15f8657d74
vkd3d: Create a descriptor pool for static samplers when Vulkan-backed heaps are used.
...
Static samplers may be allocated from these pools.
2024-07-17 15:50:24 +02:00
Shaun Ren
0202393d41
vkd3d-shader/d3dbc: Implement HLSL_OP1_{COS,SIN}_REDUCED for SM1.
...
Also enable SM1 trigonometry function tests.
2024-07-16 19:03:52 +02:00
Shaun Ren
ea2ffc0b6c
vkd3d-shader/hlsl: Allocate registers for HLSL_OP1_{COS,SIN}_REDUCED with the required writemasks.
2024-07-16 19:02:01 +02:00
Shaun Ren
8724cbe5d5
vkd3d-shader/d3dbc: Implement HLSL_OP3_MAD for SM1.
2024-07-16 18:56:44 +02:00
Shaun Ren
b4845b9dca
vkd3d-shader/hlsl: Implement sin/cos for SM1.
...
Also introduce HLSL_OP3_MAD.
2024-07-16 18:55:22 +02:00
Shaun Ren
b3a11a9ec4
vkd3d-shader/ir: Lower SM1 SINCOS to SM4 SINCOS.
2024-07-16 15:24:58 +02:00
Elizabeth Figura
806363b765
vkd3d-shader: Allow controlling alpha test through vkd3d-shader parameters.
2024-07-11 17:02:11 +02:00
Elizabeth Figura
c2ce15b623
vkd3d-shader/spirv: Respect VKD3D_SHADER_CONDITIONAL_OP_Z when discard has a bool argument.
2024-07-11 16:59:06 +02:00
Elizabeth Figura
e8bdac8147
vkd3d-shader/spirv: Support passing shader parameters through uniform buffers.
2024-07-11 16:58:52 +02:00
Elizabeth Figura
98def3214b
vkd3d-shader: Introduce struct vkd3d_shader_parameter_info and struct vkd3d_shader_parameter1.
...
As the newly added documentation describes, this reroll serves two purposes:
* to allow shader parameters to be used for any target type (which allows using
parameters for things like Direct3D 8-9 alpha test),
* to allow the union in struct vkd3d_shader_parameter to contain types larger
than 32 bits (by specifying them indirectly through a pointer).
2024-07-11 16:48:09 +02:00
Petrichor Park
bec4f413dc
vkd3d-shader/tpf: Implmenent HLSL_OP1_RCP.
...
SM5 comes with a RCP opcode; for SM4, implement it as `DIV dst, 1, x`.
2024-07-11 16:44:16 +02:00
Petrichor Park
b3f0cd5788
vkd3d-shader/hlsl: Implement the rcp() intrinisic.
...
SM1 already has the RCP opcode implemented; SM4 implementation is in the
next commit.
2024-07-11 16:44:02 +02:00
Nikolay Sivov
c792114a6a
vkd3d-shader/fx: Do not output empty strings for missing semantics for fx_2_0.
...
This is directly visible in parameter description. For a parameter without semantic
it should return null, instead of a pointer to an empty string.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:36:05 +02:00
Giovanni Mascellani
9ebf779ef0
vkd3d: Propagate a failure in d3d12_descriptor_heap_init().
2024-07-11 00:34:58 +02:00
Elizabeth Figura
59f770214a
vkd3d-shader/hlsl: Implement output SV_Coverage.
2024-07-11 00:33:57 +02:00
Elizabeth Figura
71a3d55e8c
vkd3d-shader/hlsl: Implement the GetRenderTargetSampleCount() intrinsic.
2024-07-11 00:33:57 +02:00
Victor Chiletto
2034a8bab9
vkd3d-shader/hlsl: Implement loop unrolling.
...
Based on a patch by Nikolay Sivov.
Co-authored-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:32:53 +02:00
Victor Chiletto
7edd7dcf79
vkd3d-shader/hlsl: Allow cloned blocks to contain external references.
2024-07-11 00:32:53 +02:00
Victor Chiletto
5bc56d43bb
vkd3d-shader/hlsl: Parse loop and unroll loop attributes.
...
Based on a patch by Nikolay Sivov.
Co-authored-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:32:53 +02:00
Victor Chiletto
323f53bd7d
vkd3d-shader/hlsl: Pull evaluate_static_expression_as_uint() upwards.
2024-07-11 00:32:53 +02:00
Victor Chiletto
50e28f70ed
vkd3d-shader/hlsl: Defer bounds checks to after copy propagation.
...
We potentially generate OOB accesses during loop unrolling that are later deleted.
2024-07-11 00:32:53 +02:00
Victor Chiletto
317bd46efd
vkd3d-shader/hlsl: Use a switch in validate_static_object_references().
2024-07-11 00:32:49 +02:00
Victor Chiletto
67c690aa07
vkd3d-shader/d3dbc: Fix implicit enum conversion warning.
...
This slipped through and broke CI.
2024-07-10 00:06:14 +02:00
Petrichor Park
746222b349
vkd3d-shader/hlsl: Implement the faceforward() intrinsic.
2024-07-09 20:43:41 +02:00
Francisco Casas
60c8a813a3
vkd3d-shader/hlsl: Validate state block function calls.
2024-07-09 20:38:08 +02:00
Francisco Casas
b5f2e7daeb
vkd3d-shader/hlsl: Parse function call syntax on state blocks.
2024-07-09 20:36:28 +02:00
Francisco Casas
7bd53cf6d9
vkd3d-shader/hlsl: Free array sizes on function parameters (Valgrind).
2024-07-09 20:32:25 +02:00
Francisco Casas
b92baa40ec
vkd3d-shader/d3dbc: Don't write inconsequential MOVs.
...
CASTs from floats to integers are implemented as mere MOVs. These often,
but not always, end up moving the value from one register to the same
register.
This patch avoids writing the MOV instructions if they have no effect.
2024-07-09 20:32:25 +02:00
Francisco Casas
daa13934a4
vkd3d-shader/d3dbc: Use vsir_program I/O signatures to write dcls.
...
Instead of relying on ctx->extern vars, semantics are now stored in the
vsir_program signatures, and then read to write the declarations.
2024-07-09 20:31:14 +02:00
Francisco Casas
704ce03561
vkd3d-shader/d3dbc: Don't require a hlsl_semantic to get register and usage.
2024-07-09 20:12:47 +02:00
Francisco Casas
003f4c7600
vkd3d-shader/d3dbc: Use program->shader_version instead of ctx->profile.
2024-07-09 20:06:23 +02:00
Francisco Casas
a333090288
vkd3d-shader/d3dbc: Introduce struct d3dbc_compiler.
2024-07-09 19:44:03 +02:00
Francisco Casas
dd8aa2ec91
vkd3d-shader/hlsl: Generate CTAB outside d3dbc_compile().
...
There is no way to store this information from the vsir_program alone,
so we make d3dbc_compile() expect the CTAB blob.
2024-07-09 18:59:54 +02:00
Francisco Casas
130b3335cb
vkd3d-shader/d3dbc: Split hlsl_sm1_write().
...
The idea is to start splitting the
HLSL IR -> d3dbc
translation into
HLSL IR -> vsir -> d3dbc
So hlsl_sm1_write is split into two functions, sm1_generate_vsir()
which should handle the first part and d3dbc_compile() which should
handle the second part.
This translation should be completed once the hlsl_ctx and entry_func
are no longer used in d3dbc_compile().
2024-07-09 18:38:00 +02:00
Zebediah Figura
6db2bc3eff
vkd3d-shader/d3dbc: Use enum vkd3d_shader_register_type in struct sm1_instruction.
2024-07-09 16:59:02 +02:00
Nikolay Sivov
3dc43e8945
vkd3d-shader: Disallow object structure fields for fx profiles.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:28 +02:00
Giovanni Mascellani
7958babb39
vkd3d: Do not synchronize with the tessellation shader stages if they're not enabled.
...
Similarly to a54187f3c9
, this fixes some validation
errors on devices that do not support tessellation; the Adreno 540 on my OnePlus 5
phone in my specific case.
2024-07-08 18:49:28 +02:00
Nikolay Sivov
937a80ead6
vkd3d-shader/fx: Write annotations for fx_4+ profiles.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:28 +02:00
Nikolay Sivov
0f7ac0a054
vkd3d-shader/hlsl: Set default values for annotations variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:06 +02:00
Nikolay Sivov
4d2ce385a7
vkd3d-shader/hlsl: Do not crash on initialization of a redefined variable.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
0a344bd3c9
vkd3d-shader/fx: Add missing fields for structure types on fx_5_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
8738e4662e
vkd3d-shader/fx: Preserve parsing order of initializer components.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
c97c652ff0
vkd3d-shader/fx: Fix packed size for fx_4+ types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
856686b2a2
vkd3d-shader/fx: Write default numeric values.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
aea36be94c
vkd3d-shader/fx: Fix structure type data written for fx_4.
...
Strings and field types are written to the same unstructured area
as structure type itself, so it has to be done in two passes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
2176294df8
vkd3d-shader/hlsl: Implement tex*grad() functions.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Nikolay Sivov
4ff288bd32
vkd3d-shader: Implement tex*() functions variants with gradient arguments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Elizabeth Figura
4cd2dd50f9
vkd3d-shader/hlsl: Separate an "array" rule.
2024-07-08 18:22:39 +02:00
Nikolay Sivov
94130c2394
vkd3d-shader/fx: Add support for writing RasterizerState objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
f03cb7e911
vkd3d-shader/hlsl: Add RasterizerState type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
12947aa50d
vkd3d-shader/fx: Add support for writing DepthStencilState objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
1008c49ce6
vkd3d-shader/fx: Cast state block field values to target type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Francisco Casas
597e55691a
vkd3d-shader/hlsl: Only error out on bind_count register reservation overlaps for SM1.
...
While on SM1 a register reservation reserves the whole size in
registers of the variable's data type, overlapping conflicts are only
checked up to the bind_count (used size) for each variable.
2024-07-08 18:12:03 +02:00
Nikolay Sivov
48ff7de8ef
vkd3d-shader/hlsl: Add support for ConstantBuffer<> type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Victor Chiletto
abbcf0461f
vkd3d-shader/hlsl: Reserve register slots for unused buffers.
2024-07-03 17:09:16 -03:00
Victor Chiletto
da36a447b8
vkd3d-shader/hlsl: Validate cbuffer register allocations.
2024-07-03 17:09:16 -03:00
Victor Chiletto
27414ef928
vkd3d-shader/hlsl: Do not immediately fail parsing for malformed 'b' register reservations.
...
This is a fxc quirk. In most cases, this throws an error, but for global
variables it's completely ignored.
2024-07-03 17:09:16 -03:00
Victor Chiletto
b5b3c8b9ff
vkd3d-shader/hlsl: Ignore bracket offsets for 'b' register types prior to SM 5.1.
...
This is a fxc quirk that was fixed for SM >= 5.1 only.
2024-07-03 14:34:45 -03:00
Victor Chiletto
8fb3b604bf
vkd3d-shader/hlsl: Pass a pointer to struct hlsl_reg_reservation in parse_reservation_index.
...
Instead of passing the struct components individually.
2024-07-03 14:05:58 -03:00
Victor Chiletto
e13eb64d4c
vkd3d-shader/hlsl: Support expressions as register offsets.
2024-07-03 14:05:58 -03:00
Yuxuan Shui
ccb6150aab
vkd3d-shader/hlsl: Implement storing to a swizzled matrix.
2024-06-20 12:39:46 +02:00
Elizabeth Figura
acc9d79fbb
vkd3d-shader/hlsl: Only allocate the aligned size for uniforms.
2024-06-18 13:19:44 -05:00
Elizabeth Figura
7fe581203b
vkd3d-shader/hlsl: Respect the coords writemask in write_sm1_resource_load().
...
Spotted by Francisco Casas.
2024-06-18 13:19:44 -05:00