Commit Graph

1610 Commits

Author SHA1 Message Date
Conor McCarthy
759362b527 tests: Test an interpolated PS input where component x is unused.
FXC does not emit an interpolation mode for unused elements.
2024-01-18 23:15:26 +01:00
Conor McCarthy
4c30b23821 vkd3d-shader: Make the control point count the outer dimension of I/O arrays.
The relative-addressed case in shader_register_normalise_arrayed_addressing()
leaves the control point id in idx[0], while for constant register
indices it is placed in idx[1]. The latter case could be fixed instead,
but placing the control point count in the outer dimension is more
logical.
2024-01-17 22:28:59 +01:00
Conor McCarthy
b8561d6fd2 tests: Test punned array access in patch constant functions.
The FXC optimiser sometimes converts a local array of input values into
direct array addressing of the inputs, which can result in a
dcl_indexrange instruction spanning input elements with different masks.
2024-01-17 22:28:58 +01:00
Zebediah Figura
16962ac6f1 vkd3d-shader/hlsl: Allow non-numeric types in the ternary operator. 2024-01-17 22:28:51 +01:00
Zebediah Figura
9ac210eb1e tests: Add many more tests for ternary expressions. 2024-01-17 22:28:50 +01:00
Nikolay Sivov
e7d65d39ba vkd3d-shader/fx: Initial support for fx_5_0 output. 2024-01-15 19:57:42 +01:00
Francisco Casas
43ff28b00b vkd3d-shader/hlsl: Emit fixmes on non-constant vector addressing.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56162

Storing to a vector component using a non-constant index is not allowed
on profiles lower than 6.0. Unless this happens inside a loop that can be
unrolled, which we are not doing yet.

For this reason, a validate_nonconstant_vector_store_derefs pass is
added to detect these cases.

Ideally we would want to emit an hlsl_error on this pass, but before
implementing loop unrolling, we could reach this point on valid HLSL.

Also, as pointed out by Nikolay in the mentioned bug, currently
new_offset_from_path_index() fails an assertion when this happens,
because it expects an hlsl_ir_constant, so a check is added.
It also felt correct to emit an hlsl_fixme there, despite the
redundancy.
2024-01-15 19:57:12 +01:00
Conor McCarthy
c5bc28b454 tests/d3d12: Test vector parameter for countbits() and firstbithigh() in test_shader_instructions(). 2024-01-15 19:56:36 +01:00
Nikolay Sivov
a0207436f2 vkd3d-shader/tpf: Add initial support for writing fx_4_0/fx_4_1 binaries.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:48 +01:00
Nikolay Sivov
e527d7c1e7 vkd3d-shader/hlsl: Handle effect group statement.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:46 +01:00
Nikolay Sivov
f7a02a5da2 vkd3d-shader/hlsl: Add variables for techniques.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:45 +01:00
Nikolay Sivov
c3af1f9989 vkd3d-shader/hlsl: Add 'fxgroup' token.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:42 +01:00
Nikolay Sivov
ffae369748 tests: Add some tests for effects groups syntax.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:42 +01:00
Giovanni Mascellani
90bcc6691d tests: Mark resource arrays as buggy on MoltenVK.
They require Vulkan descriptor indexing extension, which is
exposed by MoltenVK but known to be buggy, so we assume it is
disabled.
2024-01-08 21:44:58 +01:00
Giovanni Mascellani
a610ccaed9 tests: Mark predicated rendering as buggy on MoltenVK.
It requires Vulkan conditional rendering extension.
2024-01-08 21:44:56 +01:00
Giovanni Mascellani
54514ba7dd tests: Mark streaming output as buggy on MoltenVK.
It requires Vulkan transform feedback extension.
2024-01-08 21:44:55 +01:00
Giovanni Mascellani
1cc2ccaf98 tests: Mark some sampling tests as buggy on MoltenVK.
Apparently Metal doesn't support specifying a bias directly in the
sampler, and, with "nearest" mip filtering, it doesn't switch
precisely at LOD 0.5 (though still between 0.5 and 0.6).
2024-01-08 21:44:53 +01:00
Giovanni Mascellani
9c9b1fadbd tests: Use a uint target for rendering uint data.
This fixes a failure in MoltenVK.
2024-01-08 21:44:50 +01:00
Zebediah Figura
1ce7e3d8b1 vkd3d-shader/d3dbc: Assign unique register indices for VKD3DSPR_RASTOUT. 2024-01-04 22:23:09 +01:00
Henri Verbeet
62f18f749b tests: Print the failing line numbers when a test fails.
Currently, if a probe fails, it will print the line number of the [test]
block the probe is in, not the line number of the probe itself. This
makes it somewhat difficult to debug.

This commit makes it print the line number that a test fails at.
2024-01-02 23:03:25 +01:00
Conor McCarthy
812f01c2e2 vkd3d-shader/spirv: Handle ITOI and UTOU in spirv_compiler_map_alu_instruction().
These instructions perform integer casts to/from 64 bits.
2024-01-02 23:03:07 +01:00
Conor McCarthy
99924d913b vkd3d-shader/spirv: Support 64-bit sources in spirv_compiler_emit_int_div(). 2024-01-02 23:03:05 +01:00
Conor McCarthy
13459a55f1 vkd3d-shader/spirv: Introduce a UINT64 component type. 2024-01-02 23:03:04 +01:00
Conor McCarthy
cc43ef3bca vkd3d: Pass int64 capability info to vkd3d-shader. 2024-01-02 23:03:00 +01:00
Zebediah Figura
6a514ebe8e tests: Avoid using "SV_Position" as a name for the vertex shader input.
We use vkd3d_shader_find_signature_element() in the Vulkan runner, and
vkd3d-shader translates SM1 position to "POSITION".
2023-12-14 23:19:30 +01:00
Zebediah Figura
aa44f9b390 tests: Use struct vkd3d_shader_scan_signature_info to retrieve the VS input signature.
In order to allow retrieving it from d3dbc shaders.
2023-12-14 23:19:28 +01:00
Conor McCarthy
f23426ec32 tests/shader-runner: Check for int64 support in the Vulkan runner. 2023-12-14 21:00:41 +01:00
Conor McCarthy
a80ea8168f tests/shader-runner: Check for float64 support in the Vulkan runner. 2023-12-14 21:00:39 +01:00
Conor McCarthy
cd43cb3752 tests/shader-runner: Check for float64 support in the d3d11 runner. 2023-12-14 21:00:38 +01:00
Giovanni Mascellani
09235d9e09 tests: Test assigning multisampled textures with different sample counts. 2023-12-13 22:32:38 +01:00
Conor McCarthy
af731024d7 tests/shader-runner: Fix the arithmetic-int-uniform int64 abs expected results. 2023-12-13 22:32:31 +01:00
Conor McCarthy
108941fce0 tests/shader-runner: Add 64-bit bitwise tests. 2023-12-12 22:50:52 +01:00
Conor McCarthy
27d4ccf225 tests/shader-runner: Add 64-bit arithmetic tests. 2023-12-12 22:50:51 +01:00
Conor McCarthy
8a1eb306e8 tests/shader-runner: Introduce a 'float64' requirement directive. 2023-12-12 22:50:50 +01:00
Conor McCarthy
95c48eb98e tests/shader-runner: Introduce an 'int64' requirement directive. 2023-12-12 22:50:49 +01:00
Conor McCarthy
af86cdf713 tests/shader-runner: Add a non-const-indexing test for asfloat() result storage. 2023-12-11 23:18:54 +01:00
Conor McCarthy
3db7c2a62d vkd3d-shader/dxil: Implement the DXIL STORE instruction. 2023-12-11 23:18:51 +01:00
Conor McCarthy
df82c61482 tests/shader-runner: Test an uninitialised indexable temp. 2023-12-11 23:18:49 +01:00
Stefan Dösinger
b0d1fb0bd7 tests: Show that CreatePipelineState also doesn't reuse duplicate objects. 2023-12-07 21:57:45 +01:00
Stefan Dösinger
1eaf7fa37b tests: Show that compute pipeline state objects are not reused. 2023-12-07 21:57:45 +01:00
Stefan Dösinger
82a3209ee2 tests: Show that graphics pipeline state objects are not reused. 2023-12-07 21:57:45 +01:00
Stefan Dösinger
705cf10626 tests: Show that creating identical root signatures returns the same pointer. 2023-12-07 21:57:45 +01:00
Zebediah Figura
fcd6ec33bd tests: Avoid shadowing "l" in test_get_copyable_footprints().
Found with -Wshadow.
2023-12-07 21:57:18 +01:00
Conor McCarthy
a33a9127ca vkd3d-shader/dxil: Implement DX intrinsic Unary. 2023-12-07 21:56:53 +01:00
Conor McCarthy
16cb6fdbad vkd3d-shader/spirv: Support constant initialisers in indexable temps. 2023-12-07 21:56:44 +01:00
Henri Verbeet
0c33f82f72 Release 1.10. 2023-12-06 15:31:21 +01:00
Francisco Casas
736f3ae2df vkd3d-shader/hlsl: Use values at the time of the swizzle's load in copy-propagation.
This preempts us from replacing a swizzle incorrectly, as in the
following example:

    1: A.x = 1.0
    2: A
    3: A.x = 2.0
    4: @2.x

