Commit Graph

149 Commits

Author SHA1 Message Date
Francisco Casas
3fbe272659 vkd3d-shader/hlsl: Add field-level documentation to struct hlsl_src. 2023-01-11 16:03:55 +01:00
Francisco Casas
04108c0e21 vkd3d-shader/hlsl: Add field-level documentation to struct hlsl_ir_node. 2023-01-11 16:03:54 +01:00
Francisco Casas
9157a5e73f vkd3d-shader/hlsl: Add field-level documentation to struct hlsl_ctx. 2023-01-11 16:03:52 +01:00
Francisco Casas
8ff3698699 vkd3d-shader/hlsl: Add field-level documentation to struct hlsl_ir_var. 2023-01-11 16:03:51 +01:00
Francisco Casas
0a2732428c vkd3d-shader/hlsl: Add field-level documentation to struct hlsl_struct_field. 2023-01-11 16:03:49 +01:00
Francisco Casas
3a53da7f5b vkd3d-shader/hlsl: Add field-level documentation to struct hlsl_type. 2023-01-11 16:03:48 +01:00
Francisco Casas
cc811dc3c2 vkd3d-shader/hlsl: Rename hlsl_struct_field.modifiers to "storage_modifiers". 2023-01-11 16:03:47 +01:00
Francisco Casas
4dbbb8beb4 vkd3d-shader/hlsl: Rename hlsl_ir_var.modifiers to "storage_modifiers". 2023-01-11 16:03:45 +01:00
Francisco Casas
23bd2d9ad8 vkd3d-shader/hlsl: Rename HLSL_STORAGE_VOLATILE to HLSL_MODIFIER_VOLATILE. 2023-01-11 16:03:43 +01:00
Zebediah Figura
718c79b823 vkd3d-shader/hlsl: Parse the numthreads attribute. 2022-11-08 20:53:04 +01:00
Zebediah Figura
d6799bd5d3 vkd3d-shader/hlsl: Parse function attributes. 2022-11-08 20:53:03 +01:00
Zebediah Figura
03f9d16047 vkd3d-shader/hlsl: Parse UAV stores. 2022-10-31 22:07:44 +01:00
Zebediah Figura
0ef04659c7 vkd3d-shader/hlsl: Parse UAV types. 2022-10-19 21:59:55 +02:00
Zebediah Figura
20fc4375ad vkd3d-shader/hlsl: Introduce a hlsl_new_expr() helper. 2022-10-12 21:58:01 +02:00
Zebediah Figura
2d4d2e1244 vkd3d-shader/hlsl: Parse the asuint() intrinsic. 2022-10-12 21:57:57 +02:00
Zebediah Figura
3fc2fdc37f vkd3d-shader/hlsl: Introduce a hlsl_new_bool_constant() helper. 2022-09-28 19:11:02 +02:00
Zebediah Figura
4c5fd9c7b9 vkd3d-shader/hlsl: Introduce a hlsl_new_float_constant() helper. 2022-09-28 19:10:58 +02:00
Zebediah Figura
15a0b44ada vkd3d-shader/hlsl: Pass the arguments to hlsl_new_resource_load() as an indirect structure.
The function has far too many arguments, including multiple different arguments
with the same type. Use a structure for clarity and to avoid errors.

Merge hlsl_new_sample_lod() into hlsl_new_resource_load() accordingly.
2022-09-27 20:14:54 +02:00
Zebediah Figura
fb724d60e3 vkd3d-shader/hlsl: Make the source parameter to hlsl_copy_deref() const. 2022-09-27 20:14:53 +02:00
Zebediah Figura
e3123f5bd0 vkd3d-shader/hlsl: Pass only a template string to hlsl_new_synthetic_var().
Synthesize the internal name from the template inside of this function.
2022-09-27 20:14:51 +02:00
Giovanni Mascellani
d5fd309ef8 vkd3d: Add a macro to mark unreachable code.
This should silence warnings about some branches non returning any value
without requiring additional "return 0" statement or similar.

Also, in theory this might enable to compiler to optimize the program
a little bit more, though that's unlikely to have any measurable effect.
2022-09-27 20:14:27 +02:00
Zebediah Figura
d6f45b730f vkd3d-shader/hlsl: Parse the SampleLevel method. 2022-08-23 15:57:54 -05:00
Francisco Casas
3d9baef321 vkd3d-shader/hlsl: Support initialization of implicit size arrays.
HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT (zero) is used as a temporal value
for elements_count for implicit size arrays.
This value is replaced by the correct one after parsing the initializer.

In case the implicit array is not initialized correctly, hlsl_error()
is called but the array size is kept at 0. So the rest of the code
must handle these cases.

