Zebediah Figura
7a9e393ea0
vkd3d-shader/hlsl: Rename the "type" field of struct hlsl_type to "class".
...
To be consistent with enum hlsl_type_class and HLSL_CLASS_*.
2023-04-03 17:59:24 +02:00
Nikolay Sivov
b172f4c257
vkd3d-shader/hlsl: Improve handling of builtin alias type "vector".
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-03 17:59:08 +02:00
Nikolay Sivov
5b5c020ade
vkd3d-shader/hlsl: Improve handling of builtin alias type "matrix".
2023-04-03 17:59:06 +02:00
Nikolay Sivov
4110f1e547
vkd3d-shader: Fix a few typos in the comments.
2023-03-15 20:13:27 +01:00
Nikolay Sivov
193692bbcb
vkd3d-shader/hlsl: Use array element type for array's regset.
...
Currently this affects SM1 compilation only, with a minimal example like this:
float4 var[3];
float4 main() : sv_target
{
return var[1];
}
2023-03-09 22:10:39 +01:00
Nikolay Sivov
ae2f777a4d
vkd3d-shader/hlsl: Parse multisample texture type names.
2023-03-08 20:15:09 +01:00
Zebediah Figura
322963add8
vkd3d-shader/hlsl: Do not set an initial latent matrix majority.
...
This change does nothing by itself.
2023-02-28 22:06:59 +01:00
Zebediah Figura
75ab9d31ef
vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask.
2023-02-28 22:06:58 +01:00
Nikolay Sivov
dd36215a00
vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'float' type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-02-23 21:46:42 +01:00
Nikolay Sivov
df2d6d35e2
vkd3d-shader/hlsl: Use unsigned type for the 'dword' alias.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-02-23 21:46:40 +01:00
Nikolay Sivov
891217664a
vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'dword' type.
2023-02-23 21:46:38 +01:00
Francisco Casas
d07247249a
vkd3d-shader/hlsl: Store the type's register size for each register set.
2023-02-22 18:28:19 +01:00
Francisco Casas
2142d31f13
vkd3d-shader/hlsl: Fix number of components when creating a swizzle in copy-prop.
...
Otherwise we may create nodes of different dimensions than the ones we
are replacing.
"count" is the number of components of the source deref (without
considering the swizzle), while "instr_component_count" is the actual
number of components of the instruction to be replaced.
2023-02-20 21:59:31 +01:00
Giovanni Mascellani
7c3dadce6b
vkd3d-shader/hlsl: Write SM4 break instructions.
2023-02-15 21:53:21 +01:00
Zebediah Figura
4b944517b7
vkd3d-shader/hlsl: Inline function calls.
2023-02-13 22:16:53 +01:00
Zebediah Figura
8bdee6681b
vkd3d-shader/hlsl: Lower return statements.
2023-02-13 22:16:51 +01:00
Zebediah Figura
0cf39f3c63
vkd3d-shader/hlsl: Emit a hlsl_fixme() if multiple valid entry point definitions are given.
2023-02-13 22:16:49 +01:00
Zebediah Figura
bb41c3b5fe
vkd3d-shader/hlsl: Skip functions that don't have a body when looking for the entry point.
2023-02-13 22:16:48 +01:00
Zebediah Figura
4c46075d86
vkd3d-shader/hlsl: Use the original hlsl_ir_function_decl struct rather than allocating a new one for each definition.
...
We need to make sure every invocation points to the same hlsl_ir_function_decl
and the same parameters.
This fixes some invalid memory accesses.
2023-02-07 22:15:06 +01:00
Zebediah Figura
25d49b518d
vkd3d-shader/hlsl: Put synthetic variables into a dummy scope.
...
Prevent them from being ever looked up.
Our naming scheme for synthetic variables already effectively prevents this, but
this is better for clarity. We also will need to be able to move some named
variables into a dummy scope to account for complexities around function
definition and declarations.
2023-02-07 22:15:06 +01:00
Zebediah Figura
8755a92196
vkd3d-shader/hlsl: Add a hlsl_cleanup_semantic() helper.
2023-02-07 22:15:06 +01:00
Zebediah Figura
cb2c89a589
vkd3d-shader/hlsl: Store function parameters in an array.
2023-02-07 22:15:06 +01:00
Nikolay Sivov
06f300ec59
vkd3d-shader/hlsl: Support dot() for SM1.
2023-02-02 20:51:12 +01:00
Francisco Casas
f33ca836d7
vkd3d-shader/hlsl: Make single-component swizzles retrieve a scalar.
2023-01-26 21:52:18 +01:00
Francisco Casas
404a2d6a3d
vkd3d-shader/hlsl: Reinterpret minimum precision types as their regular counterparts.
...
Reinterpret min16float, min10float, min16int, min12int, and min16uint
as their regular counterparts: float, float, int, int, uint,
respectively.
A proper implementation would require adding minimum precision
indicators to all the dxbc-tpf instructions that use these types.
Consider the output of fxc 10.1 with the following shader:
uniform int i;
float4 main() : sv_target
{
min16float4 a = {0, 1, 2, i};
min16int2 b = {4, i};
min10float3 c = {6.4, 7, i};
min12int d = 9.4;
min16uint4x2 e = {14.4, 15, 16, 17, 18, 19, 20, i};
return mul(e, b) + a + c.xyzx + d;
}
However, if the graphics driver doesn't have minimum precision support,
it ignores the minimum precision indicators and runs at 32-bit
precision, which is equivalent as working with regular types.
2023-01-25 22:10:23 +01:00
Zebediah Figura
8fd30aa87d
vkd3d-shader/hlsl: Add some swizzle manipulation definitions.
2023-01-24 18:10:39 +01:00
Zebediah Figura
521f22e57a
vkd3d-shader/hlsl: Store a non-constant hlsl_ir_function_decl pointer in struct hlsl_ir_call.
2023-01-19 19:16:25 +01:00
Zebediah Figura
447463e590
vkd3d-shader/hlsl: Remove the unused "intrinsic" argument from hlsl_add_function().
2023-01-19 19:16:24 +01:00
Zebediah Figura
61f0d6d151
vkd3d-shader/hlsl: Get rid of the "intrinsic" field of struct hlsl_ir_function.
...
We have a different system of generating intrinsics, which makes it easier to
deal with "polymorphic" arithmetic functions.
Defining and storing intrinsics as hlsl_ir_function_decls would also require
more space in memory (and more optimization passes to get rid of the parameter
variables), and doesn't really save us any effort in terms of source code.
2023-01-13 17:32:44 +01:00
Zebediah Figura
b29d3489de
vkd3d-shader/hlsl: Generate IR for user-defined function calls.
2023-01-13 17:32:42 +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
Francisco Casas
6f6ba8aa56
vkd3d-shader/hlsl: Properly free new store node memory if init_deref() fails.
2022-11-10 22:48:11 +01:00
Zebediah Figura
3857ca06fa
vkd3d-shader/hlsl: Write SM4 dcl_thread_group instructions.
2022-11-08 20:53:08 +01:00
Zebediah Figura
d6799bd5d3
vkd3d-shader/hlsl: Parse function attributes.
2022-11-08 20:53:03 +01:00
Zebediah Figura
da56f41ceb
vkd3d-shader/hlsl: Use hlsl_new_synthetic_var() in hlsl_new_func_decl().
2022-11-08 20:53:01 +01:00
Zebediah Figura
1019bbead6
vkd3d-shader/hlsl: Add a hlsl_fixme() for compute shader thread counts.
...
In particular so that we don't cause test crashes by outputting invalid compute
shaders.
2022-11-08 20:52:59 +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
6b45f290f7
vkd3d-shader/hlsl: Pass a location pointer to init_node().
...
Instead of a flat location structure.
2022-10-12 21:58:03 +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
Zebediah Figura
991cddd139
vkd3d-shader/hlsl: Handle failure from hlsl_copy_deref().
2022-09-27 20:14:49 +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