were @4 ends up being 2.0 instead of 1.0, because that's the value stored in
A.x at time 4, and we should be querying it at time 2.

This also helps us to avoid replacing a swizzle with itself in copy-prop
which can result in infinite loops, as with the included tests this commit.

Consider the following sequence of instructions:

    1 : A
    2 : B = @1
    3 : B
    4 : A = @3
    5 : @1.x

Current copy-prop would replace 5 so it points to @3 now:

    1 : A
    2 : B = @1
    3 : B
    4 : A = @3
    5 : @3.x

But in the next iteration it would make it point back to @1, keeping it
spinning infinitively.

The solution is to index the instructions and don't replace the swizzle
if the new load happens after the current load.
2023-11-29 22:53:24 +01:00
Francisco Casas
e6b7b38a29 tests: Test current failure when propagating swizzles.
The included test fails because copy_propagation_transform_swizzle()
is using the value recorded for the variable when the swizzle is being
read, and not the swizzle's load.
2023-11-29 22:53:16 +01:00
Zebediah Figura
d1ce069ea6 tests/shader_runner: Remove an unnecessary local variable declaration.
Found with -Wshadow.
2023-11-28 00:09:51 +01:00
Alistair Leslie-Hughes
5c134d44d6 include: D3D12_RT_FORMAT_ARRAY remove typedef to make header compatible with windows.
windows d3d12.idl doesn't have this as a typedef.
2023-11-28 00:09:20 +01:00
Giovanni Mascellani
f0a16d84ce ci: Execute the shader runner on the correct test data on Windows. 2023-11-23 22:37:21 +01:00
Henri Verbeet
beb3f6e0c2 tests: Introduce an OpenGL shader runner. 2023-11-22 22:08:11 +01:00
Francisco Casas
4e1bf5e163 vkd3d-shader/hlsl: Discern between signed and unsigned ints when parsing. 2023-11-22 22:08:05 +01:00
Francisco Casas
1ee9e23e00 tests: Test overloads with signed and unsigned numeric values. 2023-11-22 22:08:05 +01:00
Francisco Casas
9a8f6e0edb vkd3d-shader/hlsl: Parse integers with the 'u' postfix. 2023-11-22 22:08:04 +01:00
Francisco Casas
3f09cdcaa1 tests: Test integers with the 'u' postfix. 2023-11-22 22:08:04 +01:00
Conor McCarthy
eb05e434ff vkd3d-shader/dxil: Implement the DXIL LOAD instruction. 2023-11-22 22:07:59 +01:00
Henri Verbeet
73c563ffb7 vkd3d-shader/d3dbc: Adjust the token count for DEF and DEFI instructions in shader_sm1_skip_opcode().
This was broken by commit e390bc35e2c9b0a2110370f916033eea2366317e; that
commit fixed the source count for these instructions, but didn't adjust
shader_sm1_skip_opcode(). Note that this only affects shader model 1;
later versions have a token count embedded in the initial opcode token.
2023-11-20 22:07:29 +01:00
Akihiro Sagawa
aed2d142cf vkd3d-shader/hlsl: Add degrees() function. 2023-11-20 22:07:19 +01:00
Akihiro Sagawa
e493627130 vkd3d-shader/hlsl: Add radians() function. 2023-11-20 22:07:17 +01:00
Conor McCarthy
63b8972b0e tests: Test CreatePipelineState().
Based on vkd3d-proton patches by Hans-Kristian Arntzen and Philip
Rebohle.
2023-11-15 21:48:44 +01:00
Conor McCarthy
3c4631a4d4 vkd3d-shader/dxil: Implement the DXIL VSELECT instruction. 2023-11-15 21:48:35 +01:00
Conor McCarthy
130e7bdf0f tests/shader-runner: Add tests for 64-bit casts. 2023-11-15 21:48:33 +01:00
Conor McCarthy
38e85079aa tests/shader-runner: Add a test for float comparisons. 2023-11-15 21:48:30 +01:00
Conor McCarthy
d957247c67 tests/shader-runner: Run d3d11 tests with a mimimum shader model of 4.0.
Passing less than 4.0 breaks the use of [require] with
'shader model < 4.0'.
2023-11-15 21:48:28 +01:00
Henri Verbeet
9de793f180 vkd3d-shader: Implement scanning combined resource/sampler information. 2023-11-13 23:19:23 +01:00
Nikolay Sivov
41a72a4eae tests: Fix some spelling mistakes. 2023-11-13 23:19:14 +01:00
Conor McCarthy
d3b90cc877 vkd3d-shader/dxil: Implement the DXIL CMP2 instruction. 2023-11-10 20:23:50 +01:00
Zebediah Figura
514d179b70 vkd3d-shader/hlsl: Do not consider scalars and 1-dimensional vectors to be equivalent in function parameters. 2023-11-09 21:15:14 +01:00
Zebediah Figura
3e35570221 tests: Add some more tests for function overloads. 2023-11-09 21:15:08 +01:00
Conor McCarthy
90d178bf12 vkd3d-shader/dxil: Implement the DXIL CAST instruction. 2023-11-09 21:14:42 +01:00
Zebediah Figura
0805ce121e tests: Add more semantics to test_nop_tessellation_shaders().
To act as a regression test for 852eefc01d.
2023-11-08 22:49:51 +01:00
Nikolay Sivov
4778d051df vkd3d-shader: Add constant folding for 'floor'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:40 +01:00
Nikolay Sivov
494f681bf6 vkd3d-shader/tpf: Add support for ceil().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:38 +01:00
Nikolay Sivov
e57bf3db0b tests: Add some tests for ceil().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:37 +01:00
Nikolay Sivov
522a0dfb56 vkd3d-shader/hlsl: Add tex2Dlod() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-08 22:49:26 +01:00
Francisco Casas
0ef25ad137 vkd3d-shader/tpf: Support relative addressing for indexable temps in SM4.
For relative addressing, the vkd3d_shader_registers must point to
another vkd3d_shader_src_param. For now, use the sm4_instruction to save
them, since the only purpose of this struct is to be used as paramter
for write_sm4_instruction.
2023-11-07 22:25:49 +01:00
Francisco Casas
915f9f1373 tests: Add aditional relative addressing tests. 2023-11-07 22:25:44 +01:00
Francisco Casas
3deb3b5a21 tests: Rename array-index-expr.shader_test as non-const-indexing.shader_test. 2023-11-07 22:25:42 +01:00
Conor McCarthy
749df8dec2 vkd3d-shader/dxil: Implement the DXIL BINOP instruction. 2023-11-06 23:09:03 +01:00
Conor McCarthy
7419f4e31d vkd3d-shader/dxil: Allow empty struct types. 2023-11-02 18:23:12 +01:00
Nikolay Sivov
dbcc4c4e40 vkd3d-shader/hlsl: Parse empty technique declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:07 +01:00
Nikolay Sivov
53b0101a53 vkd3d-shader/hlsl: Use case-insensitive match for the "technique" keyword.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:06 +01:00
Nikolay Sivov
ea8ff5394c vkd3d-shader/hlsl: Add a keyword for fx_5_0 techniques.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:05 +01:00
Nikolay Sivov
c588f33822 tests: Add some tests for using technique blocks when compiling for pixel/vertex profiles.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-02 18:23:04 +01:00
Nikolay Sivov
ecdc3f39d4 vkd3d-shader: Accept 'loop' attribute, on loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-01 21:47:49 +01:00
Nikolay Sivov
26784672d8 vkd3d-shader: Check loop [unroll] attribute for conflict with other attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-01 21:47:49 +01:00
Nikolay Sivov
b8047fd650 tests: Add some tests for loop attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-01 21:47:49 +01:00
Giovanni Mascellani
c691ad8869 tests: Immediately transition buffers after creation in the shader runner.
The resource could be destructed before the command list left open
is executed; instead, we immediately perform the transition.
2023-11-01 21:47:44 +01:00
Giovanni Mascellani
46b7fccfd7 tests: Immediately transition textures after creation in the shader runner.
The resource could be destructed before the command list left open
is executed; instead, we immediately perform the transition.
2023-11-01 21:47:43 +01:00
Giovanni Mascellani
ca7fa0c015 tests: Immediately transition resources after readback in the shader runner.
The resource could be destructed before the command list left open
is executed; instead, we immediately perform the transition.
2023-11-01 21:47:41 +01:00
Conor McCarthy
589670180a vkd3d-shader/dxil: Implement the DXIL EXTRACTVAL instruction. 2023-11-01 21:47:34 +01:00
Nikolay Sivov
8e5c8c1725 tests: Add some tests for 'technique' token behaviour.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:45 +01:00
Nikolay Sivov
214d44fb11 tests: Add [effect] section support.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:45 +01:00
Nikolay Sivov
ea554b91d7 tests: Remove unused parameter from mul() tests functions. 2023-10-31 21:59:29 +01:00
Francisco Casas
ab463f74bd tests: Test array indexing with multiple swizzles. 2023-10-31 21:59:11 +01:00
Nikolay Sivov
bc2a4ee66a vkd3d-shader/tpf: Write out 'switch' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:05 +01:00
Nikolay Sivov
68c14079a6 vkd3d-shader/hlsl: Add a pass to normalize switch cases blocks.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:04 +01:00
Nikolay Sivov
72623031a2 vkd3d-shader/hlsl: Validate break/continue context.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:59:01 +01:00
Nikolay Sivov
ec8dfa467f vkd3d-shader/hlsl: Add initial support for parsing 'switch' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:58:57 +01:00
Nikolay Sivov
ebb5aacabf tests: Add some tests for the 'switch' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:58:57 +01:00
Giovanni Mascellani
f462d237c1 ci: Run shader tests on Windows. 2023-10-31 21:58:53 +01:00
Giovanni Mascellani
dbc5e7d07c ci: Run cross tests on Windows.
A driver program is introduced to coordinate test running on Windows,
similarly to what "make test" does on Linux and macOS.
2023-10-31 21:58:51 +01:00
Henri Verbeet
f75bdd6e21 vkd3d-utils: Implement D3DStripShader(). 2023-10-19 23:07:50 +02:00
Henri Verbeet
96556a8834 vkd3d-shader/hlsl: Add support for RWTexture2DArray. 2023-10-19 23:07:31 +02:00
Henri Verbeet
6fe781ff50 tests: Add basic RWTexture2DArray tests. 2023-10-19 23:07:31 +02:00
Henri Verbeet
2c71c18879 vkd3d-shader/hlsl: Add support for RWTexture1DArray. 2023-10-19 23:07:30 +02:00
Henri Verbeet
ae9d29a377 tests: Add basic RWTexture1DArray tests. 2023-10-19 23:07:29 +02:00
Henri Verbeet
b63c853688 vkd3d-utils: Implement D3DGetBlobPart().
This was largely adapted from Wine's d3dcompiler_43, with some style
adjustments.
2023-10-18 20:58:22 +02:00
Giovanni Mascellani
0dc40d7c1e tests: Skip processing resources according to [require] directives. 2023-10-18 20:58:19 +02:00
Giovanni Mascellani
d69c04471e tests: Do not test matrix majority on SM1-3.
I'm not sure of what's happening here, but it seems that this change
fixes a crash when running on Windows in the CI. Since most of the
test excludes SM1-3 anyway, this shouldn't be a big loss.
2023-10-18 20:58:18 +02:00
Giovanni Mascellani
ca51c359ec tests: Fix the usage of require directives.
They are reset each time "[require]" is encountered.
2023-10-18 20:58:17 +02:00
Giovanni Mascellani
ead98ef329 tests: Remove an irrelevant input from a test.
The irrelevant input caused the test to fail on D3D12 for reasons
unrelated to the test's goal.
2023-10-18 20:58:16 +02:00
Giovanni Mascellani
671548494f tests: Do not test integral types for SM1-3. 2023-10-18 20:58:16 +02:00
Giovanni Mascellani
90f9407b80 tests: Do not use global half values.
They are not allowed by the native compiler, except in compatibility
mode.
2023-10-18 20:58:14 +02:00
Henri Verbeet
803e5183cc tests: Specify argument types for dxcompiler_create(). 2023-10-17 22:18:36 +02:00
Henri Verbeet
47d4097efa vkd3d-utils: Check for a NULL 'blob' pointer in D3DCreateBlob(). 2023-10-16 22:36:58 +02:00
Giovanni Mascellani
eaf35c394d tests: Skip test_atomic_instructions() on WARP.
Pipeline creation fails with E_INVALIDARG, atomics are likely not
supported on WARP.
2023-10-16 22:36:52 +02:00
Giovanni Mascellani
0d4a5f1860 tests: Skip test_unbounded_resource_arrays() on WARP.
Most reads on WARP are off by a few units. I haven't investigated
the reason.
2023-10-16 22:36:50 +02:00
Giovanni Mascellani
fe88dafdbd tests: Skip test_execute_indirect() on WARP.
The device is eventually lost, indirect commands are likely not
supported on WARP.
2023-10-16 22:36:49 +02:00
Giovanni Mascellani
ee3c4b6555 tests: Skip test_get_copyable_footprints() on WARP.
There are 12025 failures with WARP. I haven't investigated them.
2023-10-16 22:36:47 +02:00
Giovanni Mascellani
d72e30f1d1 tests: Skip test_null_vbv() on WARP.
On WARP 0xffffffff is read instead of zero.
2023-10-16 22:36:45 +02:00
Giovanni Mascellani
14c9be697f tests: Acknowledge some double operations being broken on WARP. 2023-10-16 22:36:45 +02:00
Giovanni Mascellani
3f87cf9d7f tests: Acknowledge WARP giving a GPU handle to a non-shader-visible descriptor heap.
WARP has no GPU, so it probably treats GPU handles just like CPU handles.
2023-10-16 22:36:43 +02:00
Giovanni Mascellani
862dcf27a6 tests: Acknowledge WARP accepting some unusual CreateCommittedResource() configuration.
A software implementation can conceivably satisfy some requests that
cannot work on real hardware.
2023-10-16 22:36:41 +02:00
Conor McCarthy
e0d0a04b79 vkd3d-shader/dxil: Handle multi-row signature elements. 2023-10-16 22:36:38 +02:00
Henri Verbeet
e53178f395 tests: Use the same viewport origin and front-face orientation in the Vulkan and D3D runners.
I.e., top-left origin, and clockwise front-facing. These end up cancelling
each other out when drawing full-screen quads, but that's not necessarily true
for other geometry.
2023-10-16 22:36:22 +02:00
Giovanni Mascellani
c1de65a99b tests: Fail if dxcompiler is not available at runtime. 2023-10-16 22:36:17 +02:00
Conor McCarthy
57280673e5 tests/shader-runner: Test shaders with dxcompiler.
The location of dxcompiler should be set during configuration with
'DXCOMPILER_LIBS=-L/path/to/dxcompiler', and then at runtime with
LD_LIBRARY_PATH, WINEPATH or PATH as applicable.