In shader model 5.1, unlike in 5.0, declaring a multi-dimensional
object-type array with the last dimension implicit results in
an error. This happens even in presence of an initializer.

So, both gen_struct_fields() and declare_vars() first check if the
shader model is 5.1, the array elements are objects, and if there is
at least one implicit array size to handle the whole type as an
unbounded resource array.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
1bba18aa75 vkd3d-shader/hlsl: Invalidate components more precisely in copy propagation.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
b5b08bd8a0 vkd3d-shader/hlsl: Replace register offsets with index paths in copy propagation.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
f843a7babb vkd3d-shader/hlsl: Rename 'inner_type' to 'element_type' in function name.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
577014c017 vkd3d-shader/hlsl: Replace register offsets with index paths in split copies.
hlsl_new_store() and hlsl_new_load() are deleted, so now there are no more
direct ways to create derefs with offsets in hlsl.c and hlsl.h.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:34:19 +02:00
Francisco Casas
c572adbf2a vkd3d-shader/hlsl: Move register offset functions to hlsl_codegen.c.
This can be done now, to ensure that register offsets are no longer used
in hlsl.c and hlsl.h.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:34:01 +02:00
Francisco Casas
349aab2a6a vkd3d-shader/hlsl: Replace register offsets with index paths in resource loads initialization.
At this point, the parse code is free of offsets; it only uses index
paths.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:58 +02:00
Francisco Casas
5b664c7a5c vkd3d-shader/hlsl: Introduce hlsl_new_store_index().
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:55 +02:00
Francisco Casas
f3289e1661 vkd3d-shader/hlsl: Introduce hlsl_new_store_component().
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:51 +02:00
Francisco Casas
4fede46c9a vkd3d-shader/hlsl: Replace register offsets with index paths in load initializations.
The transform_deref_paths_into_offsets pass turns these index paths back
into register offsets.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:37 +02:00
Francisco Casas
2dcfc888fb vkd3d-shader/hlsl: Unify type minor/major size functions.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:29 +02:00
Francisco Casas
039b69ace9 vkd3d-shader/hlsl: Introduce add_load_index().
At this point add_load() is split into add_load_component() and
add_load_index(); register offsets are hidden for these functions.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:25 +02:00
Zebediah Figura
e5905bbf0f vkd3d-shader/hlsl: Store the struct fields as an array.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-18 22:07:26 +02:00
Zebediah Figura
0ddaa80616 vkd3d-shader/hlsl: Fold constant swizzles.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-28 22:20:08 +02:00
Francisco Casas
246ff14511 vkd3d-shader/hlsl: Support all complex initalizers.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-27 21:45:41 +02:00
Giovanni Mascellani
d9dc79de66 vkd3d-shader/hlsl: Store boolean constants as unsigned.
With this change it is possible to store booleans as 0xffffffff,
similarly as what happens at runtime.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-05 17:51:07 +02:00
Giovanni Mascellani
5b24f7a06c vkd3d-shader/hlsl: Add a helper to create constants of arbitrary type.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-05 17:51:07 +02:00
Giovanni Mascellani
39bd9b0943 vkd3d-shader/hlsl: Pass a pointer to the location to hlsl_new_*_constant().
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-05 17:51:07 +02:00
Zebediah Figura
6e966bcf23 vkd3d-shader/hlsl: Allow "nointerpolation" to be specified on struct fields.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-05 17:50:19 +02:00
Giovanni Mascellani
84059d61c3 vkd3d-shader/hlsl: Allow offsets for scalar and vector variables.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 22:20:36 +01:00
Zebediah Figura
ee764359d0 vkd3d-shader/hlsl: Correctly calculate offsets for array elements.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 22:20:32 +01:00
Henri Verbeet
f5c4c06090 vkd3d-shader/hlsl: Respect the requested target type.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-28 22:23:13 +01:00
Zebediah Figura
7f166c4da4 vkd3d-shader/hlsl: Return false from hlsl_offset_from_deref() if the offset falls out of bounds.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 18:39:11 +01:00
Francisco Casas
812123ffbf vkd3d-shader/hlsl: Move fold_constants() to a separate file.
Also rename it to hlsl_fold_constants().

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 21:19:04 +01:00
Francisco Casas
7b687751cc vkd3d-shader/hlsl: Move replace_node() to hlsl.c.
Also rename it to hlsl_replace_node().

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-17 21:19:00 +01:00
Francisco Casas
68b9422470 vkd3d-shader/hlsl: Handle additional dimension types for textures.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-09 18:45:33 +01:00
Francisco Casas
ce2454db6d vkd3d-shader/hlsl: Move sampler_dim_count() to hlsl.h.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-09 18:45:29 +01:00
Nikolay Sivov
4e36c1825d vkd3d-shader/hlsl: Implement floor().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-02 21:06:19 +01:00