Commit Graph

895 Commits

Author SHA1 Message Date
Francisco Casas
f21693b284 vkd3d-shader/hlsl: Use reg_size as component count when allocating a single register.
Otherwise, for instance, the added test results in:

debug_hlsl_writemask: Assertion `!(writemask & ~VKD3DSP_WRITEMASK_ALL)' failed.

Which happens in allocate_variable_temp_register() when the variable's
type reg_size is <= 4 but its component count is larger, which may
happen if it contains objects.
2022-11-10 22:48:26 +01:00
Francisco Casas
6873b71304 vkd3d-shader/hlsl: Validate that statics don't contain both resources and numerics. 2022-11-10 22:48:21 +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
c0782a9029 tests: Add some tests for HLSL attribute syntax. 2022-11-08 20:52:59 +01:00
Zebediah Figura
4d17758657 tests: Always compile HLSL shaders.
Do not rely on a draw or dispatch command to do this.

This allows more efficiently testing syntax, in cases where testing the actual
shader functionality is not interesting.
2022-11-08 20:52:57 +01:00
Zebediah Figura
c416627e64 vkd3d-shader/hlsl: Propagate copies for resource store instructions. 2022-10-31 22:07:47 +01:00
Francisco Casas
4096d453c4 tests: Add a test for storing to a UAV array. 2022-10-31 22:07:40 +01:00
Zebediah Figura
8044fce040 tests: Add more tests for UAV allocation. 2022-10-31 22:07:40 +01:00
Zebediah Figura
52069386c4 tests: Fix constructor declaration in the partial UAV write test.
Make sure the test fails for the right reason. Spotted by Francisco Casas.
2022-10-31 22:07:37 +01:00
Francisco Casas
b711b2d66b tests: Add additional tests for explicit casts with flat matrices and vectors. 2022-10-26 23:53:12 +02:00
Francisco Casas
fcef269347 tests: Add additional tests for explicit casts with matrices. 2022-10-26 23:53:12 +02:00
Francisco Casas
588645a79a tests: Add additional tests for explicit casts with vectors. 2022-10-26 23:53:10 +02:00
Francisco Casas
5af7316a12 vkd3d-shader/hlsl: Support explicit cast between component-wise compatible types. 2022-10-25 21:25:58 +02:00
Francisco Casas
d21fd584b1 vkd3d-shader/hlsl: Support implicit casts between component-wise equal types. 2022-10-25 21:25:57 +02:00
Francisco Casas
1c77811648 vkd3d-shader/hlsl: Remove incorrect criteria for accepting implicit casts. 2022-10-25 21:25:55 +02:00
Francisco Casas
d93ce28995 vkd3d-shader/hlsl: Handle complex types in add_cast().
This extends the support of this function, whether doing broadcasts or
component-wise casts, to struct and array types.
2022-10-25 21:25:51 +02:00
Francisco Casas
fb751b48c5 tests: Add additional tests for implicit casts that should fail. 2022-10-25 21:25:51 +02:00
Zebediah Figura
fea50d243c vkd3d-shader/hlsl: Parse texture index expressions. 2022-10-19 21:59:55 +02:00
Zebediah Figura
62fd13059b tests: Add a basic shader test for typed UAV loads. 2022-10-19 21:59:55 +02:00
Zebediah Figura
75494a4ae6 tests: Add a basic shader test for compute shaders. 2022-10-19 21:59:29 +02:00
Giovanni Mascellani
c644244bcd tests: Test float operations with uniform inputs.
The point of the "uniform" variants is to avoid hiding code generation
bugs because of the constant folding optimization.
2022-10-19 21:59:18 +02:00
Giovanni Mascellani
b6a6a927a7 tests: Test sign rules for float modulus. 2022-10-19 21:59:18 +02:00
Giovanni Mascellani
d1da5436f4 tests: Test sign rules for integer division and modulus. 2022-10-19 21:59:18 +02:00
Giovanni Mascellani
0a07ac6f88 vkd3d-shader/hlsl: Lower float modulus.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-10-19 21:59:17 +02:00
Giovanni Mascellani
eb119878f7 vkd3d-shader/hlsl: Lower int modulus.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-10-19 21:59:15 +02:00
Francisco Casas
09d7442cb1 tests: Test explicit casts between types that are component-wise compatible. 2022-10-17 17:59:04 +02:00
Francisco Casas
653b109d8f tests: Test implicit casts between types that are equal component-wise. 2022-10-17 17:59:01 +02:00
Francisco Casas
5a1b0dbf44 vkd3d-shader/hlsl: Always go through implicit conversion in assignments.
Otherwise we silently skip some type checks.
2022-10-17 17:58:56 +02:00
Francisco Casas
e56db9bda5 tests: Test for invalid complex broadcasts. 2022-10-17 17:58:56 +02:00
Francisco Casas
791f8a8faa tests: Rename structs for readability in broadcast test. 2022-10-17 17:58:53 +02:00
Francisco Casas
3bae0c92c7 tests: Set ULPs to 2 in normalize() test.
Otherwise the test fails on a NVIDIA GeForce GTX 1050 Ti GPU.

The error being:
shader_runner:535:Section [test], line 9: Test failed: Got {2.72165507e-01, 4.08248246e-01, 5.44331014e-01, 6.80413783e-01}, expected {2.72165537e-01, 4.08248305e-01, 5.44331074e-01, 6.80413842e-01} at (0, 0).
2022-10-17 17:58:50 +02:00
Giovanni Mascellani
eb7b594002 vkd3d-shader/hlsl: Lower int division. 2022-10-17 17:58:17 +02:00
Giovanni Mascellani
4c13ae5764 vkd3d-shader/hlsl: Lower int absolute value. 2022-10-17 17:58:14 +02:00
Giovanni Mascellani
ef4990d996 tests: Test int absolute value. 2022-10-17 17:58:14 +02:00
Giovanni Mascellani
5442f4236c vkd3d-shader/hlsl: Write SM4 square root instructions. 2022-10-17 17:58:12 +02:00
Giovanni Mascellani
a43242a3e6 tests: Test length() intrinsic. 2022-10-17 17:58:09 +02:00
Zebediah Figura
1e10b5e616 vkd3d-shader/hlsl: Write SM4 reinterpret instructions. 2022-10-12 21:57:59 +02:00
Zebediah Figura
eb70f1aeb5 tests: Add a test for asuint(). 2022-10-12 21:57:55 +02:00
Giovanni Mascellani
1655d309bd vkd3d-shader/hlsl: Write SM4 rsq instructions. 2022-10-10 21:13:04 +02:00
Giovanni Mascellani
4ab1a4cef5 tests: Test normalize() intrinsic. 2022-10-10 21:13:01 +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
b7c94b0213 tests: Check for failure from init_test_context() in the d3d11 runner. 2022-09-19 21:51:30 +02:00
Zebediah Figura
53d6966a5d tests: Mark test_hull_shader_relative_addressing() as broken on radv.
Broken for me with "AMD Radeon RX 560 Series (RADV POLARIS11)" (1002:67ef) but works with llvmpipe; Mesa 22.2.0-rc3.
2022-09-19 21:51:30 +02:00
Zebediah Figura
7393e6ed13 tests: Transition back to D3D12_RESOURCE_STATE_RENDER_TARGET in test_bufinfo_instruction(). 2022-09-19 20:13:57 +02: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
6989266e76 vkd3d-shader/hlsl: Check for non-static object references.
It is responsibility of the shader's programmer to ensure that
object references can be solved statically.

Resource arrays for ps_5_1 and vs_5_1 are an exception which is not
properly handled yet. They probably deserve a different object type.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
a8b77b85ca vkd3d-shader/hlsl: Skip implicit conversion if types are equal.
Otherwise we get false in implicit_compatible_data_types() when passing
types that are equal but not convertible according to
convertible_data_type(); e.g. getting:

"Can't implicitly convert from Texture2D<float4> to Texture2D<float4>."

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
732f1737f4 vkd3d-shader/hlsl: Set component count for objects to 1.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00
Francisco Casas
e9829fdc65 tests: Test object references.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
2022-08-23 15:57:54 -05:00