A new 'fail(sm<6)' decoration is needed on many shader declarations
because dxcompiler succeeds on many shaders which fail with fxc. The
opposite case is less common and is flagged with 'fail(sm>=6)'. A few
tests cause dxcompiler to crash or hang, so these are avoided using
[require], which now skips tests until reset instead of exiting. Also,
'todo(sm<6)' and 'todo(sm>=6)' are used to separate checking of results.
2023-10-11 22:21:14 +02:00
Conor McCarthy
d211160b89 tests/shader-runner: Replace immediate shader type strings with an enum. 2023-10-11 22:21:14 +02:00
Conor McCarthy
0ef0735999 tests/shader-runner: Do not exit if a 'require' directive is not met.
Tests are skipped until the next 'require' directive, which restores
the defaults before the new requirements are read.
2023-10-11 22:21:14 +02:00
Conor McCarthy
192f4dcb2b tests/shader-runner: Handle individual keywords in shader directives.
Matching all possible combinations of keywords becomes too complex
if more keywords are added.
2023-10-11 22:21:14 +02:00
Nikolay Sivov
9c6c7cb78f vkd3d: Add partial implementation for CreateCommittedResource1(). 2023-10-10 22:11:46 +02:00
Nikolay Sivov
8479ceedfc vkd3d-shader/hlsl: Propagate structure fields modifiers when copying shader inputs.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:29 +02:00
Nikolay Sivov
1930b51d97 vkd3d-shader/hlsl: Allow interpolation modifiers on structure fields.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:27 +02:00
Nikolay Sivov
de860c3cbf vkd3d-shader/hlsl: Parse 'centroid' and 'noperspective' modifiers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:24 +02:00
Nikolay Sivov
4b8a4809d1 tests: Add a test for interpolation modifiers specified on structure fields.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:24 +02:00
Nikolay Sivov
c5414fa92f vkd3d-shader/tpf: Write 'continue' instruction.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:17 +02:00
Nikolay Sivov
0e5749e78e vkd3d-shader/hlsl: Allow 'break' instructions in loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:12 +02:00
Nikolay Sivov
89f493b900 tests: Add some tests for 'break'/'continue' in loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:12 +02:00
Nikolay Sivov
6ba75fd92f vkd3d: Add partial implementation for CreateHeap1().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:07 +02:00
Nikolay Sivov
7c378cc6f9 vkd3d-shader/hlsl: Remove conditional branching when condition is a compile time constant.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:16:09 +02:00
Nikolay Sivov
8ebccad3c9 vkd3d-shader/hlsl: Add constant folding for rshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:54 +02:00
Nikolay Sivov
6e74819eb7 vkd3d-shader/hlsl: Add constant folding for lshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:52 +02:00
Francisco Casas
e64e08b2b7 tests: Test register reservations on structs for SM5. 2023-10-05 16:15:30 +02:00
Nikolay Sivov
b5c0c9c22f vkd3d-shader/hlsl: Add fwidth() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:10 +02:00
Conor McCarthy
39be40ce94 tests: Destroy the test context in test_readback_map_stability(). 2023-10-02 22:25:10 +02:00
Henri Verbeet
5503a025d9 tests: Add some missing vkd3d_test_pop_context() calls to test_shader_instructions(). 2023-09-28 23:13:04 +02:00
Giovanni Mascellani
4374d45655 tests: Work around a MoltenVK bug in test_tgsm(). 2023-09-26 22:07:43 +02:00
Petrichor Park
976fd67f51 vkd3d-shader/hlsl: Implement intrinsic tan.
This commit also extends the trigonometry tests a little bit to make
sure that tan works right.
2023-09-25 22:07:13 +02:00
Giovanni Mascellani
ca05e57e67 tests: Mark a bug as resolved on Mesa. 2023-09-22 11:06:57 +02:00
Giovanni Mascellani
d640b213b2 tests: Do not crash if the render target doesn't support MSAA 8.
This currently happens on MoltenVK.
2023-09-22 11:06:50 +02:00
Giovanni Mascellani
6dfdbb5c26 tests: Do not crash if a pipeline statistics query heap cannot be created.
This currently happens on MoltenVK.
2023-09-22 11:06:44 +02:00
Giovanni Mascellani
d742770499 tests: Compile HLSL shaders at runtime in test_draw_depth_only(). 2023-09-22 11:06:41 +02:00
Giovanni Mascellani
4557ad36b0 tests: Compile HLSL shaders at runtime in test_draw_depth_no_ps(). 2023-09-22 11:06:41 +02:00
Giovanni Mascellani
b7c951ba78 tests: Compile HLSL shaders at runtime in test_scissor(). 2023-09-22 11:06:41 +02:00
Giovanni Mascellani
15c5ef5bb5 tests: Compile HLSL shaders at runtime in test_fractional_viewports(). 2023-09-22 11:06:40 +02:00
Giovanni Mascellani
49bbd98a04 vkd3d-shader/hlsl: Correctly fold casts from float.
I.e., without invoking undefined behavior in the compiler. The rules
are desumed from the the MSDN documentation for ftoi and ftou.
2023-09-22 11:06:28 +02:00
Nikolay Sivov
6d1ba83856 vkd3d-shader/hlsl: Use conditional moves for arithmetic operators instead of branching.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-22 11:06:22 +02:00
Zebediah Figura
9417c7cfb7 vkd3d-shader/d3dbc: Translate sm1 fragment outputs to system values. 2023-09-21 19:16:31 +02:00
Zebediah Figura
1615e5a76b vkd3d-shader/dxbc: Map sm4 fragment outputs to system values based on their name. 2023-09-21 19:16:29 +02:00
Henri Verbeet
419c6364db tests: Add a small test for vkd3d_shader_build_varying_map().
There's probably room for improvement, but this at least verifies the
function can be called.
2023-09-19 21:30:37 +02:00
Giovanni Mascellani
b8f2c3e1f4 tests: Relax the precision of some tests so that they pass on MoltenVK. 2023-09-18 21:04:06 +02:00
Nikolay Sivov
177ea3bcbd vkd3d-shader/hlsl: Produce 2D resource declarations and loads for tex1D().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-13 23:11:11 +02:00
Giovanni Mascellani
61b403a032 tests: Compile HLSL shaders at runtime in test_unknown_dsv_format(). 2023-09-13 23:11:04 +02:00
Giovanni Mascellani
264ff9e2da tests: Compile HLSL shaders at runtime in test_unknown_rtv_format(). 2023-09-13 23:11:04 +02:00
Giovanni Mascellani
b1cae0dd1e tests: Compile HLSL shaders at runtime in test_multiple_render_targets(). 2023-09-13 23:11:04 +02:00
Giovanni Mascellani
f7354ff9e3 tests: Compile HLSL shaders at runtime in test_create_compute_pipeline_state(). 2023-09-13 23:11:04 +02:00
Zebediah Figura
e847df9528 tests: Check the result of vkCreateGraphicsPipelines(). 2023-09-13 23:10:46 +02:00
Francisco Casas
39563aa5b3 vkd3d-shader/hlsl: Lower matrix swizzles. 2023-09-13 23:10:38 +02:00
Francisco Casas
60a3279318 tests: Test matrix swizzles. 2023-09-13 23:10:37 +02:00
Nikolay Sivov
cab1f57e01 tests: Add a test for fmod() with vector arguments.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:26 +02:00
Nikolay Sivov
1002a6b357 vkd3d-shader/tpf: Use 'movc' to implement ternary operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:25 +02:00
Nikolay Sivov
c5d680d141 vkd3d-shader/hlsl: Add tex1D() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-09-07 19:15:06 +02:00
Zebediah Figura
a597dc8755 vkd3d-shader/hlsl: Define lit() in HLSL. 2023-08-30 22:49:03 +02:00
Nikolay Sivov
c39c5b3907 vkd3d-shader/hlsl: Add texCUBE() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-29 22:07:56 +02:00
Nikolay Sivov
269747dbf3 tests: Enable compiler backwards compatibility mode only for shaders that require it.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-28 20:40:06 +02:00
Nikolay Sivov
18c1477464 vkd3d-shader/hlsl: Ignore 'inline' modifier for functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-28 20:39:53 +02:00
Nikolay Sivov
30be83f911 tests: Add some 'inline' function modifier tests.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-28 20:39:53 +02:00
Evan Tang
f374934281 tests: Test CopyResource depth to color. 2023-08-24 21:43:59 +02:00
Nikolay Sivov
1153f6bb34 vkd3d-shader/hlsl: Parse "if" statement attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-24 21:43:49 +02:00
Nikolay Sivov
9605993af3 tests: Add some tests for "if" statement attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-24 21:43:49 +02:00
Zebediah Figura
926575a6f3 vkd3d-shader/hlsl: Force sm1 inputs to be 4-component only for vertex shaders.
Pixel shaders still have an appropriate writemask.
2023-08-24 21:43:44 +02:00
Nikolay Sivov
4f2e07a45d vkd3d-shader/hlsl: Allow 'const' modifier without initializer in the global scope.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-15 21:51:50 +02:00
Nikolay Sivov
7fd10bb6bc tests: Add some tests for a 'const' modifier.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-15 21:51:50 +02:00
Francisco Casas
37cfbe47d7 vkd3d-shader/hlsl: Sort synthetic separated samplers first for SM4. 2023-08-15 21:51:31 +02:00
Francisco Casas
948c4145f5 tests: Test texture allocation ordering in complex scenarios. 2023-08-15 21:51:26 +02:00
Nikolay Sivov
25ff56769b vkd3d-shader: Add constant folding for the 'dot' operation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:15 +02:00
Zebediah Figura
bad72d1874 vkd3d-shader/d3dbc: Make sure all inter-stage varyings have a unique register index.
spirv will need this.
2023-08-03 21:20:22 +09:00
Zebediah Figura
b4bb3931c5 vkd3d-shader/preproc: Append spaces between tokens in macro invocations. 2023-08-02 20:19:21 +09:00
Zebediah Figura
250a24bd3f vkd3d-shader/preproc: Strip whitespace when stringifying. 2023-08-02 20:19:20 +09:00
Zebediah Figura
6fc3ae2b5c vkd3d-shader/preproc: Stringify text immediately in macro invocations. 2023-08-02 20:19:19 +09:00
Zebediah Figura
3a235b57f6 vkd3d-shader/preproc: Expand macro arguments in macro invocations.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55361
2023-08-02 20:19:17 +09:00
Zebediah Figura
9b98489155 vkd3d-shader/preproc: Parse hash marks as two separate tokens when not in stringification contexts. 2023-08-02 20:19:15 +09:00
Conor McCarthy
1e178efa01 tests/d3d12: Add tests for GetResourceTiling().
Based on vkd3d-proton patches by Philip Rebohle and
Hans-Kristian Arntzen.
2023-07-31 21:07:56 +09:00
Nikolay Sivov
bfdd5c142d vkd3d-shader/tpf: Add support for writing 'resinfo' instruction.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-31 21:07:50 +09:00
Nikolay Sivov
18731d71a6 tests: Add some tests for GetDimensions().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-31 21:07:46 +09:00
Nikolay Sivov
0b77b5f99e tests: Add some tests for matrix packing compiler options.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-24 22:41:10 +02:00
Nikolay Sivov
01faf6ad9e tests: Add test file syntax to specify compiler options.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-24 22:41:09 +02:00
Conor McCarthy
31ff1fa9b6 tests: Test releasing the command signature immediately after use.
D3D12 docs are silent on a required lifetime and immediate release
works in Windows.
2023-07-24 22:40:54 +02:00
Conor McCarthy
9014183100 vkd3d: Return a null handle from GetGPUDescriptorHandleForHeapStart() for non-shader-visible heaps. 2023-07-20 22:33:17 +02:00
Conor McCarthy
981034e6e4 tests: Test GetGPUDescriptorHandleForHeapStart() on a non-shader-visible heap. 2023-07-20 22:33:07 +02:00
Zebediah Figura
d077562f79 vkd3d-shader/d3dbc: Scan descriptors for constant register sets. 2023-07-17 22:56:39 +02:00
Nikolay Sivov
a18ace731d tests: Add a test for side effects of ternary operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-17 22:56:32 +02:00
Zebediah Figura
a55973d695 vkd3d-shader/hlsl: Lower combined samplers to separate sampler and texture objects for SM4.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
2023-07-17 22:55:51 +02:00
Francisco Casas
b8a85c6ad5 tests: Add lowering combined samplers tests. 2023-07-17 22:55:43 +02:00
Francisco Casas
ab37b27a7d tests: Pass D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY when compiling with the shader-runner. 2023-07-17 22:55:43 +02:00
Francisco Casas
c58d666d1b vkd3d-shader/hlsl: Handle resource components individually for SM 5.0. 2023-07-17 22:55:40 +02:00
Zebediah Figura
d4b5e79c8b vkd3d-shader/hlsl: Skip unallocated variables when looking for reservation conflicts. 2023-07-13 23:00:03 +02:00
Nikolay Sivov
06040d2a30 vkd3d-shader/hlsl: Disallow certain instruction types from constant expressions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:57 +02:00
Nikolay Sivov
a65c0b0e22 vkd3d-shader/hlsl: Support evaluated expressions for sample count in multisampled textures declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-07-04 22:39:55 +02:00
Francisco Casas
01800942a9 vkd3d-shader/hlsl: Declare vars individually when parsing struct declarations.
A struct declaration with variables is now absorbed into the 'declaration'
rule, like any other variable declaration.

