Commit Graph

90 Commits

Author SHA1 Message Date
Francisco Casas
22c47e57f5 tests/shader-runner: Introduce "if" qualifier.
When the "if" qualifier is added to a directive, the directive is
skipped if the shader->minimum_shader_model is not included in the
range.

This can be used on the "probe" directives for tests that have different
expected results on different shader models, without having to resort to
[require] blocks.
2024-02-13 22:51:22 +01:00
Francisco Casas
0f9f5269e9 tests/vkd3d-shader: Set uninitialized uniforms to a value.
Avoids a potential source of non-determinism because the padding bytes
between uniforms could be left uninitialized.
2024-02-13 22:51:19 +01:00
Evan Tang
13ac795061 tests/shader-runner: Support testing for integer pixel data.
Modified by Conor McCarthy to use read_uint() and read_uint4().
2024-02-01 22:24:54 +01:00
Francisco Casas
d7ffdd7340 tests/shader_runner: Free runner->cs_source and runner->fx_source (valgrind). 2024-01-25 22:24:34 +01:00
Francisco Casas
70e1924e6e tests/shader_runner: Free runner->input_elements in parse_test_directive() (valgrind). 2024-01-25 22:24:33 +01:00
Francisco Casas
48e61fa323 tests/shader_runner: Free runner->uniforms (valgrind). 2024-01-25 22:24:31 +01:00
Francisco Casas
969350a280 tests/shader_runner: Free params.data on test directives (valgrind). 2024-01-25 22:24:30 +01:00
Francisco Casas
1c73513425 tests: Use the vulkan runner to run SM1 compilation tests.
At the current moment this is a little odd because for SM1 [test]
directives are skipped, and the [shader] directives are not executed by
the shader_runner_vulkan.c:compile_shader() but by the general
shader_runner.c:compile_shader(). So in principle it is a little weird
that we go through the vulkan runner.

But fret not, because in the future we plan to make the parser agnostic
to the language of the tests, so we will get rid of the general
shader_runner.c:compile_shader() function and instead call a
runner->compile_shader() function, defined for each runner. Granted,
most of these may call a generic implementation that uses native
compiler in Windows, and vkd3d-shader on Linux, but it would be more
conceptually correct.
2024-01-24 22:37:44 +01:00
Francisco Casas
671f4ec2b2 tests/shader-runner: Call each runner only once.
If the runners require multiple calls to run_shader_tests() for
different shader model ranges, these are moved inside the sole runner
call.

For the same reason, the trace() messages are also moved inside the
runner calls.
2024-01-24 22:37:34 +01:00
Francisco Casas
79de3ec766 tests/shader-runner: Support reading multiple model range args for qualifiers.
We can now pass (sm<4) and (sm>=4) to "fail" and "todo" qualifiers, and
we can use multiple of these qualifier arguments using "&" for AND and
"|" for OR.

examples:
todo(sm>=4 & sm<6)
todo(sm<4 | sm>6)

parenthesis are not supported.

Adding additional model ranges for the tests, if we need them, should be
easier now, since they only have to be added to the "valid_args" array.
2024-01-24 22:37:30 +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
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
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
Zebediah Figura
d1ce069ea6 tests/shader_runner: Remove an unnecessary local variable declaration.
Found with -Wshadow.
2023-11-28 00:09:51 +01:00
Henri Verbeet
beb3f6e0c2 tests: Introduce an OpenGL shader runner. 2023-11-22 22:08:11 +01:00
Conor McCarthy
130e7bdf0f tests/shader-runner: Add tests for 64-bit casts. 2023-11-15 21:48:33 +01:00
Nikolay Sivov
41a72a4eae tests: Fix some spelling mistakes. 2023-11-13 23:19:14 +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
Giovanni Mascellani
0dc40d7c1e tests: Skip processing resources according to [require] directives. 2023-10-18 20:58:19 +02:00
Henri Verbeet
803e5183cc tests: Specify argument types for dxcompiler_create(). 2023-10-17 22:18:36 +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
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
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
Francisco Casas
ab37b27a7d tests: Pass D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY when compiling with the shader-runner. 2023-07-17 22:55:43 +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
Zebediah Figura
4ec60707e2 tests: Add a test for sampling 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
Zebediah Figura
3cce4e70e9 tests: Test bool semantics. 2023-05-01 22:18:33 +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
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
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
Zebediah Figura
dfa4bfdd03 include: Make test context information nestable.
Based on Wine.
2023-04-04 21:59:58 +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
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
8d7159b4be tests: Initialize shader_runner fields after having zeroed the struct. 2023-03-10 21:12:44 +01:00
Giovanni Mascellani
1717dc0516 tests: Print DLL versions when running tests on Windows. 2023-01-24 18:10:22 +01:00
Giovanni Mascellani
2445743002 tests: Run d3d9 and d3d12 tests on non-cross builds too.
On cross builds, shaders are compiled with d3dcompiler_47.dll and
run with d3dN.dll. On non-cross builds, shaders are compiled with
vkd3d-shader and run with d3dN.dll (on Windows) or Vulkan and vkd3d
(on Linux).
2023-01-24 18:10:17 +01:00
Giovanni Mascellani
44d9e2d728 tests: Distinguish between cross and non-cross Win32 builds.
Now the tests compile correctly on non-cross Win32 builds.
2023-01-24 18:10:15 +01:00
Zebediah Figura
9c817e5e6d vkd3d-shader/hlsl: Forbid recursive calls. 2023-01-19 19:16:27 +01:00
Zebediah Figura
503be4243c tests/shader_runner: Explicitly track the expected shader compilation HRESULT instead of using a boolean flag. 2023-01-19 19:16:26 +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
75494a4ae6 tests: Add a basic shader test for compute shaders. 2022-10-19 21:59:29 +02:00