Henri Verbeet
e69f3da089
vkd3d-shader/hlsl: Set the "has_point_size" flag for vertex shaders outputting point sizes.
2025-09-11 16:09:46 +02:00
Henri Verbeet
84d3a8d167
vkd3d-shader/hlsl: Use VKD3DSPR_COMBINED_SAMPLER destination operands in sm1_generate_vsir_sampler_dcls().
...
That's what the d3d-asm target expects in shader_print_dcl_usage(), and
what vkd3d_shader_scan() requires to create correct descriptor
information.
2025-09-11 16:09:46 +02:00
Henri Verbeet
4569a9d5ba
vkd3d-shader/hlsl: Set the "flat constant" count in sm1_generate_vsir().
...
Aside from being required in order to produce valid vsir, this is used
by vsir_program_scan() to generate descriptor information.
2025-09-11 16:09:46 +02:00
Henri Verbeet
2b5dc156c7
vkd3d-shader/hlsl: vsir constant buffer sizes are specified in bytes.
2025-09-11 16:09:46 +02:00
Henri Verbeet
7c0b70db85
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_resource_declaration().
2025-09-11 16:08:58 +02:00
Henri Verbeet
06dadcfb42
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_cbv_declaration().
2025-09-11 16:08:58 +02:00
Henri Verbeet
3a6ebfa826
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_push_constant_buffers().
2025-09-11 16:08:58 +02:00
Henri Verbeet
91e69f41cf
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_dcl_indexable_temp().
2025-09-11 16:08:58 +02:00
Henri Verbeet
f9d473b4fe
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_shader_epilogue_function().
2025-09-11 16:08:58 +02:00
Henri Verbeet
de2095fda4
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_throw_invalid_dst_type_error_with_flags().
2025-09-10 11:59:04 +02:00
Henri Verbeet
b326097473
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_shift_operation().
2025-09-10 11:59:04 +02:00
Henri Verbeet
e7f3547c24
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_cast_operation().
2025-09-10 11:59:04 +02:00
Henri Verbeet
81f229146c
vkd3d-shader/ir: Handle all component types in vsir_data_type_from_component_type().
2025-09-10 11:42:21 +02:00
Henri Verbeet
db704d2980
vkd3d-shader/spirv: Handle i64 component types.
2025-09-10 11:42:21 +02:00
Elizabeth Figura
446b59319b
vkd3d-utils: Null-terminate the output of D3DPreprocess().
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58596
2025-09-10 11:40:03 +02:00
Elizabeth Figura
f52dc8a89a
vkd3d-utils: Null-terminate the output of D3DDisassemble().
2025-09-10 11:40:03 +02:00
Elizabeth Figura
df1c94dd60
vkd3d-shader: Document the null terminator appended for textual formats.
...
vkd3d_string_buffer uses vsnprintf() and therefore null-terminates when
appending, so no code changes are necessary.
2025-09-10 11:39:43 +02:00
Elizabeth Figura
bb7c95f7d6
tests: Test special characters.
2025-09-10 11:09:04 +02:00
Elizabeth Figura
7fe82bcd85
tests: Test null-termination.
2025-09-10 11:05:01 +02:00
Henri Verbeet
d26f75f12c
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_load_invocation_id().
2025-09-09 15:02:08 +02:00
Henri Verbeet
361404a1d1
vkd3d-shader/spirv: Use spirv_get_type_id() in frag_coord_fixup().
2025-09-09 15:02:08 +02:00
Henri Verbeet
34dbf38e83
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_draw_parameter_fixup().
2025-09-09 15:02:08 +02:00
Henri Verbeet
f13c2932de
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_bool_to_double().
2025-09-09 15:02:08 +02:00
Henri Verbeet
d98bbb2a9d
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_bool_to_float().
2025-09-09 15:02:08 +02:00
Henri Verbeet
e569245e1f
vkd3d-shader/hlsl: Implement constant folding of 'round' expressions.
2025-09-09 14:59:11 +02:00
Henri Verbeet
5a8a2bb15f
tests/hlsl: Add a constant folding test for round().
2025-09-09 14:59:11 +02:00
Henri Verbeet
23ee29a953
vkd3d-shader/hlsl: Implement constant folding of 'reinterpret' expressions.
...
As encountered in tests/hlsl/frexp.shader_test.
2025-09-09 14:59:11 +02:00
Henri Verbeet
e330ad2ac7
vkd3d-shader/hlsl: Implement constant folding of 'cos' expressions.
...
As encountered in tests/hlsl/trigonometry.shader_test.
2025-09-09 14:59:01 +02:00
Henri Verbeet
08e7806b7f
vkd3d-shader/hlsl: Implement constant folding of 'sin' expressions.
...
As encountered in tests/hlsl/trigonometry.shader_test.
2025-09-09 14:51:15 +02:00
Henri Verbeet
d7a05d823c
vkd3d-shader/hlsl: Implement constant folding of 'mad' expressions.
...
As encountered in tests/hlsl/trigonometry.shader_test.
2025-09-09 14:51:15 +02:00
Francisco Casas
7f4a186e6a
vkd3d-shader/ir: Use iterators in struct vsir_cfg.
...
And therefore on the functions that use it, namely
vsir_program_structurize() and
vsir_program_materialize_undominated_ssas_to_temps() and their callees.
2025-09-09 14:51:15 +02:00
Francisco Casas
1aa6c767ea
vkd3d-shader/ir: Merge the hull shader phase flattener into a single pass.
2025-09-09 14:50:34 +02:00
Francisco Casas
434d9dd117
vkd3d-shader/ir: Use iterators in flattener_flatten_phases().
2025-09-09 14:24:06 +02:00
Henri Verbeet
bceb4d17ed
vkd3d-shader/ir: Move the instruction array helpers to ir.c.
2025-09-09 14:17:51 +02:00
Francisco Casas
952e706883
vkd3d-shader/ir: Use iterators in control_point_normaliser_emit_hs_input().
2025-09-09 12:40:06 +02:00
Francisco Casas
500d54d588
vkd3d-shader/ir: Avoid direct instruction array access in validation_error().
2025-09-09 12:31:12 +02:00
Giovanni Mascellani
05b5a48c1d
vkd3d-shader/msl: Reject UAV stores to multi-sampled resources.
...
Current versions of MSL don't support this, and it doesn't seem likely
that Direct3D source formats do either.
2025-09-09 12:10:44 +02:00
Giovanni Mascellani
26c51f53b7
vkd3d-shader/msl: Access resources as non-multisampled if the sample count is 1.
2025-09-09 12:08:36 +02:00
Henri Verbeet
6607b94ad7
vkd3d-shader/ir: Map 16-bit vsir types to 16-bit component types in vkd3d_component_type_from_data_type().
...
Mapping these to 32-bit types if needed is supposed to happen in the
frontends now.
2025-09-08 12:34:16 +02:00
Henri Verbeet
38078f2c51
vkd3d-shader/hlsl: Map HLSL_TYPE_HALF to VSIR_DATA_F32.
...
VSIR_DATA_F16 would require VKD3DSGF_FORCE_NATIVE_LOW_PRECISION, but we
don't currently implement that. vkd3d_component_type_from_data_type()
currently ends up doing this mapping for us in the SPIR-V backend, but
that's about to go away.
2025-09-08 12:34:16 +02:00
Henri Verbeet
ea90f7ae2e
vkd3d-shader/dxil: Emit 16-bit indexable temporaries as 32-bit registers.
...
Unless the "native low precision" flag is enabled.
vkd3d_component_type_from_data_type() currently ends up doing this
mapping for us in the SPIR-V backend, but that's about to go away.
2025-09-08 12:34:16 +02:00
Henri Verbeet
e3118110bf
vkd3d-shader/d3d-asm: Print data types for indexable temporary declarations.
2025-09-08 12:34:16 +02:00
Henri Verbeet
7851cbfd3d
vkd3d-shader/msl: Do not pretend to support initialisers for indexable temporaries.
2025-09-08 12:33:44 +02:00
Elizabeth Figura
0096ae43e1
vkd3d-shader/hlsl: Remove liveness range tracking from the allocator.
...
We no longer use it.
2025-09-04 14:04:27 +02:00
Elizabeth Figura
a44d79a13c
vkd3d-shader/hlsl: Use a simple counter for indexable temps.
2025-09-04 14:04:27 +02:00
Elizabeth Figura
8db9465693
vkd3d-shader/hlsl: Use unique temps for SINCOS.
2025-09-04 14:04:27 +02:00
Henri Verbeet
5f443593e3
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_bool_to_int64().
2025-09-04 14:03:34 +02:00
Henri Verbeet
441088e4df
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_bool_to_int().
2025-09-04 14:03:34 +02:00
Henri Verbeet
b9b883877d
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_int_to_bool().
2025-09-04 14:03:34 +02:00
Henri Verbeet
2a71e96a58
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_get_descriptor_index().
2025-09-04 14:03:34 +02:00
Henri Verbeet
0d8acc97a3
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_register_addressing().
2025-09-04 14:03:34 +02:00
Henri Verbeet
cba58fdb59
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_comparison_operation().
2025-09-04 14:02:51 +02:00
Henri Verbeet
535837ebfe
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_elementwise_operation().
2025-09-04 14:02:51 +02:00
Henri Verbeet
6e68f29fa7
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_src_param().
2025-09-04 14:02:51 +02:00
Henri Verbeet
8c94dc871d
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_dst_param().
2025-09-04 14:02:51 +02:00
Henri Verbeet
eb5347278e
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_ssa_register().
2025-09-04 14:02:51 +02:00
Shaun Ren
d8ea8894ab
vkd3d-shader/hlsl: Support SM1 non-floating point CMP expressions.
2025-09-04 13:58:57 +02:00
Shaun Ren
df5ccd3ff0
tests/hlsl: Test ternary operations with integral vector operands.
2025-09-04 13:57:48 +02:00
Victor Chiletto
f9f37e2973
tests/hlsl: Add a reflection test for SRV structured buffers.
2025-09-04 13:49:14 +02:00
Victor Chiletto
d5fdfa5f79
vkd3d-shader/hlsl: Emit RDEF metadata for SRV structured buffers.
2025-09-04 13:48:28 +02:00
Victor Chiletto
ba4027f18e
vkd3d-shader/hlsl: Force default majority for resource formats.
2025-09-04 13:39:46 +02:00
Victor Chiletto
8698874628
vkd3d-shader/hlsl: Emit vsir structured loads.
2025-09-04 13:39:03 +02:00
Victor Chiletto
ae450e5957
vkd3d-shader/hlsl: Use the packed byte size as the stride for structured buffer texture declarations.
2025-09-04 13:29:51 +02:00
Victor Chiletto
9bf94ff034
vkd3d-shader/hlsl: Emit texture declarations for SRV structured buffers.
2025-09-04 13:29:51 +02:00
Henri Verbeet
2aefcf5d99
vkd3d-shader/dxil: Use vkd3d_shader_parser_error() to report errors in vsir_data_type_from_dxil().
2025-09-03 13:04:21 +02:00
Henri Verbeet
fdc1edb647
vkd3d-shader/d3d-asm: Check the actual index count in shader_print_register().
...
vsir_register_init() does initialise offsets to ~0u, but at this point
that's not something that should be relied on.
2025-09-03 13:02:36 +02:00
Shaun Ren
1083b31dfd
vkd3d-shader/hlsl: Implement texCUBEbias().
2025-09-03 12:01:34 +02:00
Shaun Ren
b9545f7422
tests/hlsl: Add sample bias tests for cube textures.
2025-09-03 12:01:18 +02:00
Shaun Ren
d037b45718
tests/shader_runner: Allocate the d3d11/d3d12 resource_data arrays dynamically.
2025-09-03 11:58:42 +02:00
Shaun Ren
40789b32e7
tests/shader_runner: Correct the d3d11/d3d12 subresource indexing calculations.
...
See D3D11CalcSubresource()/D3D12CalcSubresource() for reference.
2025-09-03 11:57:53 +02:00
Shaun Ren
f6cebdb26d
tests/shader_runner: Correct the minification filter and mipmap mode calculations.
2025-09-03 11:55:36 +02:00
Henri Verbeet
d6bed4be37
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_get_buffer_parameter().
2025-09-02 11:36:37 +02:00
Henri Verbeet
b68096f52d
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_emit_spec_constant().
2025-09-02 11:36:37 +02:00
Henri Verbeet
c81b5398c2
vkd3d-shader/spirv: Use spirv_get_type_id() in spirv_compiler_get_type_id_for_reg().
2025-09-02 11:36:37 +02:00
Henri Verbeet
23c042f8ee
vkd3d-shader/spirv: Rename vkd3d_spirv_get_type_id_for_data_type() to spirv_get_type_id().
2025-09-02 11:36:37 +02:00
Henri Verbeet
3c006b2ae9
vkd3d-shader/spirv: Rename vkd3d_spirv_get_type_id() to spirv_get_type_id_for_component_type().
2025-09-02 11:36:37 +02:00
Henri Verbeet
744a49ea4d
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_uav_register().
2025-09-02 11:35:34 +02:00
Henri Verbeet
3443206235
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_resource_register().
2025-09-02 11:35:33 +02:00
Henri Verbeet
2be5348383
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_sampler_register().
2025-09-02 11:35:33 +02:00
Henri Verbeet
3063bbe3de
vkd3d-shader/ir: Use vsir_data_type_get_name() in vsir_validate_label_register().
2025-09-02 11:35:33 +02:00
Henri Verbeet
9f2e122239
vkd3d-shader/ir: Introduce vsir_data_type_get_name().
2025-09-02 11:35:33 +02:00
Elizabeth Figura
02d70be6ef
vkd3d-shader/hlsl: Use unique temps for per-component operations.
2025-09-02 11:33:25 +02:00
Elizabeth Figura
25ae2fcc84
vkd3d-shader/hlsl: Use unique temps for non-indexable variables.
2025-09-02 11:33:25 +02:00
Elizabeth Figura
933907d3b7
vkd3d-shader/ir: Reallocate temps.
2025-09-02 11:32:35 +02:00
Elizabeth Figura
887da605c5
vkd3d-shader/hlsl: Initialize the allocator with a type.
2025-09-02 11:26:30 +02:00
Henri Verbeet
979d7e4b85
vkd3d-shader/ir: Remove VSIR_OP_DCL_OUTPUT_TOPOLOGY instructions.
2025-09-01 15:15:32 +02:00
Henri Verbeet
392da43dd3
vkd3d-shader/ir: Remove VSIR_OP_DCL_INPUT_PRIMITIVE instructions.
2025-09-01 15:15:32 +02:00
Henri Verbeet
b9b9920593
vkd3d-shader/glsl: Implement support for VKD3DSPR_SAMPLEMASK registers.
2025-09-01 15:15:32 +02:00
Henri Verbeet
05b58c9963
vkd3d-shader/glsl: Handle SV_INSTANCE_ID inputs.
2025-09-01 15:15:32 +02:00
Henri Verbeet
9b375b3dae
vkd3d-shader/glsl: Implement VSIR_OP_UREM.
2025-09-01 15:15:32 +02:00
Henri Verbeet
71ed37f26d
vkd3d-shader/ir: Pass NULL locations to vkd3d_shader_error() in vsir_program_insert_vertex_fog().
2025-09-01 15:14:07 +02:00
Henri Verbeet
9d5cbd7efd
vkd3d-shader/ir: Pass NULL locations to vkd3d_shader_error() in vsir_program_insert_fragment_fog().
2025-09-01 15:14:06 +02:00
Henri Verbeet
ebeb216f00
vkd3d-shader/ir: Generate location information in vsir_program_insert_point_coord().
2025-09-01 15:14:06 +02:00
Henri Verbeet
b3162edea5
vkd3d-shader/ir: Pass NULL locations to vkd3d_shader_error() in vsir_program_insert_point_size_clamp().
2025-09-01 15:14:06 +02:00
Henri Verbeet
a63762c4d3
vkd3d-shader/ir: Pass a NULL location to vkd3d_shader_error() in vsir_program_insert_point_size().
2025-09-01 15:14:06 +02:00
Henri Verbeet
9497c6fb70
vkd3d-shader/ir: Pass NULL locations to vkd3d_shader_error() in vsir_program_insert_clip_planes().
...
And two "whole program" locations.
2025-09-01 15:14:06 +02:00
Francisco Casas
158f8b3cf6
vkd3d-shader/dxil: Use sm6_parser_add_instruction() in sm6_parser_descriptor_type_init().
2025-08-29 15:06:39 +02:00
Francisco Casas
1ee42bd406
vkd3d-shader/dxil: Use vsir_program_append() in sm6_parser_add_instruction().
2025-08-29 14:59:13 +02:00
Francisco Casas
49e189fec6
vkd3d-shader/dxil: Use vsir_program_append() in sm6_function_emit_blocks().
2025-08-29 14:59:13 +02:00
Francisco Casas
f2ac70fa60
vkd3d-shader/ir: Use iterators in vsir_program_lower_switch_to_selection_ladder().
2025-08-29 14:22:39 +02:00
Francisco Casas
9e72d8acb8
vkd3d-shader/ir: Introduce vsir_program_iterator_insert_before_and_move().
2025-08-29 14:22:39 +02:00
Giovanni Mascellani
11cf9e918a
vkd3d: Use MESSAGE when exceeding Vulkan descriptor limits in d3d12_command_list_update_descriptor_table().
...
Instead of using ERR. The intention here is to notify the user that the
Vulkan implementation isn't quite capable of doing what the application
requested, but when libvkd3d is compiled with -DVKD3D_ABORT_ON_ERR, ERR
will abort the process.
This allows running the tests on older NVIDIA GPUs with
-DVKD3D_ABORT_ON_ERR.
2025-08-28 20:08:50 +02:00
Henri Verbeet
d30c992039
vkd3d-shader/glsl: Implement VSIR_OP_UDIV_SIMPLE.
2025-08-28 20:06:32 +02:00
Henri Verbeet
86656b7544
vkd3d-shader/glsl: Implement VSIR_OP_SIN.
2025-08-28 20:06:32 +02:00
Henri Verbeet
ed438c1350
vkd3d-shader/glsl: Implement VSIR_OP_COS.
2025-08-28 20:06:32 +02:00
Henri Verbeet
9609903770
vkd3d-shader/glsl: Implement VSIR_OP_DSX and VSIR_OP_DSY.
2025-08-28 20:06:32 +02:00
Henri Verbeet
4c91f4aa9e
vkd3d-shader/glsl: Implement support for static texel offsets in shader_glsl_ld().
2025-08-28 20:06:32 +02:00
Henri Verbeet
a1edfc4008
vkd3d-shader/msl: Implement compute shaders.
2025-08-28 20:05:53 +02:00
Henri Verbeet
305c2c0db4
tests/shader_runner_metal: Implement compute shader dispatch.
2025-08-28 20:05:53 +02:00
Henri Verbeet
70cc85d98e
vkd3d-shader/ir: Pass NULL locations to vkd3d_shader_error() in vsir_program_insert_alpha_test().
2025-08-28 20:04:59 +02:00
Henri Verbeet
096b5ef80e
vkd3d-shader/ir: Pass a NULL location to vkd3d_shader_error() in insert_alpha_test_before_ret().
2025-08-28 20:04:59 +02:00
Henri Verbeet
25a4d849b8
vkd3d-shader/ir: Pass NULL locations to vkd3d_shader_error() in use_flat_interpolation().
2025-08-28 20:04:59 +02:00
Henri Verbeet
78e354133e
vkd3d-shader/ir: Generate location information in vsir_program_ensure_diffuse().
2025-08-28 20:04:59 +02:00
Henri Verbeet
fdb24c0fe7
vkd3d-shader/ir: Generate location information in vsir_program_ensure_ret().
2025-08-28 20:04:59 +02:00
Henri Verbeet
e3001fcaa4
vkd3d-common: Introduce VKD3D_SHADER_API_VERSION_CURRENT.
2025-08-28 20:04:02 +02:00
Andrey Gusev
d0098b0d59
vkd3d: Recognise VK_QUEUE_OPTICAL_FLOW_BIT_NV in debug_vk_queue_flags().
2025-08-22 20:58:06 +02:00
Elizabeth Figura
4d8e2d658a
vkd3d-shader/preproc: Do not make a copy of the buffer before returning it.
2025-08-22 20:53:21 +02:00
Elizabeth Figura
586d8c9a52
vkd3d-shader/glsl: Do not make a copy of the buffer before returning it.
2025-08-22 20:53:21 +02:00
Elizabeth Figura
c897e17c81
vkd3d-shader/hlsl: Ensure yacc tokens are positive.
...
Negative returns from yylex() signal EOF, which is not what we want here.
2025-08-22 20:51:46 +02:00
Elizabeth Figura
a696fc1376
vkd3d-shader: Dump shaders in vkd3d_shader_preprocess().
2025-08-22 20:50:11 +02:00
Henri Verbeet
3b41d99fa9
vkd3d-shader/tpf: Store a pointer to the vsir program in struct vkd3d_shader_sm4_parser.
2025-08-21 16:28:28 +02:00
Henri Verbeet
433ca45789
vkd3d-shader/dxil: Store a pointer to the vsir program in struct sm6_parser.
2025-08-21 16:28:28 +02:00
Henri Verbeet
4039476c50
vkd3d-shader/d3dbc: Store a pointer to the vsir program in struct vkd3d_shader_sm1_parser.
2025-08-21 16:28:28 +02:00
Henri Verbeet
0ab5090ff1
vkd3d-shader/hlsl: Support MSL as target format.
2025-08-21 16:28:00 +02:00
Elizabeth Figura
b88fce0d39
vkd3d-shader/d3dbc: Move IFC lowering to vsir_program_lower_d3dbc_instructions().
2025-08-21 16:26:52 +02:00
Elizabeth Figura
2256c9c7cc
vkd3d-shader/d3dbc: Move TEXKILL lowering to vsir_program_lower_d3dbc_instructions().
2025-08-21 16:23:44 +02:00
Elizabeth Figura
30a591c501
vkd3d-shader/d3dbc: Move d3dbc SINCOS lowering to vsir_program_lower_d3dbc_instructions().
2025-08-21 16:23:20 +02:00
Elizabeth Figura
12639f703e
vkd3d-shader/d3dbc: Move TEXLDL lowering to vsir_program_lower_d3dbc_instructions().
2025-08-21 16:21:25 +02:00
Elizabeth Figura
fcc5640c3e
vkd3d-shader/d3dbc: Move TEXLDD lowering to vsir_program_lower_d3dbc_instructions().
2025-08-21 16:21:18 +02:00
Francisco Casas
4dcf0b7d05
vkd3d-shader/ir: Use iterators in vsir_program_validate().
2025-08-21 16:17:38 +02:00
Francisco Casas
d3ad3e071a
vkd3d-shader/ir: Use iterators in vsir_update_dcl_temps().
2025-08-21 16:13:54 +02:00
Francisco Casas
e3fe2cec07
vkd3d-shader/ir: Use iterators in vsir_allocate_temp_registers().
2025-08-21 16:13:24 +02:00
Francisco Casas
687a4ab243
vkd3d-shader/ir: Use iterators in track_liveness().
2025-08-21 16:12:43 +02:00
Francisco Casas
5485429073
vkd3d-shader/ir: Use iterators in vsir_program_insert_vertex_fog().
2025-08-21 16:08:20 +02:00
Francisco Casas
d74d28e8ac
vkd3d-shader/ir: Use iterators in vsir_program_insert_fragment_fog().
2025-08-21 16:06:59 +02:00
Henri Verbeet
5bbd44c063
vkd3d-shader: Implement scanning compute shader thread group size information.
...
Metal doesn't allow the thread group size to be specified by shaders,
instead requiring it to be specified by the dispatch API.
2025-08-21 16:02:44 +02:00
Shaun Ren
320c3c9652
vkd3d-shader/hlsl: Fold some general conditional identities.
...
The following conditional identities are applied:
c ? x : x -> x
false ? x : y -> y; true ? x : y -> x
c ? true : false -> c; c ? false : true -> !c
!c ? x : y -> c ? y : x
Lastly, for expression chains x, y in a conditional expression
c ? x : y,
we evaluate all conditionals in the expression chains with the
condition c, assuming c is true (for x), or false (for y).
2025-08-21 16:00:51 +02:00
Shaun Ren
245430002a
vkd3d-shader/hlsl: Fold some general unary identities.
...
The following unary identities are applied:
||x|| -> |x|
|-x| -> |x|
~(~x) -> x
f(g(x)) -> g(x), where f(), g() are floor() or ceil() functions.
-(-x) -> x
!!x -> x
!(x == y) -> x != y, !(x < y) -> x >= y, etc (for integers).
2025-08-21 16:00:46 +02:00
Shaun Ren
45e549c1b2
vkd3d-shader/msl: Implement VSIR_OP_UGE.
2025-08-21 15:32:37 +02:00
Shaun Ren
b8776bb6bd
vkd3d-shader/glsl: Implement VSIR_OP_UGE.
2025-08-21 15:32:37 +02:00
Shaun Ren
4c37800f52
vkd3d-shader/hlsl: Check whether "expr" has more than 2 operands in hlsl_normalize_binary_exprs().
2025-08-21 15:32:27 +02:00
Petrichor Park
d964d55b4a
vkd3d-shader/hlsl: Implement the frexp() intrinsic.
2025-08-21 15:29:27 +02:00
Petrichor Park
ea6104cf5e
tests/hlsl: Add some tests for the frexp() intrinsic.
2025-08-21 15:29:27 +02:00
Petrichor Park
0b8abe754a
tests: Normalise NAN values in compare_float() and compare_double().
...
I.e., ignore the mantissa/payload of NAN values.
2025-08-21 15:29:27 +02:00
Henri Verbeet
a083748626
tests/shader_runner: Use read_f64() to parse "uniform" directives.
2025-08-21 15:29:27 +02:00
Henri Verbeet
31136ead05
tests/shader_runner: Use read_f32() to parse "uniform" directives.
2025-08-21 15:29:27 +02:00
Henri Verbeet
f732fb7889
Release 1.17.
2025-08-21 12:52:13 +02:00
Brendan Shanks
44fffee5e1
tests: Add dxcompiler.h to .gitignore.
2025-08-14 10:34:44 +02:00
Brendan Shanks
bb2a6a0322
include: Add additional generated files to .gitignore.
2025-08-14 10:34:44 +02:00
Henri Verbeet
975ba8f9da
vkd3d-shader: Document that vkd3d_shader_scan() supports HLSL sources.
2025-08-14 10:33:45 +02:00
Francisco Casas
7007a1e264
vkd3d-compiler: Set a default target type even when preprocessing.
...
We largely ignore the target type when preprocessing, but still
dereference options.target_type in a couple of places. E.g. when setting
info.target_type. We could add more checks for options.preprocess_only
to account for that, but it seems more robust to make sure
options.target_type is never NULL.
2025-08-13 16:12:50 +02:00
Henri Verbeet
cab0bd07e5
vkd3d-shader/glsl: Resolve SSA values.
...
Since commit eaebef4265
we may receive
vsir generated from HLSL sources, which typically contains SSA values.
We could previously receive vsir with SSA values as well, but HLSL
sources would go through d3dbc/tpf as an intermediate step, making the
resulting vsir much less likely to contain SSA values.
2025-08-13 15:56:06 +02:00
Henri Verbeet
9336b4647c
vkd3d-shader/d3d-asm: Resolve SSA values when outputting SM<6 assembly.
...
In particular, since commit eaebef4265
we
may receive vsir generated from HLSL sources, which typically contains
SSA values.
2025-08-13 15:55:31 +02:00
Henri Verbeet
8334386d99
vkd3d-shader/spirv: Avoid emitting duplicate built-in inputs in spirv_compiler_emit_input().
...
This works around an issue introduced by commit
66cb2815f0
. SV_PRIMITIVE_ID inputs in
geometry shaders use VKD3DSPR_PRIMID registers, and we create the
corresponding SPIR-V inputs using spirv_compiler_emit_io_register().
Unfortunately we also have an input signature element for the same
input, and simply creating another PrimitiveId input would run into
VUID-StandaloneSpirv-OpEntryPoint-09658.
Before the commit mentioned above, we'd use DCL_INPUT instructions to
emit input declarations, and these would help to distinguish whether
VKD3DSPR_INPUT or VKD3DSPR_PRIMID registers were used for primitive ID
inputs. Note that we can't simply ignore input signature element with
SIGNATURE_TARGET_LOCATION_UNUSED; the DXIL parser emits SV_SAMPLE_INDEX
inputs with that target location, but does require them to use a
VKD3DSPR_INPUT register.
2025-08-13 15:54:12 +02:00
Francisco Casas
880cb1083f
vkd3d-shader/ir: Use iterators in vsir_program_insert_point_coord().
2025-08-07 20:43:28 +02:00
Francisco Casas
a91b880afa
vkd3d-shader/ir: Use iterators in vsir_program_insert_point_size_clamp().
2025-08-07 20:43:28 +02:00
Francisco Casas
0ed34c22c9
vkd3d-shader/ir: Use iterators in vsir_program_insert_point_size().
2025-08-07 20:43:28 +02:00
Francisco Casas
14643b02f6
vkd3d-shader/ir: Use iterators in vsir_program_insert_clip_planes().
2025-08-07 20:43:28 +02:00
Francisco Casas
bd52ed8918
vkd3d-shader/ir: Use iterators in vsir_program_insert_alpha_test().
2025-08-07 20:43:28 +02:00
Henri Verbeet
f7890fc54c
vkd3d-shader/hlsl: Support HLSL sources in vkd3d_shader_scan().
2025-08-07 20:40:01 +02:00
Henri Verbeet
f95fc28851
vkd3d-shader/hlsl: Return a vsir program from hlsl_compile_shader().
...
This largely brings the HLSL frontend in line with the other frontends.
2025-08-07 20:40:01 +02:00
Henri Verbeet
85603dc9c6
vkd3d-shader/hlsl: Initialise the vsir program in hlsl_compile_shader().
...
Mostly in preparation for returning a vsir program from
hlsl_compile_shader() in the next commit.
2025-08-07 20:37:41 +02:00
Henri Verbeet
e7be5aa9fd
vkd3d-shader/hlsl: Pass a vkd3d_shader_source_list pointer to hlsl_ctx_init().
...
Instead of storing the list inside struct hlsl_ctx. The source file
names in the list are used by the location information that the HLSL
frontend produces, and end up being referenced by the vsir program. If
we want the vsir program to be able to outlive the hlsl_ctx, its
location information can't reference data owned by the hlsl_ctx.
2025-08-07 20:33:24 +02:00
Henri Verbeet
7c37fc6a8b
vkd3d-shader: Introduce struct vkd3d_shader_source_list.
2025-08-07 20:33:24 +02:00
Henri Verbeet
e4bb77ecef
vkd3d-shader: Cleanup the vsir program on vsir_program_transform_early() failure in vsir_parse().
2025-08-07 20:33:24 +02:00
Elizabeth Figura
f9bb84e5ef
vkd3d-shader/d3dbc: Lower TEXCRD.
2025-08-07 19:30:29 +02:00
Elizabeth Figura
731b94f6f9
vkd3d-shader/d3dbc: Lower 1.4 TEXLD.
2025-08-07 19:05:25 +02:00
Elizabeth Figura
9c605c942c
vkd3d-shader/d3dbc: Normalize ps 1.x output.
2025-08-07 18:55:40 +02:00
Elizabeth Figura
a4f69d4ae6
vkd3d-shader/d3dbc: Move TEXLD lowering to d3dbc_parse().
2025-08-07 18:52:46 +02:00
Elizabeth Figura
2201c32e6d
vkd3d-shader: Add descriptors from SAMPLE instructions if necessary.
...
This has no effect now, but will once we start lowering sm1 texturing
instructions before vsir_program_scan() is called.
2025-08-07 16:15:47 +02:00
Francisco Casas
f6d0c689ee
vkd3d-shader/ir: Use iterators in vsir_program_materialise_phi_ssas_to_temps().
2025-08-06 18:24:19 +02:00
Francisco Casas
aab02b1bca
vkd3d-shader/ir: Use iterators in vsir_program_flatten_hull_shader_phases().
2025-08-06 18:23:33 +02:00
Francisco Casas
6c840b80d6
vkd3d-shader/ir: Use iterators in cf_flattener_iterate_instruction_array().
2025-08-06 18:19:55 +02:00
Francisco Casas
e428528a7c
vkd3d-shader/ir: Use iterators in vsir_program_remove_dead_code().
2025-08-06 18:19:55 +02:00
Francisco Casas
f818d052cd
vkd3d-shader/ir: Remove the io_normaliser.instructions field.
...
It's effectively unused, and struct vkd3d_shader_instruction_array is
not meant to be copied by value. If io_normaliser.instructions were to
be modified it might leave program->instructions in an inconsistent
state.
2025-08-06 12:54:54 +02:00
Francisco Casas
b3badec039
vkd3d-shader/ir: Use iterators in vsir_program_normalise_io_registers().
2025-08-06 12:53:52 +02:00
Francisco Casas
304caa885f
vkd3d-shader/ir: Use iterators in vsir_program_normalise_flat_constants().
2025-08-06 12:53:52 +02:00
Francisco Casas
37ca1b55c9
vkd3d-shader/ir: Use iterators in instruction_array_normalise_hull_shader_control_point_io().
2025-08-06 12:53:52 +02:00
Francisco Casas
97e3877aa4
vkd3d-shader/ir: Use iterators in vsir_program_remap_output_signature().
2025-08-06 12:53:52 +02:00
Francisco Casas
6dc9ff1bd8
vkd3d-shader/ir: Use iterators in vsir_program_ensure_diffuse().
...
The change in vsir_program_iterator_next() is necessary to allow us to
introduce instructions before the iterator using:
vsir_program_iterator_prev(&it);
vsir_program_iterator_inset_after(&it, n);
vsir_program_iterator_next(&it);
This since (it.idx == SIZE_MAX) is equivalent to the iterator being
before the beginning of the list.
2025-08-06 12:53:37 +02:00
Henri Verbeet
ce20f9d4b2
tests/shader_runner_d3d12: Check whether the d3d12 device supports geometry shaders.
2025-08-06 12:04:16 +02:00
Henri Verbeet
47a183c75b
tests/d3d12: Check whether the d3d12 device supports geometry shaders.
2025-08-06 12:04:16 +02:00
Shaun Ren
4bb880f9ed
vkd3d-shader/hlsl: Support interlocked operations on non-indexed groupshared variables.
2025-08-05 16:33:08 +02:00
Shaun Ren
8d0d8d106b
vkd3d-shader/hlsl: Support stores to raw groupshared variables.
2025-08-05 16:32:34 +02:00
Shaun Ren
c8d2d40b91
vkd3d-shader/hlsl: Support loads from groupshared variables.
2025-08-05 16:18:26 +02:00
Shaun Ren
fa560b589e
vkd3d-shader/hlsl: Emit dcl_tgsm_raw instructions for raw groupshared variables.
2025-08-05 16:09:45 +02:00
Shaun Ren
3802344e97
vkd3d-shader/hlsl: Allocate groupshared registers.
2025-08-05 16:06:07 +02:00
Victor Chiletto
e615e435d9
vkd3d-shader/hlsl: Split matrix copies from resource loads.
2025-08-05 14:25:50 +02:00
Victor Chiletto
e718546ee5
vkd3d-shader/hlsl: Transform hlsl_ir_index into structured buffers into field specific hlsl_ir_resource_loads.
2025-08-05 14:25:50 +02:00
Victor Chiletto
5dbf859029
vkd3d-shader/hlsl: Parse SRV structured buffers.
2025-08-05 14:25:50 +02:00
Victor Chiletto
161d463f3c
tests/hlsl: Add a few extra structured buffer matrix load + swizzle tests.
2025-08-05 14:25:44 +02:00
Henri Verbeet
721859005f
tests: Strip reflection data from dxbc-tpf-hex shaders.
2025-08-04 15:00:02 +02:00
Henri Verbeet
243207701b
tests/shader_runner: Parse hex blobs as a list of 32-bit integers.
2025-08-04 15:00:02 +02:00
Francisco Casas
5dca0da2da
vkd3d-shader/hlsl: Use vsir_program_append() in generate_vsir_add_program_instruction().
2025-08-04 14:58:14 +02:00
Francisco Casas
be5a9c2ca8
vkd3d-shader/hlsl: Use vsir_program_append() in sm1_generate_vsir_sampler_dcls().
2025-08-04 14:52:50 +02:00
Francisco Casas
81488ce330
vkd3d-shader/hlsl: Use vsir_program_append() in sm1_generate_vsir_constant_defs().
2025-08-04 14:47:58 +02:00
Francisco Casas
8717fe9c47
vkd3d-shader/dxil: Use iterators in sm6_parser_globals_init().
2025-08-04 14:40:17 +02:00
Giovanni Mascellani
3817df1164
tests/shader_runner_metal: Run the Metal shader runner with DXIL shaders.
2025-08-04 14:34:23 +02:00
Giovanni Mascellani
d898923b1c
tests/shader_runner_metal: Allow checking shader model 5.1 too.
2025-08-04 14:34:23 +02:00
Giovanni Mascellani
1d71cf9af1
vkd3d-shader/msl: Allocate SSA registers to temporaries.
2025-08-04 14:34:23 +02:00
Giovanni Mascellani
bec000b88e
vkd3d-shader: Enable converting DXIL to MSL.
...
Only trivial shaders work so far.
2025-08-04 14:34:01 +02:00
Conor McCarthy
691dd49e49
vkd3d-shader/dxil: Handle SV_PrimitiveId outputs.
2025-08-04 11:54:46 +02:00
Conor McCarthy
1293db7536
tests/hlsl: Add a test for SV_PrimitiveId inputs and outputs.
2025-08-04 11:54:46 +02:00
Henri Verbeet
bd3d0f3495
vkd3d-shader/ir: Use vsir_program_append() in vsir_program_ensure_ret().
...
I think this is slightly nicer. It also happens to avoid a
-Warray-bounds warning on some versions of gcc that suggests the "ins"
pointer returned by vsir_program_iterator_next() may be NULL.
2025-07-31 15:01:29 +02:00
Conor McCarthy
b9fe19701c
vkd3d-shader/dxil: Handle SV_ViewportArrayIndex.
2025-07-31 14:55:33 +02:00
Conor McCarthy
cd8cea6913
tests: Replace test_ps_viewport_index() with a shader runner test.
...
Mainly to allow testing the functionality in question with DXIL shaders
as well.
2025-07-31 14:55:33 +02:00
Henri Verbeet
55fe8df979
vkd3d: Set the maximum viewport count in d3d12_pipeline_state_get_or_create_pipeline().
...
VK_DYNAMIC_STATE_VIEWPORT and VK_DYNAMIC_STATE_SCISSOR specify that
viewports and scissor rectangles are dynamic state, but not their
counts.
It took a while to notice this issue because the existing code seemed to
largely work as intended on hardware implementations, but tests using
the additional viewports would fail on llvmpipe.
2025-07-31 14:55:33 +02:00
Henri Verbeet
74d8c23f71
include: Remove some redudant TAG_* definintions from vkd3d_shader_util.h.
...
We already have all of these in vkd3d_common.h.
2025-07-31 14:54:59 +02:00
Elizabeth Figura
d0ce3e61bf
tests/hlsl: Add a regression test for packed SV_IsFrontFace.
...
This tests f0906e9c5c
.
2025-07-31 14:54:15 +02:00
Elizabeth Figura
75cb4336ec
vkd3d-shader/ir: Record the previous temp count before allocating any SSA values.
...
Due to the unintentional placement of this line, we were inadvertently
allocating every SSA value to a unique temp register, overflowing limits.
2025-07-30 15:36:38 +02:00
Henri Verbeet
67fd9bb76b
vkd3d-shader/ir: Free program parameters on failure in vsir_program_init() if needed.
2025-07-30 15:35:54 +02:00
Henri Verbeet
f6a9def564
vkd3d-shader/spirv: Update the SPIR-V grammar JSON to the vulkan-sdk-1.4.313.0 release.
2025-07-30 15:11:19 +02:00
Henri Verbeet
bb2979aa4c
vkd3d-shader/hlsl: Generate vsir signatures in hlsl_emit_vsir().
2025-07-29 13:15:22 +02:00
Henri Verbeet
49b857c5b7
vkd3d-shader/hlsl: Initialise the vsir program in hlsl_emit_vsir().
2025-07-29 13:15:22 +02:00
Henri Verbeet
dbaecb3f36
vkd3d-shader/hlsl: Introduce hlsl_compile_effect().
...
The goal being to allow hlsl_compile_shader() to return a vsir program.
2025-07-29 13:14:30 +02:00
Giovanni Mascellani
6805612918
vkd3d-shader: Use the structure names when creating the parameter allocators.
...
So that it doesn't depend on the instruction array implementation.
2025-07-29 13:13:53 +02:00
Giovanni Mascellani
247fbd869a
vkd3d-shader/ir: Use iterators in vsir_program_ensure_ret().
2025-07-29 13:12:58 +02:00
Giovanni Mascellani
812f6faa11
vkd3d-shader/ir: Use iterators in vsir_program_normalize_addr().
2025-07-29 12:53:00 +02:00
Giovanni Mascellani
50afaf4ac6
vkd3d-shader: Use iterators in vsir_program_scan().
2025-07-29 12:53:00 +02:00
Giovanni Mascellani
aba355896f
vkd3d-shader/hlsl: Reject geometry shaders with instance count.
...
We currently emit a warning and miscompile them.
2025-07-29 12:51:06 +02:00
Giovanni Mascellani
22f84317c0
vkd3d-shader/ir: Check that GSINSTID registers have dimension VEC4.
...
I had set it to SCALAR in an earlier commit, but I hadn't noticed
it failed validation.
Also fix the HLSL compiler to emit them accordingly.
Fixes: dfc18781cc
2025-07-29 12:51:06 +02:00
Giovanni Mascellani
3797c922a5
tests/hlsl: Test SV_GSInstanceID.
2025-07-29 12:50:23 +02:00
Giovanni Mascellani
52b9ef0426
vkd3d-shader/spirv: Support precise flags on SAMPLE_INFO instructions.
2025-07-29 12:31:36 +02:00
Giovanni Mascellani
53754f0583
vkd3d-shader/spirv: Support precise flags on RESINFO instructions.
2025-07-29 12:31:23 +02:00
Giovanni Mascellani
bdccdd9996
vkd3d-shader/d3d-asm: Emit precise flags for a number of opcodes.
...
I've seen them specifically on RESINFO, but it general it makes
sense to print them for any opcode that expects a bit field in
the flags.
2025-07-29 12:28:09 +02:00
Giovanni Mascellani
f7866df201
vkd3d-shader/dxil: Emit gather offsets as signed.
...
This is important for the MSL generator, otherwise invalid MSL
is emitted.
2025-07-28 16:32:40 +02:00
Giovanni Mascellani
3cf35ce22e
vkd3d-shader/msl: Convert the results of load and sample operations to the destination data type.
...
This should eventually go away when we properly enforce vsir typing,
but since for the moment we're resolving to hack, let's at least
make it compatible with DXIL.
2025-07-28 16:31:57 +02:00
Giovanni Mascellani
7df92b6e50
vkd3d-shader/msl: Reject shaders with duplicate I/O target locations.
...
We'll have to handle them eventually, but let's avoid generating
invalid code in the meantime.
2025-07-28 16:27:58 +02:00
Giovanni Mascellani
9476a235b2
vkd3d-shader/msl: Use the union type for SAMPLEMASK registers.
...
Function msl_print_assignment() doesn't currently handle bitcasts
when the left operand has a specific (rather than a union) type.
We could also fix the function, and maybe it wouldn't be a bad
idea anyway, but using the union type seems more in the spirit
of the MSL backend anyway.
2025-07-28 16:27:58 +02:00
Giovanni Mascellani
16b06c295b
vkd3d-shader/msl: Emit indexable temps with the appropriate component count.
2025-07-28 16:27:58 +02:00
Giovanni Mascellani
6ed0bd0bab
vkd3d-shader/msl: Ignore the interpolation mode for output variables.
...
They are meaningless, but some frontends (e.g., DXIL) set them
nevertheless.
2025-07-28 16:27:58 +02:00
Francisco Casas
19bc3ec104
vkd3d-shader/ir: Validate flags in RESINFO operations.
2025-07-28 16:26:16 +02:00
Francisco Casas
3a0a96b851
vkd3d-shader/ir: Validate flags in SAMPLE_INFO operations.
2025-07-28 16:26:16 +02:00
Nikolay Sivov
a4f5225229
vkd3d: Return success from d3d12_device_EnumerateMetaCommands().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-07-28 16:24:04 +02:00
Nikolay Sivov
2c49f04411
vkd3d-shader/fx: Do not attempt to parse expressions without code section.
2025-07-28 16:22:13 +02:00
Nikolay Sivov
dcd1747f12
vkd3d-shader/fx: Handle regular shader blobs when parsing the state data.
...
For the pass shader states this blob will contain compiled shaders, for other
state types it will contain expression code. Complex state data is stored separately,
tracing it back to actual state type will require keeping track of already parsed states.
2025-07-28 16:21:32 +02:00
Henri Verbeet
0652cb4adb
demos/teapot: Add specular lighting.
2025-07-28 16:12:19 +02:00
Henri Verbeet
9b0087a111
vkd3d-shader/spirv: Emit OpLine instructions.
2025-07-28 16:11:29 +02:00
Henri Verbeet
b3cac7b86d
vkd3d-shader: Call vsir_program_scan() for d3d-asm targets in vsir_program_compile().
...
Like we do for every other target.
2025-07-28 16:11:06 +02:00
Henri Verbeet
eaebef4265
vkd3d-shader/hlsl: Emit vsir from hlsl_emit_bytecode().
2025-07-28 16:10:15 +02:00
Henri Verbeet
4300e6c8b5
vkd3d-shader/ir: Allow source operands of shift operations to have different data types.
2025-07-28 16:10:15 +02:00
Henri Verbeet
b3e367b099
vkd3d-shader/tpf: Update the comment describing the data type mapping in init_sm4_lookup_tables().
...
"R", "S", and "U" were removed, and "*" was added.
2025-07-24 19:12:49 +02:00
Henri Verbeet
a4c25b81c5
vkd3d-shader/hlsl: Get rid of the "hlsl" argument to hlsl_compile_shader().
2025-07-23 17:25:19 +02:00
Henri Verbeet
f02405350e
vkd3d-shader/ir: Consistently use VSIR_DATA_U32 for resinfo_uint destination operands.
...
Much like we do for sample_info_uint.
2025-07-23 17:23:40 +02:00
Henri Verbeet
b88be5b92b
vkd3d-shader/ir: Consistently use VSIR_DATA_U32 for sample_info_uint destination operands.
...
The HLSL compiler already did this; the TPF and DXIL parsers did not.
Previously spirv_compiler_emit_sample_info() was unable to correctly
handle VSIR_DATA_U32 destinations; the new version is arguably simpler
as well.
2025-07-23 17:23:40 +02:00
Henri Verbeet
b8c73e4a2c
vkd3d-shader/spirv: Use spirv_compiler_error() to report unhandled resinfo flags.
2025-07-23 17:23:40 +02:00
Henri Verbeet
ed2a06af35
vkd3d-shader/spirv: Use spirv_compiler_error() to report unhandled sample_info flags.
2025-07-23 17:23:40 +02:00
Henri Verbeet
7295a8d0b5
vkd3d-shader/ir: Explicitly initialise the "resource_data_type" field in vsir_instruction_init().
...
This depended on VKD3D_DATA_FLOAT/VSIR_DATA_F32 being the first
enumeration value, but that's no longer the case.
shader_dump_instruction() compares this against VSIR_DATA_F32 to
determine whether to call shader_dump_resource_data_type().
2025-07-23 17:23:01 +02:00
Henri Verbeet
795211141f
vkd3d-shader/ir: Rename VKD3D_DATA_BOOL to VSIR_DATA_BOOL.
2025-07-23 17:19:28 +02:00
Henri Verbeet
aebe64ecac
vkd3d-shader/ir: Rename VKD3D_DATA_UNUSED to VSIR_DATA_UNUSED.
2025-07-23 17:19:28 +02:00
Henri Verbeet
f74b56622a
vkd3d-shader/ir: Rename VKD3D_DATA_CONTINUED to VSIR_DATA_CONTINUED.
2025-07-23 17:19:28 +02:00
Henri Verbeet
ca24aada9a
vkd3d-shader/ir: Rename VKD3D_DATA_MIXED to VSIR_DATA_MIXED.
2025-07-23 17:19:28 +02:00
Henri Verbeet
b055a16e03
vkd3d-shader/ir: Rename VKD3D_DATA_OPAQUE to VSIR_DATA_OPAQUE.
2025-07-23 17:19:28 +02:00
Henri Verbeet
ed695cc551
vkd3d-shader/ir: Rename VKD3D_DATA_SNORM to VSIR_DATA_SNORM.
2025-07-23 17:19:28 +02:00
Henri Verbeet
ed27427508
vkd3d-shader/ir: Rename VKD3D_DATA_UNORM to VSIR_DATA_UNORM.
2025-07-23 17:19:28 +02:00
Giovanni Mascellani
2f4be1dbb6
vkd3d-shader: Use size_t in the string buffer.
2025-07-23 17:16:47 +02:00
Giovanni Mascellani
17ffd21113
vkd3d-shader/ir: Use size_t in the instruction array.
2025-07-23 17:16:43 +02:00
Giovanni Mascellani
bb51b976df
vkd3d-shader/ir: Use size_t in the parameter allocator.
...
The idea is to, by default, use size_t for any quantity that is
a memory size or an array index.
2025-07-23 17:16:38 +02:00
Nikolay Sivov
83e54bdc0c
vkd3d-shader/hlsl: Handle HLSL_RESOURCE_SAMPLE_LOD in sm1_generate_vsir_instr_resource_load().
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58063
2025-07-23 17:06:21 +02:00
Nikolay Sivov
969b6f5946
vkd3d-shader/ir: Handle TEXLDL instructions in vsir_program_lower_instructions().
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58063
2025-07-23 17:02:05 +02:00
Anna (navi) Figueiredo Gomes
a7266284ee
vkd3d-shader/hlsl: Move hlsl_ir_function_decl->extern_vars to a local variable.
2025-07-23 16:56:06 +02:00
Anna (navi) Figueiredo Gomes
db80f09c7a
vkd3d-shader/hlsl: Don't create a temporary copy for a uniform if one already exists.
...
This can currently never happen, because we only ever process each uniform
once. However, this will change once we support compiling multiple shaders
in effects.
2025-07-23 16:37:54 +02:00
Anna (navi) Figueiredo Gomes
f4d95af91d
vkd3d-shader/hlsl: Add temporary variables to "dummy_scope" in prepend_uniform_copy().
...
These are not looked up by name, so we don't need them in a specific scope.
Moreover, since we generate the temporaries using the same storage
modifiers as the uniforms, hlsl_emit_bytecode() will treat them as new
uniforms if run multiple times. That function is currently only run
once, but this will change when compiling shaders in effects.
2025-07-23 16:33:35 +02:00
Anna (navi) Figueiredo Gomes
66895e2605
vkd3d-shader/hlsl: Reset "extern_vars" before processing "entry_func" in hlsl_emit_bytecode().
2025-07-23 16:32:34 +02:00
Francisco Casas
844f33025e
vkd3d-shader/hlsl: Dump processed function bodies.
2025-07-23 16:31:59 +02:00
Anna (navi) Figueiredo Gomes
f420e25fd5
vkd3d-shader/hlsl: Clone the entry point body and redirect processing to the clone.
2025-07-23 15:54:52 +02:00
Giovanni Mascellani
68cd72c7fc
vkd3d-shader/ir: Validate ROUND_NI instructions.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
b3db78e3c1
vkd3d-shader/ir: Validate ROUND_NE instructions.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
f3f8056800
vkd3d-shader/ir: Validate RCP instructions.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
59738c7a4a
vkd3d-shader/ir: Validate ORD instructions.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
6266f89827
vkd3d-shader/ir: Validate OR operations.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
1c7c66912b
vkd3d-shader/ir: Validate NOT operations.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
4789295e91
vkd3d-shader/ir: Validate NEU operations.
2025-07-22 17:11:51 +02:00
Giovanni Mascellani
3234c428b3
vkd3d-shader/ir: Validate NEO operations.
2025-07-22 17:11:50 +02:00
Giovanni Mascellani
14ee6b86e0
vkd3d-shader/d3dbc: Use iterators in d3dbc_write_program_instructions().
2025-07-22 17:11:19 +02:00
Giovanni Mascellani
4a1ca99cba
vkd3d-shader/d3dbc: Use vsir_program_append() in d3dbc_parse().
2025-07-22 17:11:19 +02:00
Giovanni Mascellani
42f53c82f3
vkd3d-shader/d3d-asm: Use iterators in d3d_asm_compile().
2025-07-22 17:11:13 +02:00
Giovanni Mascellani
ddb65aac35
vkd3d-shader/glsl: Use iterators in vkd3d_glsl_generator_generate().
2025-07-22 17:01:04 +02:00
Giovanni Mascellani
01068dada2
vkd3d-shader/msl: Use iterators in msl_generator_generate().
2025-07-22 16:57:25 +02:00
Giovanni Mascellani
7d9a86790e
vkd3d-shader/spirv: Use iterators in spirv_compiler_generate_spirv().
2025-07-22 16:56:07 +02:00
Giovanni Mascellani
7e76e62db7
vkd3d-shader/tpf: Use iterators in tpf_write_program().
2025-07-22 16:52:24 +02:00
Giovanni Mascellani
0789578175
vkd3d-shader/ir: Introduce vsir_program_append().
...
To append an instruction to the end of the vsir program.
2025-07-22 15:12:37 +02:00
Henri Verbeet
b4bf2af315
vkd3d-shader/ir: Consistently use VKD3D_DATA_UNUSED for STREAM registers.
2025-07-22 14:59:27 +02:00
Henri Verbeet
1487764e23
vkd3d-shader/ir: Rename VKD3D_DATA_UINT64 to VSIR_DATA_U64.
2025-07-22 14:57:26 +02:00
Henri Verbeet
742cce9a08
vkd3d-shader/ir: Rename VKD3D_DATA_UINT to VSIR_DATA_U32.
2025-07-22 14:57:26 +02:00
Henri Verbeet
163b87444f
vkd3d-shader/ir: Rename VKD3D_DATA_UINT16 to VSIR_DATA_U16.
2025-07-22 14:57:26 +02:00
Henri Verbeet
40bbd61abd
vkd3d-shader/ir: Rename VKD3D_DATA_UINT8 to VSIR_DATA_U8.
2025-07-22 14:57:26 +02:00
Henri Verbeet
a04e4e4010
vkd3d-shader/ir: Rename VKD3D_DATA_INT to VSIR_DATA_I32.
2025-07-22 14:57:26 +02:00
Henri Verbeet
8f05fbc75d
demos/teapot: Animate the camera.
2025-07-22 14:56:51 +02:00
Giovanni Mascellani
13c9826c30
vkd3d-shader/ir: Check that OUTSTENCILREF registers have dimension SCALAR.
2025-07-22 14:55:18 +02:00
Giovanni Mascellani
7b36453b9d
vkd3d-shader/ir: Check that PRIMID registers have dimension SCALAR.
2025-07-22 14:55:18 +02:00
Giovanni Mascellani
b3c1fb6740
vkd3d-shader/ir: Check that OUTPOINTID registers have dimension SCALAR.
2025-07-22 14:55:18 +02:00
Giovanni Mascellani
dfc18781cc
vkd3d-shader/ir: Check that GSINSTID registers have dimension SCALAR.
2025-07-22 14:55:18 +02:00
Giovanni Mascellani
b02c3759be
vkd3d-shader/ir: Check that SAMPLEMASK registers have dimension SCALAR.
...
Also fix the DXIL parser to emit them accordingly.
2025-07-22 14:55:18 +02:00
Giovanni Mascellani
226afa47c4
vkd3d-shader/ir: Check that THREADID registers have dimension VEC4.
2025-07-22 14:55:18 +02:00
Elizabeth Figura
f0906e9c5c
vkd3d-shader/spirv: Use left-shifted writemasks for private variables for inputs.
...
One of the effects of I/O normalization, when it was introduced, was to shift
the writemask of all semantics to become 0-based—e.g., to convert .yz to .xy.
It did this by modifying the shader code, but did *not* modify the signature
masks.
The SPIR-V compiler, at the time, used both the write mask on the dcl_input
instruction and the signature masks. It also, due to the requirements of the
SPIR-V format, performed the same normalization, left-shifting each mask to
become zero-based. Despite this normalization now being performed earlier in
the aforementioned VSIR pass, the handling in the SPIR-V backend was never
removed.
When 66cb2815f0
was written, I either incorrectly
assumed that the signature mask was equal to the dcl_input write mask (at least,
in any well-formed shader), or (less likely) I noticed that the discrepancy
might exist but believed that the left-shifting normalization performed by the
spirv compiler covered all cases.
In either case it turns out there is one case where the difference was not
handled by the spirv compiler either. That is the case of a varying which has
a fixup function and therefore needs a private variable, which is currently true
for the SV_VertexID, SV_InstanceID, and SV_IsFrontFace varyings.
Thus, if one of those varyings has a signature mask other than .x, we currently
copy the SPIR-V builtin value to the relevant component of the private variable,
but subsequent code will load from the .x variable due to the normalization done
by shader_src_param_io_normalise().
This fixes a regression introduced by 66cb2815f0
.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57433
2025-07-22 14:51:09 +02:00
Giovanni Mascellani
decc155cca
vkd3d-shader/ir: Split updating DCL_TEMPS instructions to a dedicated pass.
...
So that it can be used in other contexts as well. And so that
register allocation can be run also when there is no need to update
or create DCL_TEMPS instructions.
2025-07-21 12:31:08 +02:00
Giovanni Mascellani
079e989b8e
vkd3d-shader/ir: Update the program TEMP count when allocating TEMP registers.
2025-07-21 12:26:10 +02:00
Giovanni Mascellani
f5cd0b4a15
vkd3d-shader/ir: Check that THREADGROUPID registers have dimension VEC4.
2025-07-21 12:23:34 +02:00
Giovanni Mascellani
59253a5e7f
vkd3d-shader/ir: Check that LOCALTHREADID registers have dimension VEC4.
2025-07-21 12:23:34 +02:00
Giovanni Mascellani
834f762cb5
vkd3d-shader/ir: Check that DEPTHOUTLE registers have dimension SCALAR.
...
Also fix the DXIL parser to emit them accordingly.
2025-07-21 12:23:34 +02:00
Giovanni Mascellani
18ef9a4f9f
vkd3d-shader/ir: Check that DEPTHOUTGE registers have dimension SCALAR.
...
Also fix the DXIL parser to emit them accordingly.
2025-07-21 12:23:34 +02:00
Giovanni Mascellani
9f453fbb66
vkd3d-shader/ir: Check that DEPTHOUT registers have dimension SCALAR.
...
Also fix the DXIL parser to emit them accordingly.
2025-07-21 12:23:32 +02:00
Giovanni Mascellani
3d23ef6bf8
vkd3d-shader/ir: Check that COVERAGE registers have dimension VEC4.
...
Also fix the HLSL compiler and DXIL parser to emit them accordingly.
2025-07-21 12:21:23 +02:00
Giovanni Mascellani
ee0447b973
vkd3d-shader/ir: Check that LOCALTHREADINDEX registers have dimension VEC4.
...
Also fix the HLSL compiler and DXIL parser to emit them accordingly.
2025-07-21 12:18:49 +02:00
Giovanni Mascellani
61c46f95da
vkd3d-shader/ir: Validate MUL operations.
2025-07-21 12:16:16 +02:00
Giovanni Mascellani
87545dc4fd
vkd3d-shader/ir: Validate MIN operations.
2025-07-21 12:16:16 +02:00
Giovanni Mascellani
366c899a00
vkd3d-shader/ir: Validate MAX operations.
2025-07-21 12:16:16 +02:00
Giovanni Mascellani
5dd226ffeb
vkd3d-shader/ir: Validate MAD operations.
2025-07-21 12:16:16 +02:00
Giovanni Mascellani
2237e251fa
vkd3d-shader/ir: Validate LTU operations.
2025-07-21 12:16:16 +02:00
Giovanni Mascellani
34cb8c63f4
vkd3d-shader/ir: Validate LTO operations.
2025-07-21 12:16:14 +02:00
Giovanni Mascellani
a8e8a9ee64
vkd3d-shader/ir: Validate LOG operations.
2025-07-21 12:14:22 +02:00
Henri Verbeet
db149cd8cf
vkd3d-shader/ir: Rename VKD3D_DATA_DOUBLE to VSIR_DATA_F64.
2025-07-21 12:10:43 +02:00
Henri Verbeet
c5c1c03430
vkd3d-shader/ir: Rename VKD3D_DATA_FLOAT to VSIR_DATA_F32.
2025-07-21 12:10:43 +02:00
Henri Verbeet
d1dcbc26e5
vkd3d-shader/ir: Rename VKD3D_DATA_HALF to VSIR_DATA_F16.
2025-07-21 12:10:43 +02:00
Henri Verbeet
0126beb3b2
vkd3d-shader/ir: Rename enum vkd3d_data_type to vsir_data_type.
2025-07-21 12:10:43 +02:00
Henri Verbeet
53dd048ad5
demos/teapot: Add a flat shading toggle.
2025-07-21 12:09:44 +02:00
Giovanni Mascellani
8d4222764c
vkd3d-shader/ir: Use the iterator in vsir_program_lower_texldp().
2025-07-21 12:07:08 +02:00
Giovanni Mascellani
5407c8b975
vkd3d-shader/ir: Use the iterator in vsir_program_lower_sm4_sincos().
2025-07-21 12:07:08 +02:00
Giovanni Mascellani
55b8002bf6
vkd3d-shader/ir: Use the iterator in vsir_program_lower_sm1_sincos().
2025-07-21 12:06:46 +02:00
Giovanni Mascellani
c1f7720075
vkd3d-shader/ir: Use the iterator in vsir_program_lower_udiv().
2025-07-21 12:02:57 +02:00
Francisco Casas
0f18d25987
tests: Test semantic cascading signatures.
2025-07-21 11:57:01 +02:00
Francisco Casas
faeff50548
tests/hlsl: Add additional semantic cascading tests.
...
These test make the shader runner segfault before implementing it,
because it miscompiles and there are unused input layout elements.
So they are on their own commit.
2025-07-21 11:57:01 +02:00
Francisco Casas
a9a5c77222
vkd3d-shader/hlsl: Make input semantics on structs cascade down onto the fields.
2025-07-21 11:57:01 +02:00
Francisco Casas
7e9834ee36
vkd3d-shader/hlsl: Make output semantics on structs cascade down onto the fields.
2025-07-21 11:57:00 +02:00
Francisco Casas
f08fed5ffb
vkd3d-shader/hlsl: Don't pass the semantic index in add_semantic_var().
2025-07-21 11:57:00 +02:00
Francisco Casas
28f74a73aa
vkd3d-shader/hlsl: Use the index in the hlsl_semantic when prepending input copies.
2025-07-21 11:57:00 +02:00
Francisco Casas
4f5d34265c
vkd3d-shader/hlsl: Use the index in the hlsl_semantic when appending output copies.
2025-07-21 11:55:57 +02:00
Francisco Casas
9836c88ac6
tests/hlsl: Add semantic cascading tests.
...
Co-authored-by: Petrichor Park <ppark@codeweavers.com >
2025-07-21 11:20:14 +02:00
Giovanni Mascellani
7e66d0db6f
vkd3d-shader/ir: Do not print a message for registers that are not being allocated.
2025-07-17 14:11:01 +02:00
Giovanni Mascellani
e9d3b9dfd3
vkd3d-shader/ir: Set dimension to VEC4 when converting SSAs to TEMPs.
2025-07-17 14:11:01 +02:00
Giovanni Mascellani
a7807dea08
vkd3d-shader/ir: Validate FTOU operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
ccc82a184b
vkd3d-shader/ir: Validate FTOI operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
2c1d210d21
vkd3d-shader/ir: Validate ITOI operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
791a93d0b1
vkd3d-shader/ir: Validate ITOF operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
68ad2becdb
vkd3d-shader/ir: Validate ISNAN operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
fb1fc9eb38
vkd3d-shader/ir: Validate ISINF operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
df18a05303
vkd3d-shader/ir: Validate ISFINITE operations.
2025-07-17 14:08:10 +02:00
Giovanni Mascellani
b287e7959c
vkd3d-shader/ir: Sort vsir_validator_instructions[] alphabetically.
2025-07-17 14:08:06 +02:00
Giovanni Mascellani
195e62430e
vkd3d-shader/ir: Use the iterator in vsir_program_lower_precise_mad().
2025-07-17 14:04:28 +02:00
Giovanni Mascellani
a12d64fba1
vkd3d-shader/ir: Use the iterator in vsir_program_lower_texkill().
2025-07-17 14:04:28 +02:00
Giovanni Mascellani
9867d48c3a
vkd3d-shader/ir: Use the iterator in vsir_program_lower_ifc().
2025-07-17 14:04:28 +02:00
Giovanni Mascellani
2d848b5bc0
vkd3d-shader/ir: Introduce an abstraction to iterate through vsir instructions.
2025-07-17 14:04:00 +02:00
Giovanni Mascellani
ba545669cd
vkd3d-shader/ir: Validate ISHR operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
126ff8e4f5
vkd3d-shader/ir: Validate ISHL operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
94d999bd8a
vkd3d-shader/ir: Validate IREM operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
636e9a91bb
vkd3d-shader/ir: Validate INEG operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
7d92142fe0
vkd3d-shader/ir: Validate INE operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
d288d3c088
vkd3d-shader/ir: Validate IMIN operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
2a62b7035c
vkd3d-shader/ir: Validate IMAX operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
5fc8baabfb
vkd3d-shader/ir: Validate IMAD operations.
2025-07-16 18:07:26 +02:00
Giovanni Mascellani
56247130c1
vkd3d-shader/ir: Validate UAV flags in vsir programs.
2025-07-16 17:44:13 +02:00
Giovanni Mascellani
32bf71ba96
vkd3d-shader/ir: Validate descriptor flags in vsir programs.
2025-07-16 17:34:35 +02:00
Evan Tang
9c040caa40
vkd3d: Get rid of the default fragment shader from d3d12_pipeline_state_init_graphics().
...
Vulkan does support rendering without a fragment shader, and this seems
to work fine on current drivers. This commit gets rid of the last
embedded shader binary in libvkd3d, and may have a slight performance
advantage on hardware/drivers able to take advantage of the absence of a
fragment shader.
2025-07-16 17:30:11 +02:00
Evan Tang
5c0e6747b8
tests/d3d12: Add a colour attachment to test_draw_depth_no_ps().
...
To show that draws without fragment shader should leave colour
attachments unmodified.
2025-07-16 17:28:43 +02:00
Evan Tang
39db6731c0
vkd3d: Mask colour writes on graphics pipelines without fragment shaders.
...
Vulkan leaves the contents of colour attachments undefined in this case.
2025-07-16 16:54:55 +02:00
Nikolay Sivov
3163e589bc
vkd3d-shader/fx: Explicitly handle bool state values when parsing.
...
For bools 0/1 values are treated as named values, outside of this
range it's zero/non-zero.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-07-14 18:38:21 +02:00
Nikolay Sivov
46c75137c7
vkd3d-shader/fx: Use the correct value range for bools in fx_4_0 state values.
...
The earlier fix a06ecb6867
is missing this.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-07-14 18:38:21 +02:00
Giovanni Mascellani
1a5a2969be
vkd3d/resource: Write null descriptors with their correct type when using mutable descriptor types.
...
This fixes crashes in test_null_srv() and test_null_uav() with
llvmpipe and NVIDIA GPUs.
2025-07-14 18:37:13 +02:00
Giovanni Mascellani
fb91bd7b8b
vkd3d: Move vkd3d_vk_descriptor_set_index_from_vk_descriptor_type() to resource.c.
...
It's only used there.
2025-07-14 18:36:35 +02:00
Nikolay Sivov
fc77bddb9c
vkd3d-shader/fx: Improve register naming in the disassembly output.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-07-14 18:29:10 +02:00
Giovanni Mascellani
15561c1e56
vkd3d-shader/ir: Do not make a local copy of the instructions array in vsir_program_flatten_hull_shader_phases().
2025-07-14 18:25:24 +02:00
Giovanni Mascellani
44ca7b7b1b
vkd3d-shader/ir: Handle SSA registers when flattening hull shader phases.
...
Currently when a phase is duplicated more than once SSA registers
are not refreshed, therefore they are invalidly assigned more than
once.
2025-07-14 18:19:23 +02:00
Giovanni Mascellani
ad1aa739c2
vkd3d-shader/ir: Collect the hull shader phase flattener code together.
2025-07-14 18:19:23 +02:00
Henri Verbeet
b6725a3a00
demos/teapot: Add diffuse lighting.
2025-07-14 18:18:09 +02:00
Henri Verbeet
00f53b72a1
tests/shader_runner_gl: Implement geometry shaders.
2025-07-14 18:16:41 +02:00
Henri Verbeet
673c26a040
vkd3d-shader/msl: Implement VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL.
2025-07-14 18:13:43 +02:00
Henri Verbeet
1a20395e6f
vkd3d-shader/msl: Implement VSIR_OP_STORE_UAV_TYPED.
2025-07-14 18:13:43 +02:00
Henri Verbeet
955fff7570
tests/shader_runner_metal: Implement buffer textures.
2025-07-14 18:13:43 +02:00
Henri Verbeet
90b6412daa
vkd3d-shader/msl: Implement VSIR_OP_UMAX and VSIR_OP_UMIN.
2025-07-14 18:13:43 +02:00
Giovanni Mascellani
ed464a4f4c
vkd3d-shader/ir: Validate ILT instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
715d23ebbb
vkd3d-shader/ir: Validate IGE instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
9f455667eb
vkd3d-shader/ir: Validate IEQ instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
c29e8188ff
vkd3d-shader/ir: Validate IADD instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
4d1fabd350
vkd3d-shader/ir: Validate HTAN instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
e954f75862
vkd3d-shader/ir: Validate HSIN instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
5dd452a5c7
vkd3d-shader/ir: Validate HCOS instructions.
2025-07-14 18:12:22 +02:00
Giovanni Mascellani
cc42581a34
tests/hlsl: Test uint64 comparisons.
2025-07-14 18:12:03 +02:00
Giovanni Mascellani
395d456386
tests/hlsl: Test int64 comparisons.
2025-07-14 18:10:20 +02:00
Giovanni Mascellani
98b0ca544a
vkd3d-shader/ir: Test the data type when validating comparison operations.
...
I had forgot that bit.
2025-07-14 18:06:55 +02:00
Elizabeth Figura
0c3250122c
vkd3d-shader/spirv: Do not use OpCopyMemory for partial writemasks in spirv_compiler_emit_mov().
...
This fixes instructions like "mov r0.xy, r1.xyzw".
2025-06-26 17:44:34 +02:00
Elizabeth Figura
f2238deea9
tests/hlsl: Add tests for cube textures.
2025-06-26 17:40:10 +02:00
Elizabeth Figura
e312207124
tests/shader_runner: Add support for cube resources.
2025-06-26 17:38:55 +02:00
Elizabeth Figura
b58ff893a5
tests/hlsl: Add tests for 3D textures.
2025-06-26 17:32:10 +02:00
Elizabeth Figura
587c2dc76e
tests/shader_runner: Add support for 3D resources.
2025-06-26 17:31:34 +02:00
Henri Verbeet
04d3996b07
demos/teapot: Add an fps counter.
2025-06-26 16:09:42 +02:00
Henri Verbeet
22ebccfeb7
vkd3d-shader/ir: Create SSA values with the corresponding dimension in vsir_program_lower_udiv().
2025-06-26 16:08:32 +02:00
Henri Verbeet
043f6f21b0
vkd3d-shader/ir: Create SSA values with the corresponding dimension in vsir_program_lower_sm4_sincos().
...
For example, in the final test from trigonometry.shader_test, we have:
sincos r1.x <v4:float>, null <float>, l(3.00000000e+01) <s:float>
which currently gets turned into
mov sr0.xyzw <v4:float>, l(3.00000000e+01) <s:float>
sin r1.x <v4:float>, sr0.xyzw <v4:float>
That doesn't seem ideal, and should possibly be rejected by the
validator, but ends up working out well enough for the SPIR-V backend.
It's a bit more problematic to deal with for the GLSL backend.
2025-06-26 16:02:38 +02:00
Francisco Casas
96cd4cc954
vkd3d-shader/ir: Avoid a compiler warning in vsir_block_list_init().
...
The following warning appears during compilation with
gcc 15.1.1 20250425:
In function 'vsir_block_list_init',
inlined from 'vsir_block_init' at vkd3d/libs/vkd3d-shader/ir.c:3821:5,
inlined from 'vsir_cfg_init' at vkd3d/libs/vkd3d-shader/ir.c:4285:28:
vkd3d/libs/vkd3d-shader/ir.c:3758:5: warning: 'memset' writing 24 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
3758 | memset(list, 0, sizeof(*list));
| ^
In function 'vsir_cfg_init':
lto1: note: destination object is likely at address zero
looking at the code in vsir_cfg_init() this seems like an spurious
warning. Looking on the internet, these bogus warnings with memset()
seem to be a common occurrence.
memset() is replaced with a zero value assignment to avoid this.
2025-06-26 15:56:43 +02:00
Francisco Casas
3376015d88
vkd3d-shader/hlsl: Update the enum hlsl_sampler_dim comment.
2025-06-26 15:55:58 +02:00
Giovanni Mascellani
3c469edc8e
vkd3d-shader/ir: Validate GEU instructions.
2025-06-25 16:53:19 +02:00
Giovanni Mascellani
e267ea9551
vkd3d-shader/ir: Validate GEO instructions.
2025-06-25 16:52:28 +02:00
Giovanni Mascellani
8feeb07900
vkd3d-shader/ir: Validate FREM instructions.
2025-06-25 16:51:58 +02:00
Giovanni Mascellani
32cab7c81e
vkd3d-shader/ir: Validate FRC instructions.
2025-06-25 16:51:02 +02:00
Giovanni Mascellani
afec7cc96b
vkd3d-shader/ir: Validate EXP instructions.
2025-06-25 16:50:03 +02:00
Giovanni Mascellani
8cf7a12502
vkd3d-shader/ir: Validate EQU instructions.
2025-06-25 16:48:45 +02:00
Giovanni Mascellani
a6e6e36994
vkd3d-shader/ir: Validate DEQO instructions.
2025-06-25 16:47:52 +02:00
Giovanni Mascellani
17b0e0d1d9
vkd3d-shader/ir: Validate EQO instructions.
2025-06-25 16:46:59 +02:00
Giovanni Mascellani
596f02210d
vkd3d-shader/ir: Lower UDIV to UDIV_SIMPLE and UREM.
2025-06-25 16:44:00 +02:00
Giovanni Mascellani
82ef9bf2e5
vkd3d-shader/ir: Introduce VSIR_OP_UREM.
...
It is meant to compute the unsigned integer remainder.
2025-06-25 16:43:34 +02:00
Giovanni Mascellani
78e0f8412d
vkd3d-shader/ir: Introduce VSIR_OP_UDIV_SIMPLE.
...
It is meant to compute the unsigned integer division, without
computing the modulo at the same time.
2025-06-25 16:40:43 +02:00
Giovanni Mascellani
ada09d003d
vkd3d-shader/ir: Repurpose IDIV to compute plain signed division.
...
It doesn't compute signed remainder any more.
2025-06-25 16:39:50 +02:00
Giovanni Mascellani
823a8724de
vkd3d-shader/ir: Introduce VSIR_OP_IREM.
...
It is meant to compute the signed integer remainder.
2025-06-25 16:38:38 +02:00
Evan Tang
f4a4e2afec
vkd3d: Replace the resource count field of struct d3d12_heap with an internal refcount.
...
When a heap was released at the same time as the last resource on that
heap, it was possible for both to see each other's
refcount/resource_count as 0 and both would try to destroy the heap.
Avoid that by converting "resource_count" to an internal refcount, which
holds an extra +1 if the main refcount is nonzero. The final release
will then be synchronized between the two since both will operate on
"internal_refcount".
2025-06-25 16:06:49 +02:00
Henri Verbeet
752a48f4ac
vkd3d-shader/msl: Implement VSIR_OP_IMAX.
2025-06-25 16:00:34 +02:00
Henri Verbeet
543ee120fc
vkd3d-shader/msl: Implement VSIR_OP_DSX_FINE and VSIR_OP_DSY_FINE.
2025-06-25 16:00:31 +02:00
Henri Verbeet
b9ce945e61
vkd3d-shader/msl: Implement VSIR_OP_DSX_COARSE and VSIR_OP_DSY_COARSE.
2025-06-25 16:00:27 +02:00
Henri Verbeet
06a0453762
vkd3d-shader/msl: Implement VSIR_OP_DSX and VSIR_OP_DSY.
2025-06-25 16:00:22 +02:00
Henri Verbeet
cdfaeb209a
vkd3d-shader/msl: Implement VSIR_OP_CONTINUE.
2025-06-25 16:00:15 +02:00
Henri Verbeet
d219cccc99
vkd3d-shader/ir: Rename the VKD3DSIH_* enum elements to VSIR_OP_*.
2025-06-25 15:53:41 +02:00
Elizabeth Figura
cd43ab1ca2
vkd3d-shader/ir: Allow bitwise operations on VKD3D_DATA_INT.
2025-06-25 15:46:39 +02:00
Elizabeth Figura
bcb2acbdab
vkd3d-shader/hlsl: Set the destination data type to UINT in sm4_generate_vsir_cast_from_bool().
...
Validation checks that the source and destination types are both integer.
2025-06-25 15:46:27 +02:00
Elizabeth Figura
a1eb53df3c
vkd3d-shader/hlsl: Set the data type in sm4_generate_vsir_reg_from_deref().
2025-06-25 15:43:15 +02:00
Elizabeth Figura
ecb19b33ba
vkd3d-shader/hlsl: Output sm1 semantics with unique register_index values.
...
Match the register_index values from the d3dbc reader.
2025-06-25 15:43:15 +02:00
Elizabeth Figura
41cacba5ce
vkd3d-shader/hlsl: Convert descriptor registers to pre-5.1 form in the TPF writer.
...
Rather than in the HLSL writer. This way we output vsir consistent with the vsir
we read, and the vsir that the backends expect [bringing us one step closer to
being able to feed the HLSL frontend directly into the individual backends.]
2025-06-25 15:42:51 +02:00
Giovanni Mascellani
3a4f95aca6
vkd3d-shader/ir: Do not crash when registers cannot be resolved to signature elements.
2025-06-25 15:40:12 +02:00
Elizabeth Figura
5452e79a19
vkd3d-shader/d3d-asm: Handle INT_MIN in shader_print_int_literal().
2025-06-24 15:51:31 +02:00
Henri Verbeet
c2a01fff1e
vkd3d-shader/msl: Implement support for static texel offsets in msl_sample().
2025-06-24 15:32:59 +02:00
Henri Verbeet
6f8ce6df72
vkd3d-shader/msl: Implement VKD3DSIH_GATHER4_PO.
2025-06-24 15:32:59 +02:00
Henri Verbeet
449804623a
vkd3d-shader/msl: Implement VKD3DSIH_GATHER4_C.
2025-06-24 15:32:59 +02:00
Henri Verbeet
841cf65a41
vkd3d-shader/msl: Implement VKD3DSIH_GATHER4.
2025-06-24 15:32:59 +02:00
Henri Verbeet
3cc404759d
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE_LOD.
2025-06-24 15:32:59 +02:00
Giovanni Mascellani
99db7270f0
vkd3d-shader/ir: Validate DSY_FINE instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
cbd508fce6
vkd3d-shader/ir: Validate DSY_COARSE instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
7acebfc978
vkd3d-shader/ir: Validate DSY instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
6bf25800c2
vkd3d-shader/ir: Validate DSX_FINE instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
95e095992d
vkd3d-shader/ir: Validate DSX_COARSE instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
96bb2953cc
vkd3d-shader/ir: Validate DSX instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
ad320776a1
vkd3d-shader/ir: Validate DRCP instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
19c2734d31
vkd3d-shader/ir: Validate DNE instructions.
2025-06-24 15:31:39 +02:00
Giovanni Mascellani
bcaa1d50b0
vkd3d-shader/ir: Validate data types for destination shifts.
2025-06-24 15:28:00 +02:00
Giovanni Mascellani
1862c28b90
vkd3d-shader/ir: Validate data types for SATURATE destination modifiers.
2025-06-24 15:27:48 +02:00
Giovanni Mascellani
318d7466a8
vkd3d-shader/ir: Validate data types for NOT source modifiers.
2025-06-24 15:27:38 +02:00
Giovanni Mascellani
65c23999e8
vkd3d-shader/ir: Validate data types for ABSNEG source modifiers.
2025-06-24 15:27:29 +02:00
Giovanni Mascellani
0252e2e660
vkd3d-shader/ir: Validate data types for ABS source modifiers.
2025-06-24 15:27:02 +02:00
Henri Verbeet
85dcbf7a51
demos/teapot: Add on-screen help.
2025-06-24 15:24:16 +02:00
Giovanni Mascellani
31581b0002
vkd3d-shader/ir: Lower IMUL and UMUL to IMUL_LOW.
2025-06-24 15:21:13 +02:00
Giovanni Mascellani
4a39db797b
vkd3d-shader/ir: Introduce VKD3DSIH_IMUL_LOW.
...
It is meant to compute the lower word of an integer multiplication.
2025-06-24 15:15:56 +02:00
Shaun Ren
f3dec58423
vkd3d-shader/hlsl: Ignore the 'groupshared' modifier for non-compute shaders.
2025-06-24 14:54:25 +02:00
Shaun Ren
4ede2f1365
vkd3d-shader/hlsl: Allow memory barriers in SM4+ target profiles.
2025-06-24 14:51:34 +02:00
Shaun Ren
84a0a8ae86
vkd3d-shader/hlsl: Handle nodes with NULL data types in hlsl_replace_node().
2025-06-24 14:50:43 +02:00
Shaun Ren
3bf232e841
vkd3d-shader/hlsl: Only dump store writemasks for single register types.
...
This fixes a segfault on matrix stores in dump_ir_store().
2025-06-24 14:50:21 +02:00
Conor McCarthy
d8edf20c2b
vkd3d-shader/dxil: Convert constant buffer minimum-precision source registers.
2025-06-23 20:12:31 +02:00
Conor McCarthy
dda2ec1814
vkd3d-shader/ir: Allow constant buffer loads to have a minimum precision.
...
DXIL constant buffer loads can have precision modifiers.
2025-06-23 20:07:53 +02:00
Shaun Ren
b8cbe03308
vkd3d-shader/hlsl: Remove a leftover TODO message.
...
The max output size check for stream outputs is done via
validate_max_output_size().
2025-06-23 18:29:27 +02:00
Nikolay Sivov
ba5d5a8091
vkd3d-shader/fx: Fix the order of the "MaterialDiffuse" and "MaterialAmbient" state entries.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-23 18:28:41 +02:00
Nikolay Sivov
92c711a7d5
vkd3d-shader/fx: Add a format-specific callback to write state assignments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-23 18:27:11 +02:00
Nikolay Sivov
3537feb45c
vkd3d-shader/fx: Move entry count updates out of the state block writing helper.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-23 18:17:48 +02:00
Nikolay Sivov
43a29044d6
vkd3d-shader/fx: Move state decomposition to the fx_4_0-specific writing path.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-23 18:16:17 +02:00
Nikolay Sivov
9f9cf59b6e
vkd3d-shader/fx: Use the same state data helpers for both fx_2_0 and fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-23 18:12:27 +02:00
Nikolay Sivov
99d61aeb89
vkd3d-shader/fx: Use a version-independent structure for states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-23 18:12:27 +02:00
Giovanni Mascellani
f6af47f9b6
vkd3d-shader/ir: Validate data types for DW source modifiers.
2025-06-23 18:11:22 +02:00
Giovanni Mascellani
bc4dda75dd
vkd3d-shader/ir: Validate data types for DZ source modifiers.
2025-06-23 18:11:12 +02:00
Giovanni Mascellani
6ef23544f4
vkd3d-shader/ir: Validate data types for X2NEG source modifiers.
2025-06-23 18:11:01 +02:00
Giovanni Mascellani
2d783da3a7
vkd3d-shader/ir: Validate data types for X2 source modifiers.
2025-06-23 18:10:50 +02:00
Giovanni Mascellani
eec2b13dc6
vkd3d-shader/ir: Validate data types for COMP source modifiers.
2025-06-23 18:10:25 +02:00
Giovanni Mascellani
a115cd9ec0
vkd3d-shader/ir: Validate DMUL instructions.
2025-06-23 18:07:09 +02:00
Giovanni Mascellani
402c2bf10a
vkd3d-shader/ir: Validate DMOV instructions.
2025-06-23 18:07:09 +02:00
Giovanni Mascellani
32746c664d
vkd3d-shader/ir: Validate DMIN instructions.
2025-06-23 18:07:09 +02:00
Giovanni Mascellani
2f4038bae7
vkd3d-shader/ir: Validate DMAX instructions.
2025-06-23 18:07:09 +02:00
Giovanni Mascellani
bd4681622d
vkd3d-shader/ir: Validate DLT instructions.
2025-06-23 18:07:09 +02:00
Giovanni Mascellani
dc33622919
vkd3d-shader/ir: Validate DIV instructions.
2025-06-23 18:07:09 +02:00
Giovanni Mascellani
666eb98ab6
vkd3d-shader/ir: Validate DGEO instructions.
2025-06-23 18:06:20 +02:00
Giovanni Mascellani
227df56c6c
vkd3d-shader/ir: Validate DFMA instructions.
2025-06-23 18:00:55 +02:00
Giovanni Mascellani
2b922e6b8e
vkd3d-shader/ir: Validate DDIV instructions.
2025-06-23 18:00:55 +02:00
Giovanni Mascellani
ead690a17a
vkd3d-shader/ir: Validate DADD instructions.
2025-06-23 18:00:55 +02:00
Henri Verbeet
be2c8041d0
vkd3d-shader/d3dbc: Use TAG_CTAB in d3dbc_compile().
2025-06-23 18:00:34 +02:00
Henri Verbeet
e5bf48a2ba
vkd3d-shader/spirv: Do not require VKD3D_SHADER_BINDING_FLAG_IMAGE for sampler descriptors.
2025-06-23 18:00:10 +02:00
Francisco Casas
83979ec07a
tests/hlsl: Fix up point-sprite.shader_test.
...
Write the shaders so that texcoord's register index in the vertex output
signature matches the register index in the pixel input signature
(o0 and v0 in this case) in SM4.
2025-06-23 17:59:20 +02:00
Francisco Casas
2e0cbff3a0
vkd3d-shader/hlsl: Allocate return variables before other outputs.
...
point-sprite.shader_test is not technically well formed since, in SM4,
the vertex output signature should be:
// Output signature:
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// sv_position 0 xyzw 0 POS float xyzw
// texcoord 0 xy 1 NONE float xy
and the pixel input signature should be:
// Input signature:
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// texcoord 0 xy 0 NONE float xy
so we are not passing "texcoord" properly to the pixel shader, even on
Windows.
2025-06-23 17:56:40 +02:00
Francisco Casas
e0359c5299
tests/hlsl: Test the allocation order of return semantics.
2025-06-23 17:53:03 +02:00
Francisco Casas
cf726cf521
tests/shader_runner_d3d12: Handle the "bug" qualifier on state creation failure.
2025-06-23 17:50:37 +02:00
Henri Verbeet
46265061c3
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE_GRAD.
2025-06-23 17:48:07 +02:00
Henri Verbeet
db89687807
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE_C_LZ
2025-06-23 17:48:07 +02:00
Henri Verbeet
f30510a9b3
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE_C.
2025-06-23 17:48:07 +02:00
Henri Verbeet
0c8bc0f42c
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE_B.
2025-06-23 17:48:07 +02:00
Henri Verbeet
af8b3f94e7
vkd3d-shader/msl: Implement VKD3DSIH_SAMPLE.
2025-06-23 17:48:07 +02:00
Elizabeth Figura
d5237ec1cc
vkd3d-shader/hlsl: Output SSA registers where possible.
2025-06-23 17:44:11 +02:00
Elizabeth Figura
288020bce8
vkd3d-shader/ir: Allocate SSA registers to temps.
2025-06-23 17:39:12 +02:00
Elizabeth Figura
7b9d04fff8
vkd3d-shader/ir: Track liveness in the SSA allocator.
2025-06-23 17:34:28 +02:00
Elizabeth Figura
5e4c61eba6
vkd3d-shader/ir: Introduce a stub SSA to temp allocation pass.
2025-06-23 17:32:59 +02:00
Elizabeth Figura
34dbd60e01
vkd3d-shader/hlsl: Add a register type field to struct hlsl_reg.
...
This will be used for temps. After moving temp allocation to vsir, some of these
will be VKD3DSPR_SSA, and some will not.
2025-06-23 17:28:40 +02:00
Conor McCarthy
9d490b83d4
vkd3d-shader/dxil: Add a null check for the type when validating non-void operands.
2025-06-19 20:45:28 +02:00
Conor McCarthy
c3110d2f94
vkd3d-shader/dxil: Check the destination value is invalid after calling a void function handler.
2025-06-19 20:45:28 +02:00
Conor McCarthy
a410c448ce
vkd3d-shader/dxil: Validate the function return type after calling the handler.
...
The handler writes the destination value.
2025-06-19 20:44:54 +02:00
Nikolay Sivov
f135f7fe07
vkd3d-shader/hlsl: Add a stub for the noise() intrinsic.
...
This function is used in tx_1_0 code, but is also supported in
fx_2_0 and fx_4_0 expressions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-19 20:36:27 +02:00
Giovanni Mascellani
93e1a8c784
vkd3d-shader/ir: Lower tpf SINCOS to the new COS and SIN instructions.
2025-06-19 20:33:09 +02:00
Giovanni Mascellani
37c2f709d1
vkd3d-shader/ir: Lower d3dbc SINCOS to the new COS and SIN instructions.
2025-06-19 20:32:55 +02:00
Giovanni Mascellani
6f092fb84a
vkd3d-shader/ir: Introduce opcode SIN.
...
It is meant to compute sine.
2025-06-19 20:32:50 +02:00
Giovanni Mascellani
322f2e5496
vkd3d-shader/ir: Introduce opcode COS.
...
It is meant to compute cosine, and gradually replace SINCOS, at
least from a certain point in the pipeline on.
2025-06-19 20:32:41 +02:00
Giovanni Mascellani
b7fbd3c0f0
vkd3d-shader/ir: Validate data types for SIGNNEG source modifiers.
2025-06-19 20:11:41 +02:00
Giovanni Mascellani
3689d3076c
vkd3d-shader/ir: Validate data types for SIGN source modifiers.
2025-06-19 20:10:21 +02:00
Giovanni Mascellani
e1ca552173
vkd3d-shader/ir: Validate data types for BIASNEG source modifiers.
2025-06-19 20:08:52 +02:00
Giovanni Mascellani
b2e1c3b90a
vkd3d-shader/ir: Validate data types for BIAS source modifiers.
2025-06-19 20:06:35 +02:00
Giovanni Mascellani
eb3383b04e
vkd3d-shader/ir: Validate data types for NEG source modifiers.
2025-06-19 20:03:17 +02:00
Giovanni Mascellani
46fac7f264
tests: Add a test for the partial precision destination modifier.
2025-06-19 19:48:56 +02:00
Giovanni Mascellani
4da83fe83b
vkd3d-shader/ir: Validate ATAN instructions.
2025-06-19 19:28:42 +02:00
Giovanni Mascellani
813021e60b
vkd3d-shader/ir: Validate ASIN instructions.
2025-06-19 19:28:42 +02:00
Giovanni Mascellani
16e142465c
vkd3d-shader/ir: Validate AND instructions.
2025-06-19 19:28:41 +02:00
Giovanni Mascellani
0edd654c9e
vkd3d-shader/ir: Validate ADD instructions.
2025-06-19 19:24:36 +02:00
Giovanni Mascellani
475e16b87f
vkd3d-shader/ir: Validate ACOS instructions.
2025-06-19 19:24:36 +02:00
Giovanni Mascellani
65e896fd60
vkd3d-shader/ir: Validate ABS instructions.
2025-06-19 19:24:06 +02:00
Henri Verbeet
5911e410a8
demos/teapot: Add a tessellation demo.
2025-06-18 15:51:11 +02:00
Henri Verbeet
d572f4ac1f
vkd3d: Use the DXBC checksum to construct a shader source name.
2025-06-18 15:50:18 +02:00
Henri Verbeet
cef3e07e3d
vkd3d-shader/spirv: Emit an OpSource instruction with the source name.
2025-06-18 15:50:18 +02:00
Giovanni Mascellani
8b78747629
vkd3d-shader/dxil: Emit 16-bit UNDEFINED and INVALID values as minimum precision registers.
2025-06-18 15:48:55 +02:00
Giovanni Mascellani
b05153e6f9
vkd3d-shader/dxil: Emit 16-bit GROUPSHAREDMEM values as minimum precision registers.
2025-06-18 15:48:55 +02:00
Giovanni Mascellani
39603f4bc2
vkd3d-shader/dxil: Emit 16-bit structured TGSMs as minimum precision.
2025-06-18 15:48:55 +02:00
Giovanni Mascellani
5e1c8056ae
vkd3d-shader/dxil: Emit 16-bit raw TGSMs as minimum precision.
2025-06-18 15:48:55 +02:00
Giovanni Mascellani
7c0da1747a
vkd3d-shader/dxil: Allow constant zero values to be floating point.
...
This fixes commit 59fb3a7893
, where
the floating point alternative was mistakenly ignored.
2025-06-16 17:41:20 +02:00
Nikolay Sivov
d08673bad1
vkd3d-shader/d3dbc: Use the actual instruction length in d3dbc_write_instruction().
...
The current calculation doesn't take indirect addressing into account.
This issue is easy to spot in disassembly, when we don't skip correctly
to the next instruction. On Windows the disassembler does not depend on
this it seems and skips naturally after processing all parameters that
may or may not use indirect addressing.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 17:35:37 +02:00
Nikolay Sivov
7281f4ed39
vkd3d-shader/fx: Add support for tx -> text output.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 16:19:47 +02:00
Nikolay Sivov
586b2b5a79
vkd3d-shader/fx: Add the "noise" opcode name.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 16:07:35 +02:00
Nikolay Sivov
e28af05957
vkd3d-shader/fx: Output indirect register access in arguments.
...
This uses the notation from Wine's d3dx9 effects runtime implementation.
Indirect addressing in fx_4_0 looks pretty much broken - it compiles
to something that produces non-sensical text disassembly and fails
runtime effect creation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 16:06:41 +02:00
Nikolay Sivov
3f6013ea27
vkd3d-shader/fx: Output value expressions for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 16:04:52 +02:00
Nikolay Sivov
ddb433d552
vkd3d-shader/fx: Explicitly check all known state assignment types for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 16:04:52 +02:00
Nikolay Sivov
590ea03255
vkd3d-shader/fx: Remove the unused fx_4_fxlc_argument type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-16 16:04:34 +02:00
Giovanni Mascellani
bf92190924
vkd3d-shader/ir: Rename VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER to VKD3D_SHADER_ERROR_VSIR_INVALID_OPCODE.
...
Following the way it is currently called in the code.
2025-06-16 16:03:07 +02:00
Henri Verbeet
c3c36d8517
demos: Introduce a helper function to create a projection matrix.
2025-06-16 16:02:23 +02:00
Henri Verbeet
eb988e95e1
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_alu_instruction().
2025-06-16 16:01:14 +02:00
Henri Verbeet
f46c8ea03c
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_ext_glsl_instruction().
2025-06-16 16:01:14 +02:00
Henri Verbeet
81279b763b
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_bitfield_instruction().
2025-06-16 16:01:14 +02:00
Henri Verbeet
0778fb93df
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_comparison_instruction().
2025-06-16 16:01:14 +02:00
Henri Verbeet
616fea0c2b
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_deriv_instruction().
2025-06-16 16:01:14 +02:00
Henri Verbeet
a8ca1f95c5
demos: Map the Win32 A-Z keys to a-z.
...
Matching what we produce on XCB and macOS.
2025-06-11 20:31:34 +02:00
Henri Verbeet
229f792db6
demos: Print the GPU and platform we're running on.
2025-06-11 20:30:39 +02:00
Henri Verbeet
8eeefc2906
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_sample().
2025-06-11 20:28:38 +02:00
Henri Verbeet
d92ef93611
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_emit_atomic_instruction().
2025-06-11 20:28:38 +02:00
Henri Verbeet
6aeb168d63
vkd3d-shader/spirv: Use vsir_opcode_get_name() in spirv_compiler_handle_instruction().
2025-06-11 20:28:38 +02:00
Henri Verbeet
dfb3494600
vkd3d-shader/msl: Use vsir_opcode_get_name() in msl_unhandled().
2025-06-11 20:28:38 +02:00
Henri Verbeet
a5ff884605
vkd3d-shader/ir: Use vsir_opcode_get_name() in the validator.
2025-06-11 20:28:38 +02:00
Henri Verbeet
9c2643b9f7
vkd3d-shader/msl: Implement VKD3DSIH_LD2DMS.
2025-06-11 20:27:54 +02:00
Henri Verbeet
2d90f51d57
tests/shader_runner_metal: Implement resource copies.
2025-06-11 20:27:54 +02:00
Henri Verbeet
5899d8f54b
vkd3d-shader/msl: Implement VKD3DSIH_XOR.
2025-06-11 20:27:54 +02:00
Henri Verbeet
36a999e09f
vkd3d-shader/msl: Implement VKD3DSIH_ULT.
2025-06-11 20:27:54 +02:00
Henri Verbeet
6a159a5565
vkd3d-shader/msl: Implement VKD3DSIH_INEG.
2025-06-11 20:27:54 +02:00
Nikolay Sivov
1913f5e6f9
vkd3d-shader/fx: Parse array selector expressions for fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 20:09:05 +02:00
Nikolay Sivov
90032acbcf
vkd3d-shader/fx: Rename the constant argument helper to be version-neutral.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 20:08:59 +02:00
Nikolay Sivov
d403705de9
vkd3d-shader/fx: Add a helper to print literals.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 20:07:38 +02:00
Nikolay Sivov
b098af3ef8
vkd3d-shader/fx: Use more generic names for the literal constant array.
...
It's going to be reused for 64-bit floats too.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 20:07:25 +02:00
Nikolay Sivov
f525399545
vkd3d-shader/fx: Read instruction arguments in full before printing them.
...
The binary format stores destination argument after sources. Each
argument takes either 3 tokens or 5 tokens, when indexed. For simplicity
read them all first, and print destination first.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 20:04:27 +02:00
Nikolay Sivov
d6a4084321
vkd3d-shader/fx: Use a version-neutral name for the opcode table.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 18:25:42 +02:00
Nikolay Sivov
47b9316a86
vkd3d-shader/fx: Give fxlvm-specific constants a version-neutral name.
...
Those are reusable for fx_2_0 preshaders.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-11 18:21:30 +02:00
Giovanni Mascellani
94cbb333f8
vkd3d-shader/dxil: Emit 16-bit ICB values as minimum precision registers.
2025-06-11 18:20:23 +02:00
Giovanni Mascellani
0b5a96d963
vkd3d-shader/dxil: Emit 16-bit SSA values as minimum precision registers.
2025-06-11 18:20:23 +02:00
Giovanni Mascellani
73940cde73
vkd3d-shader/dxil: Emit 16-bit IDXTEMP values as minimum precision registers.
2025-06-11 18:20:23 +02:00
Giovanni Mascellani
5e86d5c21b
vkd3d-shader/dxil: Emit 16-bit arrays as minimum precision types.
...
The type is not explicitly annotated as minimum precision, because
no backend currently cares about that bit anyway. We're still
relying on the fact that in SM 6.0 16-bit types are always
understood as minimum precision.
2025-06-11 18:20:20 +02:00
Giovanni Mascellani
1d780e1a6b
vkd3d-shader/dxil: Emit 16-bit CONSTANT values as minimum precision registers.
2025-06-11 18:10:12 +02:00
Henri Verbeet
14477b1066
demos: Allow Vulkan to determine the swapchain image count.
...
We currently always use 3. That's not a bad choice, but doesn't take the
minImageCount/maxImageCount of the Vulkan implementation into account.
2025-06-10 17:51:15 +02:00
Henri Verbeet
cea7b4e920
tests/shader_runner: Introduce the "f32" probe format.
2025-06-10 17:49:13 +02:00
Henri Verbeet
9c987e5a0b
tests/shader_runner: Introduce the "u32" probe format.
2025-06-10 17:48:19 +02:00
Henri Verbeet
95cf0a8b2c
tests/shader_runner: Introduce the "i32" probe format.
2025-06-10 17:47:32 +02:00
Henri Verbeet
73820756d1
tests/shader_runner: Introduce the "f64" probe format.
2025-06-10 17:46:51 +02:00
Henri Verbeet
b09e9159ba
tests/shader_runner: Introduce the "u64" probe format.
2025-06-10 17:46:51 +02:00
Henri Verbeet
261cdb0f29
tests/shader_runner: Rename the "ri64" probe format to "i64".
2025-06-10 17:46:51 +02:00
Henri Verbeet
7dfa9e8f81
vkd3d-shader/msl: Implement VKD3DSIH_DISCARD.
2025-06-10 17:45:06 +02:00
Henri Verbeet
f538085e41
vkd3d-shader/msl: Implement switches.
2025-06-10 17:45:06 +02:00
Henri Verbeet
79be1d3051
vkd3d-shader/msl: Implement loops.
2025-06-10 17:45:06 +02:00
Henri Verbeet
a570932b82
vkd3d-shader/msl: Implement VKD3DSIH_IMUL.
2025-06-10 17:45:06 +02:00
Henri Verbeet
a2eb3324d4
vkd3d-shader/msl: Implement VKD3DSIH_ILT.
2025-06-10 17:45:06 +02:00
Henri Verbeet
83ed825e5a
vkd3d-shader/ir: Use vsir_opcode_get_name() in vsir_program_lower_instructions().
2025-06-10 17:44:18 +02:00
Henri Verbeet
c8e6d35e17
vkd3d-shader/glsl: Use vsir_opcode_get_name() in shader_glsl_unhandled().
2025-06-10 17:44:18 +02:00
Henri Verbeet
66c0530a05
vkd3d-shader/d3dbc: Use vsir_opcode_get_name() in d3dbc_write_vsir_instruction().
2025-06-10 17:44:18 +02:00
Henri Verbeet
6a06929f6b
vkd3d-shader/d3dbc: Use vsir_opcode_get_name() in shader_sm1_get_opcode_info_from_vsir_instruction().
2025-06-10 17:44:18 +02:00
Henri Verbeet
1214359022
vkd3d-shader/ir: Introduce vsir_opcode_get_name().
2025-06-10 17:44:18 +02:00
Giovanni Mascellani
1b389f29c5
vkd3d-shader/dxil: Remove field "reg" from struct sm6_value.
...
The VSIR register is now always generated dynamically and we
don't have to carry it around.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
20d8ba7f8d
vkd3d-shader/dxil: Introduce sm6_value_get_constant_float().
...
Similarly to sm6_value_get_constant_uint() and
sm6_value_get_constant_uint64().
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
873043226c
vkd3d-shader/dxil: Rewrite sm6_parser_init_ssa_value() in terms of the SM6 value.
...
Instead of using the VSIR register.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
59fb3a7893
vkd3d-shader/dxil: Rewrite sm6_value_is_constant_zero() in terms of the SM6 value.
...
Instead of using the VSIR register.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
31e4cbba2e
vkd3d-shader/dxil: Rewrite sm6_value_get_constant_uint64() in terms of the SM6 value.
...
Instead of using the VSIR register.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
2e3f99e61e
vkd3d-shader/dxil: Rewrite sm6_value_get_constant_uint() in terms of the SM6 value.
...
Instead of using the VSIR register.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
f4f2617584
vkd3d-shader/dxil: Rewrite sm6_value_is_ssa() in terms of the value type.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
361ecd6cf5
vkd3d-shader/dxil: Rewrite sm6_value_is_undef() in terms of the value type.
2025-06-10 17:40:17 +02:00
Giovanni Mascellani
0ac20b3029
vkd3d-shader/dxil: Rewrite sm6_value_is_constant() in terms of the value type.
2025-06-10 17:40:17 +02:00
Nikolay Sivov
fcb5650dbf
vkd3d-shader/fx: Use a separate table for sampler states in fx_2_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-10 17:39:30 +02:00
Nikolay Sivov
b22ebe73bc
vkd3d-shader/fx: Do not print padding bytes of fx_2_0 strings.
2025-06-10 17:39:18 +02:00
Nikolay Sivov
8aacee8eae
vkd3d-shader/fx: Add a few missing fxlc opcode names.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-10 17:34:41 +02:00
Giovanni Mascellani
8da518f2cd
tests: Fix the shader model requirements for a ps_5_0 shader.
...
In practice this is irrelevant, but better get our tests
consistent.
2025-06-09 16:22:19 +02:00
Giovanni Mascellani
45ef9fdbe8
tests: Add a test about discontiguous input swizzles in bytecode format.
2025-06-09 16:22:19 +02:00
Henri Verbeet
d881356ab2
vkd3d-shader/msl: Implement VKD3DSIH_IGE.
2025-06-09 16:20:53 +02:00
Henri Verbeet
3673b65485
vkd3d-shader/msl: Implement VKD3DSIH_IADD.
2025-06-09 16:20:53 +02:00
Henri Verbeet
cc33439f19
vkd3d-shader/msl: Implement VKD3DSIH_EQO.
2025-06-09 16:20:53 +02:00
Henri Verbeet
fc6249a228
vkd3d-shader/msl: Implement support for VKD3DSPR_SAMPLEMASK registers.
2025-06-09 16:20:53 +02:00
Henri Verbeet
ea5cf883fa
vkd3d-shader/msl: Implement support for VKD3DSPR_IDXTEMP registers.
2025-06-09 16:20:53 +02:00
Francisco Casas
66d0c2a426
tests/d3d12: Avoid out-of-bounds access when evaluating ok() args (ubsan).
...
Compiling and running with UBSan reported the following errors:
tests/d3d12.c:31063:5: runtime error: index 4 out of bounds for type 'float [4][8]'
tests/d3d12.c:31063:5: runtime error: index 8 out of bounds for type 'float [8]'
tests/d3d12.c:31063:5: runtime error: load of address 0x557ee85a1500 with insufficient space for an object of type 'const float'
tests/d3d12.c:31248:5: runtime error: index 4 out of bounds for type 'float [4][4]'
tests/d3d12.c:31248:5: runtime error: index 4 out of bounds for type 'float [4]'
tests/d3d12.c:31248:5: runtime error: load of address 0x557ee85a10d0 with insufficient space for an object of type 'const float'
2025-06-09 16:09:22 +02:00
Giovanni Mascellani
d65be3d0c5
tests: Skip test_graphics_compute_queue_synchronization() on paravirtualized MoltenVK.
...
This used to work when the macOS runner had a Sonoma host system.
Now it has Sequoia, even if the guest is still Sonoma, and the
test crashes with:
[mvk-error] VK_TIMEOUT: MTLCommandBuffer "vkQueueSubmit MTLCommandBuffer on Queue 3-0" execution failed (code 2): Caused GPU Hang Error (00000003:kIOGPUCommandBufferCallbackErrorHang)
vkd3d:56072:err:vkd3d_wait_for_gpu_timeline_semaphore Failed to wait for Vulkan timeline semaphore, vr -4.
Upgrading MoltenVK or the guest to Sequoia doesn't seem to help.
I haven't investigated the problem, but my experience is that
the paravirtualized Metal driver has a number of problems.
2025-06-05 16:50:15 +02:00
Giovanni Mascellani
7e134f85a4
vkd3d-shader/dxil: Do not set the value type in sm6_parser_function_init().
...
It is rewritten in all branches that produce a value.
VALUE_TYPE_REG is therefore never set and can be retired at last.
2025-06-05 16:05:09 +02:00
Giovanni Mascellani
0e406cf0a8
vkd3d-shader/dxil: Do not set the value type in sm6_parser_declare_global().
...
It is rewritten in all branches.
2025-06-05 16:05:09 +02:00
Giovanni Mascellani
00b3fb96d9
vkd3d-shader/dxil: Store a SM6 value in sm6_phi.
...
Rather than a VSIR register.
2025-06-05 16:05:09 +02:00
Giovanni Mascellani
a9a3100cca
vkd3d-shader/dxil: Represent non uniformness in the SM6 value.
2025-06-05 16:05:09 +02:00
Giovanni Mascellani
af5e5fe31b
vkd3d-shader/dxil: Generate specialized values in sm6_parser_emit_cast() for trivial casts.
...
There is currently no need to make a special case for 16-bit
values, since the SPIR-V backend currently confuses them with
32-bit values. The generated VSIR code is not correct, but that
will have to be handled at a different level.
2025-06-05 16:05:09 +02:00
Elizabeth Figura
5e6def0843
vkd3d-shader/preproc: Store EOF state per buffer.
...
We may immediately push a new file or expansion.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43481
2025-06-05 16:04:02 +02:00
Elizabeth Figura
d768ea6709
vkd3d-shader/preproc: Swap to the INITIAL state after ending a buffer.
2025-06-05 16:04:02 +02:00
Elizabeth Figura
0eb5fee633
vkd3d-shader/preproc: Parse comments in #include and #line directives.
2025-06-05 16:04:02 +02:00
Henri Verbeet
5ea697b8eb
vkd3d-shader/msl: Handle SV_SAMPLE_INDEX inputs.
2025-06-05 15:58:44 +02:00
Henri Verbeet
34d8be3b2e
tests/shader_runner_metal: Set the pipeline sample count in metal_runner_draw().
2025-06-05 15:58:44 +02:00
Henri Verbeet
a8defb4e21
tests/shader_runner_metal: Implement multi-sample readback.
2025-06-05 15:58:44 +02:00
Henri Verbeet
1cdfed919a
vkd3d-shader/msl: Simplify SV_DEPTH handling.
2025-06-05 15:58:44 +02:00
Henri Verbeet
cf312e14a9
vkd3d-shader/msl: Handle SV_VERTEX_ID inputs.
2025-06-05 15:58:44 +02:00
Henri Verbeet
e948098ae3
vkd3d-shader/msl: Handle SV_POSITION inputs.
2025-06-05 15:58:44 +02:00
Henri Verbeet
f14a0dfe07
vkd3d-shader/msl: Implement support for indirect constant buffer addressing.
2025-06-05 15:58:01 +02:00
Henri Verbeet
0b829db149
vkd3d-shader/msl: Continue when the SRV descriptor binding isn't specified in msl_ld().
...
Mostly to aid debugging.
2025-06-05 15:55:01 +02:00
Henri Verbeet
fadcbf3eeb
vkd3d-shader/msl: Slightly improve the error messages for unspecified descriptor bindings.
...
This also makes them consistent with the ones used by the GLSL backend.
2025-06-05 15:55:01 +02:00
Henri Verbeet
6a93c503cd
vkd3d-shader/msl: Get rid of the "lod" field of struct msl_resource_type_info.
...
1D read() is specified to support a level/lod parameter. The MSL
specification claims it needs to be 0 because "mipmaps are not supported
for 1D textures", but that restriction isn't documented for the
"mipmapLevelCount" property of MTLTextureDescriptor. Other APIs do
supported mipmapped 1D textures. Multi-sample textures aren't supported
by msl_ld(), so we don't need to worry about them.
2025-06-05 15:55:01 +02:00
Henri Verbeet
02d7d6038d
vkd3d-shader/msl: Reject cube and multi-sample texel fetches in msl_ld().
...
The cube variants are simply disallowed in Direct3D, and currently
mishandled by msl_ld(). It's less clear whether multi-sample fetches
should be allowed, and how they're supposed to behave if they are,
although typically the "ld2dms" instruction would be used for those.
They're not supported on the MSL side either way.
2025-06-05 15:55:01 +02:00
Henri Verbeet
671fbfea7d
vkd3d-shader/msl: Ensure we have a non-NULL "resource_type_info" pointer in msl_ld().
...
Since we're going to dereference it.
2025-06-05 15:55:01 +02:00
Giovanni Mascellani
87fe08fe0e
tests/hlsl: Test TGSMs with minimum precision unsigned integers.
2025-06-05 15:50:23 +02:00
Giovanni Mascellani
1d77d51ca4
tests/hlsl: Test some quirks of TGSMs with SM < 5.0.
...
I'm not specifically interested in that, but since I ran into
those idiosyncrasies while writing other TGSM tests I decided that
it might turn out useful to keep them.
2025-06-05 15:50:04 +02:00
Giovanni Mascellani
bda2be3423
vkd3d-shader/hlsl: Reject programs with group shared variables.
...
Currently the modifier is ignored and the program is miscompiled.
2025-06-05 15:50:04 +02:00
Giovanni Mascellani
0236308866
tests/hlsl: Test minimum precision IDXTEMP registers.
2025-06-05 15:50:01 +02:00
Giovanni Mascellani
f1b36edc07
ci: Enable testing with DXC again on macOS.
...
This was disabled by commit 653e4f47ac
.
2025-06-04 13:07:17 +02:00
Giovanni Mascellani
a4c727ac40
tests: Mark some tests in calculate-lod.shader_test as buggy on MoltenVK < 1.2.11.
2025-06-04 13:04:53 +02:00
Giovanni Mascellani
c82d1aac4d
tests: Mark some tests in arithmetic-int-uniform.shader_test as buggy on MoltenVK < 1.2.11.
...
The bug is already solved on recent MoltenVK versions, but the CI
is stuck with 1.2.9, so it's useful to filter these failures out.
2025-06-04 13:04:53 +02:00
Giovanni Mascellani
7f04060f33
vkd3d-shader/dxil: Handle 16-bit values uniformly in sm6_map_cast_op().
...
This makes the logic more transparent, and it eases handling
native 16-bit values once they will be supported.
2025-06-04 13:03:57 +02:00
Giovanni Mascellani
b9ce828451
vkd3d-shader/dxil: Validate that floating-point extension casts increase bit width.
2025-06-04 13:01:51 +02:00
Giovanni Mascellani
a91fb0523a
vkd3d-shader/dxil: Validate that integer extension casts increase bit width.
2025-06-04 13:01:51 +02:00
Giovanni Mascellani
a90b74baaa
vkd3d-shader/dxil: Validate that floating-point truncation casts decrease bit width.
...
Similarly to the integer case.
2025-06-04 13:01:45 +02:00
Giovanni Mascellani
0e006715d8
vkd3d-shader/dxil: Do not use field "reg" in of sm6_value when writing bitcasts.
...
It's going to be removed; the generated register data type is the
right thing to look at here.
2025-06-04 12:34:21 +02:00
Elizabeth Figura
9552dab5aa
vkd3d-shader: Use the correct union members for raw and structured resources.
2025-06-04 12:10:39 +02:00
Henri Verbeet
85d2703c03
tests/shader_runner: Introduce a "tessellation-shader" cap.
...
Similar to how we have the "geometry-shader" cap. In principle shader
model 5+ implies support for tessellation shaders, but the Vulkan,
OpenGL, and Metal runners are able to support most of shader model 5+
without the underlying GPU (or API) necessarily supporting tessellation
shaders.
2025-06-04 12:10:10 +02:00
Shaun Ren
2b257caea9
vkd3d-shader/hlsl: Don't optimize semantic register allocations in SM1.
...
This matches the behaviour of fxc/d3dcompiler.
2025-06-02 20:53:00 +02:00
Nikolay Sivov
b6ef417e71
vkd3d-shader/fx: Handle bool types when parsing fx_2_0 assignment values.
2025-06-02 20:51:38 +02:00
Nikolay Sivov
c895f63a1c
vkd3d-shader/fx: Fix a crash in fx -> d3d-asm when named values are not defined.
2025-06-02 20:51:38 +02:00
Nikolay Sivov
108f4fe47e
vkd3d-shader/fx: Fix reading the assignment value base type when parsing fx_2_0.
2025-06-02 20:51:33 +02:00
Nikolay Sivov
4e2fefdfdf
vkd3d-shader/fx: Use correct array sizes for the fx_2_0 states.
2025-06-02 20:43:44 +02:00
Nikolay Sivov
4ef4baa6bf
vkd3d-shader/fx: Fix some typos in fx_2_0 state names.
2025-06-02 20:43:44 +02:00
Nikolay Sivov
68386f5180
vkd3d-shader/fx: Print packoffset() modifiers in fx -> d3d-asm output.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-02 20:43:44 +02:00
Nikolay Sivov
6b2800fa99
vkd3d-shader/fx: Print explicit buffer bind points in fx -> d3d-asm output.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-02 20:43:27 +02:00
Nikolay Sivov
e33189546a
vkd3d-shader/fx: Use variable unpacked size when setting buffer sizes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-06-02 20:41:37 +02:00
Giovanni Mascellani
9f0185f304
vkd3d-shader/msl: Support the ABSNEG source modifier.
2025-06-02 20:36:42 +02:00
Giovanni Mascellani
bc0dd891c3
vkd3d-shader/glsl: Support the ABSNEG source modifier.
2025-06-02 20:35:48 +02:00
Giovanni Mascellani
ed60dd5926
tests: Add a test for the ABSNEG source modifier.
2025-06-02 20:33:13 +02:00
Giovanni Mascellani
10be58a74f
vkd3d-shader/msl: Ignore the PARTIALPRECISION destination modifier.
2025-06-02 20:33:01 +02:00
Giovanni Mascellani
9f5db1e3e4
vkd3d-shader/glsl: Ignore the PARTIALPRECISION destination modifier.
2025-06-02 20:32:46 +02:00
Giovanni Mascellani
df8b611334
vkd3d-shader/msl: Accept and ignore the REFACTORING_ALLOWED global flag.
2025-06-02 20:32:36 +02:00
Giovanni Mascellani
5998723e7c
vkd3d-shader/glsl: Accept and ignore the REFACTORING_ALLOWED global flag.
2025-06-02 20:31:19 +02:00
Giovanni Mascellani
215dfe0450
tests/hlsl: Mark some tests in wave-ops-float.shader_test as buggy on MoltenVK.
...
I haven't investigated the problem, but since the tests work for
other implementations and MoltenVK is not always perfect it's likely
that the problem is there.
2025-06-02 20:22:58 +02:00
Giovanni Mascellani
0b9268a91b
tests/hlsl: Mark some tests in geometry.shader_test as buggy on MoltenVK.
...
They use geometry shaders, which MoltenVK doesn't support. However
D3D12 has no way to indicate they're unsupported, so the problem
doesn't surface as a failed draw, but rather as a draw that doesn't
do anything.
2025-06-02 20:22:43 +02:00
Giovanni Mascellani
ea4f1dece5
tests/hlsl: Mark a test in entry-point-semantics.shader_test as buggy on MoltenVK with DXIL.
...
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-06-02 20:22:35 +02:00
Giovanni Mascellani
c8b07e9fa6
tests/hlsl: Mark a test in register-reservation-resources.shader_test as todo on MoltenVK with DXIL.
...
I haven't investigated what's happening.
2025-06-02 20:22:22 +02:00
Giovanni Mascellani
898bc5c4c8
tests/hlsl: Mark a test in sm6-uav-rwtexture.shader_test as todo on MoltenVK.
...
I haven't investigated what's happening.
2025-06-02 20:22:12 +02:00
Giovanni Mascellani
de8dbdc2cb
tests/hlsl: Add a test reading from a minimum precision floating-point array.
2025-06-02 20:18:30 +02:00
Giovanni Mascellani
12da0f9d24
tests/hlsl: Add some more minimum precision floating-point tests.
2025-06-02 20:18:21 +02:00
Giovanni Mascellani
308d3aa676
tests/hlsl: Add a test reading from a minimum precision signed integer array.
2025-06-02 20:18:09 +02:00
Giovanni Mascellani
7f7077a156
tests/hlsl: Use the appropriate RTV format in shader-interstage-interface.shader_test.
2025-06-02 20:18:04 +02:00
Giovanni Mascellani
8106c5a199
tests/hlsl: Test the interstage interface for minimum precision types.
2025-06-02 20:17:56 +02:00
Giovanni Mascellani
752b13b111
tests/hlsl: Test sampling with minimum precision floating-point numbers.
2025-06-02 20:17:48 +02:00
Elizabeth Figura
847c008b49
vkd3d-shader/ir: Split TEX into two separate vsir opcodes.
...
The two have the same d3dbc opcode, but have different names and different semantics.
2025-06-02 20:13:52 +02:00
Elizabeth Figura
b25362e036
vkd3d-shader/ir: Split TEXCOORD into two separate vsir opcodes.
...
The two have the same d3dbc opcode, but have different names and different semantics.
2025-06-02 20:12:27 +02:00
Henri Verbeet
618d8e6a4a
vkd3d-shader/msl: Make the generated main function static.
...
We only need to export the entry point.
2025-06-02 20:11:08 +02:00
Henri Verbeet
7929ba9747
vkd3d-shader: Move vkd3d_siv_from_sysval_indexed() to hlsl_codegen.c.
2025-06-02 20:10:46 +02:00
Henri Verbeet
9983d9c4de
tests/hlsl: Slightly adjust the bias values in the sample-bias tests.
...
The expected λ value for the tests in question is about 0.59, which
after linear mipmap interpolation should result in a sampled value of
about 0.41. The quantisation step was added to allow results as high as
0.43, as seen on some implementations.
AMD Radeon Pro Vega 20 on macOS 15.5 returns a sampled value of about
0.39, with both Vulkan/MoltenVK and MSL/Metal. This is not an issue with
the bias calculation; the same behaviour could be reproduced with
SampleLevel(), as used in the sample-level tests, if those tests used
more exciting values for the "level" parameter. It also doesn't appear
to be a general Metal issue; Intel UHD Graphics 630 does return the
expected values on the same setup. Instead, this appears to be a mipmap
interpolation issue on this particular GPU/driver. Mapping the sampled
values for "level" from 0.0 to 1.0, it seems the interpolation factor
used is "saturate(frac(λ) * 1.25 - 0.125)", instead of the normal
"frac(λ)".
Fascinating as that may be, the test here mainly cares about whether the
bias value was applied correctly, and in that regard a sampled value of
0.39 isn't any worse than the 0.43 we already accept. This commit
adjusts the bias value so that the expected sampled value is 0.45, which
makes the accepted error the same on both the positive and negative
side.
2025-06-02 20:08:04 +02:00
Shaun Ren
d5dcf31123
vkd3d-shader/hlsl: Store stream index in struct hlsl_semantic.
...
In addition, support stream indices in tpf_write_signature().
2025-06-02 19:59:22 +02:00
Shaun Ren
d368d18527
vkd3d-shader/hlsl: Generate vsir instructions for indexed output streams in geometry shaders.
2025-06-02 19:53:25 +02:00
Shaun Ren
7da7ccaf45
vkd3d-shader/hlsl: Emit dcl_stream instructions for SM5 geometry shaders.
2025-06-02 19:53:25 +02:00
Giovanni Mascellani
a743d9ae60
vkd3d-shader/dxil: Remove bitcast helpers.
...
They are useless, since the source is already a union with the
needed types.
2025-06-02 19:52:25 +02:00
Giovanni Mascellani
0a1e7b5f64
vkd3d-shader/dxil: Generate CONSTANT values in sm6_parser_constants_init() for null scalars.
2025-06-02 19:52:25 +02:00
Giovanni Mascellani
79ec2fe9f2
vkd3d-shader/dxil: Generate specialized values in sm6_parser_constants_init() for casts.
...
Depending on the casted operand, the generated values can be
ICB, IDXTEMP or GROUPSHAREDMEM.
The cast decoding code is entirely moved to the second pass, so
that we avoid abusing registers to temporarily store other data.
2025-06-02 19:51:22 +02:00
Giovanni Mascellani
93fb51c899
vkd3d-shader/dxil: Generate CONSTANT values in sm6_parser_constants_init() for floating-point values.
2025-06-02 19:46:23 +02:00
Giovanni Mascellani
d36e37555a
vkd3d-shader/dxil: Generate CONSTANT values in sm6_parser_constants_init() for integer values.
2025-06-02 19:46:23 +02:00
Giovanni Mascellani
c050c8be75
vkd3d-shader/dxil: Do not touch the parser current value in instruction_dst_param_init_temp_vector().
...
The stored value is never read, the caller will overwrite it with
the SSA register generated by the whole DXIL instruction.
Since the helper is always used for UINT instructions, change and
rename it accordingly, so we don't have the problem of finding out
which data type to use.
2025-06-02 19:45:54 +02:00
Nikolay Sivov
87ec2d9897
vkd3d-shader/fx: Fix writing fx_2_0 structure parameters.
...
Currently structure type descriptions get interleaved with variable
length string data. The solution is to write all fixed length fields
first, then append strings.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-05-27 20:24:24 +02:00
Giovanni Mascellani
bb50117747
ci: Really use DXC 1.8.2502 for macOS.
...
In theory commit 7b07d77396
already
did that, but in practice it ended up picking a commit from the
1.8.2405 branch, where a few of our tests fail. Since I hope to
soon enable DXC for macOS again, it's useful to fix that oversight.
2025-05-27 19:44:27 +02:00
Giovanni Mascellani
365f6d3be9
tests/hlsl: Mark some tests in uav-atomics.shader_test as working on MoltenVK.
2025-05-27 19:32:45 +02:00
Giovanni Mascellani
85dcd03642
tests/hlsl: Mark some tests in wave-ops-int.shader_test as buggy on MoltenVK.
...
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-05-27 19:32:35 +02:00
Giovanni Mascellani
9ab1cadaa5
tests/hlsl: Mark some tests in wave-ops-uint.shader_test as buggy on MoltenVK.
...
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-05-27 19:32:19 +02:00
Giovanni Mascellani
6fe0d71ae1
tests/hlsl: Mark a test in gather-offset.shader_test as buggy on MoltenVK with d3d12.
...
It seems that SPIRV-Cross is generating bad MSL code, and Metal
rejects it.
2025-05-27 19:31:38 +02:00
Giovanni Mascellani
70c51984c9
tests/hlsl: Mark some tests in clip-cull-distance.shader_test as buggy on MoltenVK with d3d12.
...
They either use geometry shaders or cull distances, which MoltenVK
doesn't support. However d3d12 has no way to indicate they're
unsupported, so the problem doesn't surface as a failed draw,
but rather as a draw that doesn't do anything.
2025-05-27 19:30:21 +02:00
Giovanni Mascellani
7261b40df7
tests/hlsl: Mark a test in object-references.shader_test as todo on MoltenVK with DXIL.
...
I haven't investigated what's happening in detail. However vkd3d
emits this message, which makes me think the problem is ours:
vkd3d:62178588:fixme:spirv_compiler_get_descriptor_binding Could not find descriptor binding for type 0, space 0, registers [0:2], shader type 0.
2025-05-27 19:29:56 +02:00
Giovanni Mascellani
e6267dd6b4
tests/hlsl: Do not test for overflowing 16-bit texture sampling.
...
The behavior is not uniform across drivers; in my tests AMD
performs as expected by the test, but WARP and NVIDIA return
infinity.
2025-05-27 17:45:09 +02:00
Giovanni Mascellani
bd1b737e4e
tests/hlsl: Test minimum precision stride for floating point numbers too.
2025-05-27 17:45:07 +02:00
Giovanni Mascellani
d214f9ebca
tests/hlsl: Test minimum precision stride for signed integers too.
2025-05-27 17:43:07 +02:00
Giovanni Mascellani
6a699d2872
tests/hlsl: Test minimum precision floating point numbers.
2025-05-27 17:40:29 +02:00
Giovanni Mascellani
1496ddc52f
tests/hlsl: Test native 16-bit floating point numbers.
2025-05-27 17:40:29 +02:00
Giovanni Mascellani
deb3b74c66
tests/hlsl: Test casting 16-bit integers to doubles.
2025-05-27 17:40:12 +02:00
Giovanni Mascellani
adca5a66e7
tests/hlsl: Test casting minimum precision integers to doubles.
2025-05-27 17:20:19 +02:00
Giovanni Mascellani
f7c2fbfe85
tests/hlsl: Test casting doubles to minimum precision integers.
2025-05-27 17:20:14 +02:00
Henri Verbeet
ffafa7fdaa
tests/hlsl: Get rid of a MSL todo in geometry.shader_test.
...
The Metal/MSL runner doesn't support geometry shaders, so the test is
never executed on that runner.
2025-05-27 17:15:10 +02:00
Henri Verbeet
ee85e6b534
tests/hlsl: Require the "geometry-shader" cap for the relevant clip/cull-distance tests.
2025-05-27 17:15:10 +02:00
Henri Verbeet
5581c42a79
tests/shader_runner_d3d11: Direct3D 11 supports geometry shaders.
2025-05-27 17:15:10 +02:00
Henri Verbeet
0a28abd8f6
tests/shader_runner_metal: Try harder to find a suitable device.
2025-05-27 17:12:36 +02:00
Henri Verbeet
e17a98f870
vkd3d-shader: Remove some newlines from vkd3d-shader error messages.
2025-05-27 17:12:13 +02:00
Nikolay Sivov
c4c7f10d99
vkd3d-shader/fx: Fix the total buffer size calculation in write_fx_4_buffer().
...
The total size should take variable alignment/padding into account.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-05-24 21:32:22 +02:00
Nikolay Sivov
2e40154801
vkd3d-shader/fx: Use the correct field indices when writing structure default values.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-05-24 21:27:01 +02:00
Nikolay Sivov
a06ecb6867
vkd3d-shader/fx: Use the correct value range for bool initializers.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-05-24 21:24:59 +02:00
Nikolay Sivov
11d4fcff46
vkd3d-shader/fx: Handle nameless structure types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com >
2025-05-24 21:19:42 +02:00
Shaun Ren
a4e43402e5
vkd3d-shader/hlsl: Support void pass-through hull shader control point functions.
2025-05-24 21:13:00 +02:00
Shaun Ren
e7b2ca28ab
vkd3d-shader/hlsl: Fix the register string for patch arrays in debug_register().
2025-05-24 21:03:56 +02:00
Elizabeth Figura
f5e0c47811
vkd3d-shader/ir: Use add_signature_element() to add clip planes.
...
In particular, ensure that the semantic name is not NULL. This is necessary to
avoid a crash when a later pass using vsir_signature_find_element_by_name(),
e.g. vsir_program_insert_vertex_fog(), iterates over the signature including the
new element.
2025-05-24 21:02:17 +02:00
Giovanni Mascellani
3fb662c9e7
tests/hlsl: Remove some tests from minimum-precision.shader_test.
...
Most of them fail on any native implementation I can put my hands
on, including the CI. Equivalent, but hopefully better, tests
were added to arithmetic-uint.shader_test and
arithmetic-int-uniform.shader_test.
2025-05-24 21:00:32 +02:00
Giovanni Mascellani
cb1ee9cdd5
tests/hlsl: Test minimum precision 16-bit signed integers.
2025-05-24 20:59:34 +02:00
Giovanni Mascellani
a477502a05
tests/hlsl: Test minimum precision 16-bit unsigned integers.
2025-05-24 20:57:42 +02:00
Giovanni Mascellani
fdc173506e
tests/hlsl: Test minimum precision stride in constant buffers.
2025-05-24 20:54:42 +02:00
Giovanni Mascellani
bd6dbd096f
vkd3d-shader/dxil: Reimplement aggregate indexing using specialized value types.
...
As opposed to just touching the vsir register description, which
should be removed soon.
2025-05-24 20:44:45 +02:00
Giovanni Mascellani
6a85df013b
vkd3d-shader/dxil: Pass a reference to the SM6 parser to sm6_register_from_value().
2025-05-24 20:44:45 +02:00
Giovanni Mascellani
b0940729ff
vkd3d-shader/dxil: Pass a reference to the SM6 parser to src_param_init_from_value().
2025-05-24 20:44:45 +02:00
Giovanni Mascellani
6b9df6b7a5
vkd3d-shader/dxil: Pass a reference to the SM6 parser to src_params_init_from_operands().
2025-05-24 20:44:45 +02:00
Henri Verbeet
fe747b065f
vkd3d-shader: Also output vkd3d_shader_vnote() messages using WARN.
2025-05-24 20:41:39 +02:00
Henri Verbeet
ef3e10a14e
vkd3d-shader: Also output vkd3d_shader_vwarning() messages using WARN.
2025-05-24 20:41:39 +02:00
Henri Verbeet
9156de0593
vkd3d-shader: Also output vkd3d_shader_verror() messages using WARN.
2025-05-24 20:41:39 +02:00
Shaun Ren
4eab50755e
tests: Test signature reflection for geometry shader outputs.
2025-05-24 20:38:36 +02:00
Shaun Ren
a58b1f7011
vkd3d-shader/hlsl: Implement output semantics for geometry shaders.
2025-05-24 20:38:36 +02:00
Shaun Ren
18ec4caded
vkd3d-shader/tpf: Read the DCL_OUTPUT_SGV instruction.
...
Introduce VSIR op VKD3DSIH_DCL_OUTPUT_SGV.
2025-05-24 20:38:36 +02:00