A struct declaration without variables is now reduced to the
'struct_declaration_without_vars' rule.

They both are reduced to a 'declaration_statement' in the end.
2023-07-04 22:39:24 +02:00
Francisco Casas
62c891b796 vkd3d-shader/hlsl: Declare vars individually when parsing regular declarations.
In a declaration with multiple variables, the variables must be created
before the initializer of the next variable is parsed. This is required
for initializers such as:

    float a = 1, b = a, c = b + 1;

A requisite for this is that the type information is parsed in the same
rule as the first variable (as a variable_def_typed) so it is
immediately available to declare the first variable. Then, the next
untyped variable declaration is parsed, and the type from the first
variable can be used to declare the second, before the third is parsed,
and so on.
2023-07-04 22:39:21 +02:00
Francisco Casas
396edae281 tests: Test multiple variable initializers. 2023-07-04 22:39:18 +02:00
Francisco Casas
d8e6a1066d tests: Test semantics in uniform variables. 2023-07-04 22:39:18 +02:00
Francisco Casas
e4d94d955c vkd3d-shader/hlsl: Support fine derivates. 2023-07-04 22:39:12 +02:00
Francisco Casas
ff31284f8d vkd3d-shader/hlsl: Support coarse derivates. 2023-07-04 22:39:10 +02:00
Francisco Casas
dc84afe73a tests: Quantize regular and coarse derivate test results.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2023-07-04 22:39:07 +02:00
Francisco Casas
f0584cad62 tests: Make ddx() and ddy() test behave correctly for shader models < 4. 2023-07-04 22:39:07 +02:00
Francisco Casas
62e9b86697 tests: Test coarse and fine derivates.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2023-07-04 22:39:04 +02:00
Zebediah Figura
0d2f2e1860 tests: Move HLSL tests to a subdirectory. 2023-06-28 21:40:32 +02:00
Nikolay Sivov
3aee386e2f tests: Add another test for register reservation. 2023-06-27 22:34:42 +02:00
Zebediah Figura
69ecfdfb0b tests: Use compare_uint() in compare_float().
Comparing the result of abs() is broken in the case that x - y == INT_MIN.
2023-06-27 22:34:37 +02:00
Nikolay Sivov
861078d63a vkd3d-shader/hlsl: Handle 'texkill' discard type for sm4+.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:50 +02:00
Nikolay Sivov
6ef0213135 tests: Add some tests for clip().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:48 +02:00
Zebediah Figura
7e1fcdca89 vkd3d-shader: Synthesize signatures for d3dbc shaders. 2023-06-27 22:33:41 +02:00
Zebediah Figura
20190a1388 vkd3d-shader: Introduce an API to retrieve all signatures from DXBC shaders. 2023-06-27 22:33:41 +02:00
Nikolay Sivov
c8ffe8e1a8 vkd3d-shader/hlsl: Don't report a register type mismatch for unused reserved variables. 2023-06-22 22:00:19 +02:00
Zebediah Figura
d6ac823dd6 vkd3d-shader/hlsl: Don't set "allocated" for unused reserved variables. 2023-06-22 22:00:17 +02:00
Nikolay Sivov
883ab880e3 tests: Add more tests for unused registers with a reservation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-22 22:00:16 +02:00
Nikolay Sivov
d856be0519 vkd3d-shader/hlsl: Handle static constants in array size expressions. 2023-06-12 22:50:12 +02:00
Nikolay Sivov
38c89442ac tests: Add a test for array size expressions using static constants. 2023-06-12 22:50:12 +02:00
Francisco Casas
ebf7573571 vkd3d-shader/hlsl: Support non-constant vector indexing.
Non-constant vector indexing is not solved with relative addressing
in the register indexes because this indexation cannot be at the level
of register-components.

Mathematical operations must be used instead.
2023-06-07 20:48:59 +02:00
Francisco Casas
f24598c9a0 tests: Test indexing temps. 2023-06-07 20:48:57 +02:00
Francisco Casas
8d7cc8c84e tests: Test non-constant vector indexing. 2023-06-07 20:48:55 +02:00
Ethan Lee
aa17d139be tests: Add a test for arrays with an expression as the index.
Currently, the compiler requires that dereferences be HLSL_IR_CONSTANT, so that
it can compute the offset at compile time. However, scenarios such as this test
will produce a dereference with HLSL_IR_EXPR, which will generate an error.

Passing this test in particular will require adding support for SM4 relative
addressing, as well as support for non-constant indexing in general.

Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-29 20:21:01 +02:00
Ethan Lee
ea7d8c65bd vkd3d-shader/tpf: Add support for emitting sample_l instructions.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-24 22:00:41 +02:00
Conor McCarthy
6835e8176f vkd3d-shader/ir: Normalise signatures and input/output registers to the Shader Model 6 pattern.
In Shader Model 6 each signature element can span a range of register
indices, or 'rows', and system values do not share a register index with
non-system values. Inputs and outputs are referenced by element index
instead of register index. This patch merges multiple signature elements
into a single element under the following conditions:

- The register index in a load or store is specified dynamically by
  including a relative address parameter with a base register index. The
  dcl_index_range instruction is used to identify these.
- A register declaration is split across multiple elements which declare
  different components of the register.
- A patch constant function writes tessellation factors. These are an
  array in SPIR-V, but in SM 5.x each factor is declared as a separate
  register, and these are dynamically indexed by the fork/join instance
  id. Elimination of multiple fork/join phases converts the indices to
  constants, but merging the signature elements into a single arrayed
  element matches the SPIR-V output.

All references to input/output register indices are converted to element
indices. If a relative address is present, the element index is moved up
a slot so it cannot be confused with a constant offset. Existing code
only handles register index relative addressing for tessellation factors.
This patch adds generic support for it.
2023-05-24 22:00:29 +02:00
Francisco Casas
e060773c19 vkd3d-shader/hlsl: Extend the liveness of nodes produced outside loops.
Otherwise, it is possible that the register used by the temp is
overridden by a subsequent instruction within the same loop.
2023-05-24 22:00:21 +02:00
Francisco Casas
fbd2df2ad5 tests: Add minimal tests for temp lifetimes within a loop. 2023-05-24 22:00:19 +02:00
Ethan Lee
24d4ab7fb3 vkd3d-shader/hlsl: Add support for SampleGrad() method.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-23 21:07:49 +02:00
Ethan Lee
c3f10fe271 tests: Add a test for SampleGrad() method.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-23 21:07:47 +02:00
Nikolay Sivov
1af662ae50 tests: Add RWBuffer writing test.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:36 +02:00
Zebediah Figura
66dab357eb tests: Add support for UAV buffers in the d3d11 runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:36 +02:00
Nikolay Sivov
f470c00453 tests: Add support for UAV buffers to d3d12 runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:36 +02:00
Nikolay Sivov
74c0ad0a7a tests: Rename readback helper to be more generic.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:28 +02:00
Nikolay Sivov
a4ebde202a tests: Add support for UAV buffers in Vulkan runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:28 +02:00
Nikolay Sivov
cf8cacd336 vkd3d-shader/hlsl: Improve UAV format type checking for buffer types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-22 22:03:27 +02:00
Nikolay Sivov
dfa0076473 vkd3d-shader/hlsl: Add support for sample index argument in Load(). 2023-05-22 22:03:12 +02:00
Nikolay Sivov
dc41444941 vkd3d-shader/hlsl: Convert ternary operator true/false values to a common type. 2023-05-09 21:51:46 +02:00
Nikolay Sivov
a064009d3b tests: Simplify conditional test. 2023-05-09 21:51:46 +02:00
Zebediah Figura
6129399b4f tests: Add a test for SampleBias() with multiple mipmap levels. 2023-05-08 20:24:15 +02:00
Zebediah Figura
4ec60707e2 tests: Add a test for sampling from nonzero mipmap levels. 2023-05-08 20:24:15 +02:00
Zebediah Figura
e3eb4fc5eb tests: Add a test for loading from nonzero mipmap levels. 2023-05-08 20:24:15 +02:00
Zebediah Figura
c940486a89 tests/shader_runner: Add support for creating mipmapped textures. 2023-05-08 20:24:15 +02:00
Francisco Casas
ef7cf9b1ad vkd3d-shader/hlsl: Support resource arrays when writting SM4.
The new fixmes can be triggered in presence of object components within
structs (for SM5).

In shaders such as this one:

    struct apple
    {
        Texture2D tex : TEX;
        float4 color : COLOR;
    };

    float4 main(struct apple input) : sv_target
    {
        return input.tex.Load(int3(1, 2, 3));
    }

Or this one:

    struct
    {
        Texture2D tex;
        float4 color;
    } s;

    float4 main() : sv_target
    {
        return s.tex.Load(int3(1, 2, 3));
    }
2023-05-08 20:24:15 +02:00
Francisco Casas
3e9a9c5051 vkd3d-shader/hlsl: Track objects sampling dimension. 2023-05-08 20:24:15 +02:00
Francisco Casas
7c2ac5b098 tests: Test objects as parameters. 2023-05-08 20:24:14 +02:00
Francisco Casas
69ff249ef4 vkd3d-shader/hlsl: Support multiple-register variables in object regsets.
Variables that contain more than one object (arrays or structs) require
the allocation of contiguous registers in the respective object
register spaces.
2023-05-08 20:22:14 +02:00
Francisco Casas
9a8a440b9b tests: Add additional texture array register reservation tests. 2023-05-08 20:22:14 +02:00
Nikolay Sivov
7516adeeae vkd3d-shader/hlsl: Add support for fmod() intrinsic. 2023-05-08 20:21:52 +02:00
Conor McCarthy
7917a68241 tests/d3d12: Test register relative addressing in vertex and pixel shaders. 2023-05-03 21:12:09 +02:00
Nikolay Sivov
87037d3748 vkd3d-shader/hlsl: Implement asfloat().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-05-02 20:46:16 +02:00
Nikolay Sivov
3f90a0e671 tests: Fix a typo in asuint() test shader. 2023-05-02 20:46:16 +02:00
Nikolay Sivov
7d41cf4440 vkd3d-shader/hlsl: Partially implement static expressions evaluation. 2023-05-02 20:46:08 +02:00
Francisco Casas
abb207fab0 vkd3d-shader/hlsl: Always specify resource on intrinsic_tex().
Otherwise, in the added test, we get:

vkd3d-compiler: vkd3d-shader/hlsl.c:452: hlsl_init_deref_from_index_chain: Assertion `chain' failed.

because on the path that triggers the following error:

E5002: Wrong type for argument 1 of 'tex3D': expected 'sampler' or 'sampler3D', but got 'sampler2D'.

a NULL params.resource is passed to hlsl_new_resource_load() and
then to hlsl_init_deref_from_index_chain().
2023-05-01 22:18:46 +02:00
Ethan Lee
5d735f3b0e vkd3d-shader/hlsl: Add support for sign() intrinsic.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-01 22:18:41 +02:00
Ethan Lee
109f7094bc tests: Add tests for sign() intrinsic.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-05-01 22:18:41 +02:00
Zebediah Figura
6e677def71 vkd3d-shader/hlsl: Normalize bools when loading from uniforms or vertex input. 2023-05-01 22:18:36 +02:00
Zebediah Figura
3cce4e70e9 tests: Test bool semantics. 2023-05-01 22:18:33 +02:00
Zebediah Figura
8b4e70dfee tests: Test casting from a bool uniform. 2023-05-01 22:18:33 +02:00
Francisco Casas
537d7c27a2 vkd3d-shader/hlsl: Error out when a semantic is used with incompatible types.
Considering row vectors from row_major matrices as having a different
layout as regular vectors, and error out in that case, is left as todo.
2023-05-01 22:18:24 +02:00
Francisco Casas
d96e9665b1 vkd3d-shader/hlsl: Error out when an output semantic is used more than once.
The use of the hlsl_semantic.reported_duplicated_output_next_index field
allows reporting multiple overlapping indexes, such as in the following
vertex shader:

    void main(out float1x3 x : OVERLAP0, out float1x3 y : OVERLAP1)
    {
        x = float3(1.0, 2.0, 3.2);
        y = float3(5.0, 6.0, 5.0);
    }

    apple.hlsl:1:41: E5013: Output semantic "OVERLAP1" is used multiple times.
    apple.hlsl:1:13: First use of "OVERLAP1" is here.
    apple.hlsl:1:41: E5013: Output semantic "OVERLAP2" is used multiple times.
    apple.hlsl:1:13: First use of "OVERLAP2" is here.

While at the same time avoiding reporting overlaps more than once for
large arrays:

    struct apple
    {
        float2 p : sv_position;
    };

    void main(out apple aps[4])
    {
    }

    apple.hlsl:3:8: E5013: Output semantic "sv_position0" is used multiple times.
    apple.hlsl:3:8: First use of "sv_position0" is here.
2023-05-01 22:18:22 +02:00
Francisco Casas
edc72fdefc vkd3d-shader/hlsl: Support semantics for array types. 2023-05-01 22:18:21 +02:00
Francisco Casas
d5068fd3ff tests: Test duplicated semantics. 2023-05-01 22:18:19 +02:00
Francisco Casas
f1276f9fb9 tests: Test array types with semantics. 2023-05-01 22:18:19 +02:00
Francisco Casas
627678a632 tests: Map unindentified hrs on compilation. 2023-05-01 22:18:17 +02:00
Francisco Casas
9cc1c7fe9d tests: Allow invalid vertex shader tests. 2023-05-01 22:18:17 +02:00
Francisco Casas
877fd3f0b4 tests: Expect S_OK result on [vertex shader]. 2023-05-01 22:18:16 +02:00
Nikolay Sivov
7ba373946b vkd3d-shader/hlsl: Implement D3DCOLORtoUBYTE4() function. 2023-04-28 21:04:13 +02:00
Nikolay Sivov
4b3707aeb4 vkd3d-shader/hlsl: Partially implement trunc().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-28 21:04:11 +02:00
Ethan Lee
d3876e49bc tests: Add tests for ddx(), ddy() intrinsics.
Thanks to Giovanni for the second set of tests! Note that the
tolerance for the final pixel was set much higher than the others;
this test seems to be an issue for some devices (in my case, a 7900
XTX running RADV).

Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-28 21:03:43 +02:00
Nikolay Sivov
af4bb03795 vkd3d-shader/hlsl: Implement SampleBias() method.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:55 +02:00
Nikolay Sivov
4fe4784e8a tests: Add a simple test for "discard".
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:52 +02:00
Ethan Lee
e541e71532 tests: Remove rtv clears in Vulkan runner.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:52 +02:00
Nikolay Sivov
c74d148cbe tests: Remove rtv clears in d3d12 runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:52 +02:00
Nikolay Sivov
317b8aa039 vkd3d-shader/hlsl: Ignore "unroll" attribute for loops. 2023-04-21 20:55:48 +02:00
Zebediah Figura
e34bdcab3a tests/shader_runner: Remove a redundant vkd3d_test_pop_context().
We already popped the context here.

Move the break inside the previous if to make control flow a little clearer.
2023-04-20 22:54:23 +02:00
Ethan Lee
81cc077b53 tests: Add tests for any() intrinsic.
Currently only tests float and bool, scalar and vector.

Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-19 20:46:53 +02:00
Giovanni Mascellani
625155bd3c tests: Pop the shader runner context after processing the current section.
This way failures produced while compiling or preprocessing a shader
are shown with the appropriate context.
2023-04-19 20:46:53 +02:00
Conor McCarthy
db7359f36a tests: Test index buffer location zero in test_draw_indexed_instanced().
Only verify it doesn't crash.
2023-04-19 20:46:53 +02:00
Conor McCarthy
5244fa572f tests: Test null addresses in test_update_root_descriptors(). 2023-04-19 20:46:00 +02:00
Nikolay Sivov
827a359b45 vkd3d-shader/hlsl: Handle uppercase regset names in packoffset().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-19 20:45:50 +02:00
Nikolay Sivov
0cea4d352e vkd3d-shader/hlsl: Handle uppercase regset names in register(). 2023-04-19 20:45:48 +02:00
Conor McCarthy
6db9ed14dc vkd3d: Support 1D UAV. 2023-04-18 22:00:17 +02:00
Conor McCarthy
7d0aaea4f8 tests: Test 1D UAV clear. 2023-04-18 22:00:01 +02:00
Zebediah Figura
8ed7437708 vkd3d-shader/hlsl: Evaluate index before array.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
2023-04-13 23:05:43 +02:00
Francisco Casas
af1aa63ace vkd3d-shader/hlsl: Support column-major matrix indexing in the lhs. 2023-04-13 23:05:41 +02:00
Francisco Casas
dc2a34824d vkd3d-shader/hlsl: Always load from a synthetic copy in add_load_component(). 2023-04-13 23:05:39 +02:00
Francisco Casas
5c285adc6b vkd3d-shader/hlsl: Use hlsl_ir_index for array and record access.
From this point on, it is no longer true that only hlsl_ir_loads can
return objects, because an object can also come from chain of
hlsl_ir_indexes that ends in an hlsl_ir_load.

The lower_index_loads pass takes care of lowering all hlsl_ir_indexes
into hlsl_ir_loads.

For this reason, hlsl_resource_load_params now expects both the resource
as the sampler to be just an hlsl_ir_node pointer instead of a pointer
to a more specific hlsl_ir_load.
2023-04-13 23:05:32 +02:00
Francisco Casas
8cd3defe0d tests: Test indexing of non-loads. 2023-04-13 23:05:25 +02:00
Zebediah Figura
526b025c88 tests: Test side effects on indexes.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
2023-04-13 23:05:21 +02:00
Francisco Casas
1b1978f684 tests: Test matrix indexing on the lhs. 2023-04-13 23:05:21 +02:00
Francisco Casas
9dd99a084d tests: Test multiple calls to the same function in initializers. 2023-04-13 23:05:21 +02:00
Francisco Casas
0ceecd1225 vkd3d-shader/hlsl: Fix numeric offset of object fields. 2023-04-13 23:05:07 +02:00
Francisco Casas
86893bc7f4 tests: Test numeric offsets with object fields. 2023-04-13 23:05:07 +02:00
Nikolay Sivov
e4503ad80f tests: Add a test for SV_IsFrontFace.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-13 23:05:00 +02:00
Nikolay Sivov
a496e3a8ba tests: Disable culling in shader runners.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-13 23:05:00 +02:00
Nikolay Sivov
a1bd4e080e vkd3d-shader/hlsl: Support log() intrinsic.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-13 23:04:44 +02:00
Nikolay Sivov
210caa931d vkd3d-shader/hlsl: Support log10() intrinsic.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-13 23:04:42 +02:00
Nikolay Sivov
49b63fbeba vkd3d-shader/hlsl: Support log2() intrinsic. 2023-04-13 23:04:40 +02:00
Zebediah Figura
94ff9ba5e7 tests: Add a test for readback map stability.
Resident Evil 2 accesses a resource immediately after unmapping it.
2023-04-10 21:00:26 +02:00
Nikolay Sivov
24c1eb562f vkd3d-shader/hlsl: Treat half as float for casts.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-06 17:51:55 +02:00
Nikolay Sivov
c190c184ce vkd3d-shader/hlsl: Add support for ternary operator. 2023-04-06 17:51:46 +02:00
Henri Verbeet
a0a3fb0e5f tests/shader_runner: Return from run_shader_tests_d3d12() if we're unable to create a test context.
A test environment may legitimately be unable to support running d3d12 tests.
2023-04-04 22:01:15 +02:00
Zebediah Figura
dfa4bfdd03 include: Make test context information nestable.
Based on Wine.
2023-04-04 21:59:58 +02:00
Francisco Casas
f3e81327dc vkd3d-shader/hlsl: Consider register() as manual packing for resource fields. 2023-04-04 21:59:49 +02:00
Francisco Casas
70ff7aaddd tests: Test packoffset() with resources inside cbuffers. 2023-04-04 21:59:49 +02:00
Francisco Casas
60237cb773 vkd3d-shader/hlsl: Don't allow manual and automatic cbuffer offset packing. 2023-04-04 21:59:45 +02:00
Francisco Casas
4448d114ad vkd3d-shader/hlsl: Detect overlaps in cbuffer offsets. 2023-04-04 21:59:43 +02:00
Francisco Casas
7777c32cac vkd3d-shader/hlsl: Support packoffset(). 2023-04-04 21:59:42 +02:00
Francisco Casas
4aca335f42 vkd3d-shader/hlsl: Parse packoffset(). 2023-04-04 21:59:40 +02:00
Francisco Casas
496f9b42cb tests: Test packoffset(). 2023-04-04 21:59:39 +02:00
Francisco Casas
cf59ad9c9f tests: Test cbuffer element offsets. 2023-04-04 21:59:37 +02:00
Zebediah Figura
8186b75228 tests: Use a pixel shader that consumes SV_Position in test_query_pipeline_statistics().
Some drivers (AMD Radeon RX 6700 XT, with radeonsi from Mesa 22.2.0-rc3) emit
less than one invocation per pixel, presumably because they detect that the
shader control flow is uniform for all pixels. Having the control flow depend on
SV_Position avoids this test failure.

Cf. 34bd0dd0704c613abef8a9aa3ba2a2507ed02843 in wine.
2023-04-03 18:00:37 +02:00
Giovanni Mascellani
9a27df3a8c tests: Read integer uniforms with strtol() and strtoul().
Because %i sscanf() converters are deprecated, and in practice
clamp to [-2^31, 2^31) on 32 bit.
2023-04-03 18:00:14 +02:00
Conor McCarthy
c87a292f98 tests: Release and then use a heap which contains resources.
The expected use case where a heap is freed before its contained
resources is not reasonably testable, so the ability to place a new
resource is tested instead.
2023-04-03 17:59:43 +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
Zebediah Figura
9ea84ae8c9 tests/shader_runner: Use the global test_options structure.
Inspired by a patch by Giovanni Mascellani.
2023-03-10 21:13:05 +01:00
Giovanni Mascellani
c8a05a8b10 tests: Collect D3D12 test options in a dedicated structure. 2023-03-10 21:12:46 +01:00
Giovanni Mascellani
8d7159b4be tests: Initialize shader_runner fields after having zeroed the struct. 2023-03-10 21:12:44 +01:00
Nikolay Sivov
a18f3d4dd5 vkd3d-shader/hlsl: Support distance() intrinsic. 2023-03-08 20:14:22 +01:00
Nikolay Sivov
d6b656641c vkd3d-shader/hlsl: Support rsqrt() intrinsic. 2023-03-08 20:14:20 +01:00
Zebediah Figura
5838364886 vkd3d-shader/hlsl: Apply latent majority modifiers to typedefs as well. 2023-02-28 22:07:00 +01:00
Zebediah Figura
b3c620954b vkd3d-shader/hlsl: Apply latent type modifiers to matrix array typedefs. 2023-02-28 22:06:56 +01:00
Zebediah Figura
2a412670ee tests: Add more tests for pack_matrix pragmas. 2023-02-28 22:06:54 +01:00
Henri Verbeet
b1e13d6e33 vkd3d-shader/dxbc: Introduce API for serialising DXBC blobs. 2023-02-23 21:47:27 +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
891217664a vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'dword' type. 2023-02-23 21:46:38 +01:00
Francisco Casas
75359e6dbd vkd3d-shader/hlsl: Respect object reservations even if the object is unused. 2023-02-22 18:28:19 +01:00
Francisco Casas
7a7116eaab tests: Test allocation of unused objects. 2023-02-22 18:28:19 +01:00
Nikolay Sivov
d86db8bcbe vkd3d-shader/hlsl: Support lit() intrinsic. 2023-02-21 21:09:52 +01:00
Francisco Casas
f08c0a7c03 vkd3d-shader/hlsl: Find compatible function overloads.
But still throw hlsl_fixme() when there is more than one.
Prioritizing among multiple compatible function overloads in the same way
as the native compiler would require systematic testing.
2023-02-20 21:59:53 +01:00
Francisco Casas
d279d34801 vkd3d-shader/hlsl: Parse array types in function parameters. 2023-02-20 21:59:51 +01:00
Francisco Casas
9df54851c9 tests: Test array parameters on functions. 2023-02-20 21:59:51 +01:00
Francisco Casas
1b951c87f6 tests: Add more tests for broadcasts in function call args. 2023-02-20 21:59:51 +01:00
Zebediah Figura
af65287423 vkd3d-shader/hlsl: Check for majority modifiers on non-matrices in apply_type_modifiers(). 2023-02-20 21:59:42 +01:00
Zebediah Figura
1ee7a4e82a tests: Add more tests for majority modifier syntax. 2023-02-20 21:59:42 +01:00
Zebediah Figura
1c29b45c1f tests: Test macro expansion in pack_matrix pragmas. 2023-02-20 21:59:42 +01:00