Commit Graph

1305 Commits

Author SHA1 Message Date
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
Nikolay Sivov
e5b40092c2 vkd3d-shader/hlsl: Support all() intrinsic. 2023-02-20 21:59:37 +01:00
Nikolay Sivov
e7bc634307 vkd3d-shader/hlsl: Support reflect() intrinsic.
Tests authored by Giovanni.
2023-02-20 21:59:23 +01:00
Giovanni Mascellani
7c3dadce6b vkd3d-shader/hlsl: Write SM4 break instructions. 2023-02-15 21:53:21 +01:00
Nikolay Sivov
99acf5038e vkd3d-shader/hlsl: Use mul only for two scalars for dot(). 2023-02-15 21:53:15 +01:00
Zebediah Figura
0e60f4cc69 vkd3d-shader/hlsl: Always set ctx->cur_function in the func_prototype_no_attrs rule.
Fixes: 4c46075d86
2023-02-14 21:52:59 +01:00
Zebediah Figura
cd6e8b5540 vkd3d-shader/hlsl: Allow empty parameter lists to be specified as "(void)". 2023-02-14 21:52:57 +01:00
Zebediah Figura
58445da64b vkd3d-shader/hlsl: Allow the final expression in a for loop initializer to be omitted. 2023-02-13 22:16:56 +01:00
Zebediah Figura
4b944517b7 vkd3d-shader/hlsl: Inline function calls. 2023-02-13 22:16:53 +01:00
Zebediah Figura
6177cea31f vkd3d-shader/hlsl: Emit a hlsl_fixme() for unhandled instruction types when writing bytecode.
This was originally left alone in order to allow functions without early return
to succeed, since in that case we would already emit the correct bytecode
despite not handling the HLSL_IR_JUMP_RETURN instruction.

Now that we lower return statements, however, any unhandled instructions are
either definitely going to result in invalid bytecode, or rare enough that it's
not worth returning success anyway.
2023-02-13 22:16:52 +01:00
Zebediah Figura
8bdee6681b vkd3d-shader/hlsl: Lower return statements. 2023-02-13 22:16:51 +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
09c5ed27fe tests: Avoid performing a multi-component UAV load in uav-out-param.shader_test.
It requires caps beyond shader model 5.0.
2023-02-13 22:16:46 +01:00
Zebediah Figura
77d716c811 vkd3d-shader/hlsl: Add functions to the global list inside the func_prototype rule. 2023-02-07 22:15:06 +01:00
Zebediah Figura
721c7aa22c tests: Add more tests for function definitions. 2023-02-07 22:15:06 +01:00
Zebediah Figura
68c232cfab tests: Test entry point semantics on function declarations. 2023-01-31 22:27:02 +01:00
Zebediah Figura
4954c36347 tests: Add more tests for early return from the entry point. 2023-01-31 22:27:02 +01:00
Zebediah Figura
7460d7adc2 tests: Add some tests for early return from user-defined functions. 2023-01-31 22:27:02 +01:00
Zebediah Figura
aa3badbd9d vkd3d-shader/hlsl: Emit a hlsl_fixme() for HLSL_IR_CALL instructions.
Avoid outputting invalid shaders.
2023-01-31 22:27:00 +01:00
Nikolay Sivov
ec00782eae vkd3d-shader/tests: Add some exp()/exp2() tests.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-01-26 21:52:29 +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
edf86b2248 tests: Add tests for assignments to self with swizzles. 2023-01-26 21:52:18 +01:00
Francisco Casas
9d7ef64dc0 tests: Test swizzles on scalar values. 2023-01-26 21:52:18 +01:00
Francisco Casas
524029a062 tests: Test using single-component swizzles as indexes.
Vectors cannot be used as array indexes, however, single-component
swizzles (such as vec.x) can be used.

This suggests that single-component swizzles should actually be
scalars and not vectors of dimx = 1.

It is worth noting that the use of single-component swizzles on scalars
should still be allowed.
2023-01-26 21:52:16 +01:00
Francisco Casas
dd2168754d tests: Combine all the swizzle tests in a single file. 2023-01-26 21:52:16 +01:00
Giovanni Mascellani
d2f8a576a8 vkd3d-shader/hlsl: Avoid infinite loop and invalid derefs in copy-prop.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
Co-authored-by: Zebediah Figura <zfigura@codeweavers.com>

Because copy_propagation_transform_object_load() replaces a deref
instead of an instruction, it is currently prone to two problems:

1- It can replace a deref with the same deref, returning true every
time and getting the compilation stuck in an endless loop of
copy-propagation iterations.

2- When performed multiple times in the same deref, the second time it
can replace the deref with a deref from a temp that is only valid in
another point of the program execution, resulting in an incorrect value.

This patch preempts this by avoiding replacing derefs when the new deref
doesn't point to a uniform variable. Because, uniform variables cannot
be written to.
2023-01-26 21:52:07 +01:00
Francisco Casas
17888f6493 tests: Test correct copy-prop object replacement. 2023-01-26 21:52:05 +01:00
Zebediah Figura
653cc02f4c vkd3d-shader/hlsl: Write SM4 thread ID registers. 2023-01-25 22:47:46 +01:00
Zebediah Figura
809a43f06b tests: Add a test for compute thread IDs. 2023-01-25 22:10:30 +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
Francisco Casas
4ce6a17053 tests: Test minimum-precision numeric types. 2023-01-25 22:10:23 +01:00
Nikolay Sivov
3e6fccdbf9 vkd3d-shader/hlsl: Support frac() intrinsic.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34242
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-01-25 22:10:05 +01:00
Francisco Casas
6b82ba9488 vkd3d-shader/hlsl: Fold swizzle chains. 2023-01-24 18:10:53 +01:00
Zebediah Figura
b7d34e8307 vkd3d-shader/hlsl: Apply copy propagation to swizzled loads. 2023-01-24 18:10:50 +01:00
Francisco Casas
c2a7a40d3a vkd3d-shader/hlsl: Replace loads with constants in copy prop.
If a hlsl_ir_load loads a variable whose components are stored from different
instructions, copy propagation doesn't replace it.

But if all these instructions are constants (which currently is the case
for value constructors), the load could be replaced with a constant value.
Which is expected in some other instructions, e.g. texel_offsets when
using aoffimmi modifiers.

For instance, this shader:

```
sampler s;
Texture2D t;

float4 main() : sv_target
{
    return t.Gather(s, float2(0.6, 0.6), int2(0, 0));
}
```

results in the following IR before applying the patch:
```
  float | 6.00000024e-01
  float | 6.00000024e-01
   uint | 0
        | = (<constructor-2>[@4].x @2)
   uint | 1
        | = (<constructor-2>[@6].x @3)
 float2 | <constructor-2>
    int | 0
    int | 0
   uint | 0
        | = (<constructor-5>[@11].x @9)
   uint | 1
        | = (<constructor-5>[@13].x @10)
   int2 | <constructor-5>
 float4 | gather_red(resource = t, sampler = s, coords = @8, offset = @15)
        | return
        | = (<output-sv_target0> @16)
```

and this IR afterwards:
```
 float2 | {6.00000024e-01 6.00000024e-01 }
   int2 | {0 0 }
 float4 | gather_red(resource = t, sampler = s, coords = @2, offset = @3)
        | return
        | = (<output-sv_target0> @4)
```
2023-01-24 18:10:45 +01:00
Francisco Casas
337b4c5db0 tests: Test constant propagation through swizzles.
The Load() method offsets are used for these tests since these must
solve to constants in order to pass.
2023-01-24 18:10:38 +01:00
Francisco Casas
cf17882189 vkd3d-shader/hlsl: Support offset argument for the texture Load() method. 2023-01-24 18:10:36 +01:00
Francisco Casas
7a7b17d0e1 tests: Test offset argument for the texture Load() method. 2023-01-24 18:10:36 +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
Francisco Casas
13c8e8b856 vkd3d-shader/hlsl: Parse step() intrinsic. 2023-01-19 19:16:17 +01:00
Francisco Casas
4e1a4a76d9 tests: Test step() intrinsic. 2023-01-19 19:16:17 +01:00
Francisco Casas
6fbf2b3e75 vkd3d-shader/hlsl: Parse sqrt() intrinsic. 2023-01-19 19:16:16 +01:00
Francisco Casas
7dbc879e2d tests: Test sqrt() intrinsic. 2023-01-19 19:16:16 +01:00
Francisco Casas
8d5f16d803 vkd3d-shader/hlsl: Support cos() intrinsic. 2023-01-19 19:16:15 +01:00
Francisco Casas
3239ea5ff1 vkd3d-shader/hlsl: Support sin() intrinsic. 2023-01-19 19:16:14 +01:00
Francisco Casas
b65c450101 vkd3d-shader/hlsl: Add additional tests for sin() and cos(). 2023-01-19 19:16:13 +01:00
Francisco Casas
aab9886021 vkd3d-shader/hlsl: Allow uninitialized static objects.
validate_static_object_references() validates that uninitialized static
objects are not referenced in the shader.

In case a static variable contains both numeric and object types, the
"Static variables cannot have both numeric and resource components."
error should preempt uninitialized numeric values to reach further
compilation steps.
2023-01-19 12:29:41 +01:00
Francisco Casas
17d6a4411e vkd3d-shader/hlsl: Validate that non-uniform objects are not referenced.
Note that in the future we should call
validate_static_object_references() after DCE and pruning branches,
because shaders such as these compile (at least in more modern versions
of the native compiler):

Branch pruning:
```
static RWTexture2D<float> tex;

float4 main() : sv_target
{
    if (0)
    {
        tex[int2(0, 0)] = 2;
    }
    return 0;
}
```

DCE:
```
static Texture2D tex;
uniform uint i;

float4 main() : sv_target
{
    float4 unused = tex.Load(int3(0, 1, 2));

    return 0;
}
```

These are "todo" tests in hlsl-static-initializer.shader_test
that depend on this.
2023-01-19 12:29:39 +01:00
Francisco Casas
97c9669544 tests: Add additional object references tests. 2023-01-19 12:29:39 +01:00
Giovanni Mascellani
207643b8e8 tests: Test proper initialization of static structs to zero. 2023-01-19 12:29:39 +01:00
Francisco Casas
5cfc8d378f vkd3d-shader/hlsl: Initialize static variables to 0 by default.
We are currently not initializing static values to zero by default.

Consider the following shader:
```hlsl
static float4 va;

float4 main() : sv_target
{
  return va;
}
```
we get the following output:
```
ps_5_0
dcl_output o0.xyzw
dcl_temps 2
mov r0.xyzw, r1.xyzw
mov o0.xyzw, r0.xyzw
ret
```
where r1.xyzw is not initialized.

This patch solves this by assigning the static variable the value of an
uint 0, and thus, relying on complex broadcasts.

This seems to be the behaviour of the 9.29.952.3111 version of the native
compiler, since it retrieves the following error on a shader that lacks
an initializer on a data type with object components:

```
error X3017: cannot convert from 'uint' to 'struct <unnamed>'
```
2023-01-19 12:29:36 +01:00
Zebediah Figura
9cc7aaf5a1 vkd3d-shader/hlsl: Forbid returning void expressions from void functions. 2023-01-13 17:32:43 +01:00
Zebediah Figura
b29d3489de vkd3d-shader/hlsl: Generate IR for user-defined function calls. 2023-01-13 17:32:42 +01:00
Zebediah Figura
22a1a478ea tests: Test specifying a UAV address as an in/out parameter to a function. 2023-01-13 17:32:39 +01:00
Francisco Casas
5b1030e0cb vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in intrinsic_pow().
Using add_unary_arithmetic_expr() instead of hlsl_new_unary_expr()
allows the intrinsic to work with matrices.

Otherwise we get:

E5017: Aborting due to not yet implemented feature: Copying from unsupported node type.

because an HLSL_IR_EXPR reaches split_matrix_copies().
2023-01-11 16:02:59 +01:00
Francisco Casas
9ceed76a9c vkd3d-shader/hlsl: Convert elementwise intrinsics args to the proper common type. 2023-01-11 16:02:56 +01:00
Francisco Casas
86c35fc79d tests: Test for common type conversion for element-wise intrinsics.
Some intrinsics have different rules for the allowed data types than
expressions:

- Vectors and matrices at the same time are not allowed, regardless of
  their dimensions. Even if they have the same number of components.

- Any combination of matrices is always allowed, even those when no
  matrix fits inside another, e.g.:
  float2x3 is compatible with float3x2, resulting in float 2x2.
  The common data type is the min on each dimension.

This is the case for max, pow, ldexp, clamp and smoothstep; which suggest that
it is the case for all intrinsics where the operation is applied element-wise.

Tests for mul() are also added as a counter-example where the operation
is not element-wise.
2023-01-11 16:02:53 +01:00
Francisco Casas
a7bb5a0835 vkd3d-shader/hlsl: Support smoothstep() intrinsic. 2023-01-11 16:02:52 +01:00
Francisco Casas
09e7218539 vkd3d-shader/hlsl: Support transpose() intrinsic. 2023-01-11 16:02:50 +01:00
Conor McCarthy
fc652d2b27 tests: Test a typed UAV buffer in test_atomic_instructions().
Until vkd3d-shader is patched, an atomic op on a typed buffer where
StorageImageReadWithoutFormat is available will cause SPIR-V validation
failure, and assertion in Mesa debug builds, because the image will be
declared with Unknown format.
2022-11-21 18:28:42 +01:00
Francisco Casas
bd501ce336 vkd3d-shader/hlsl: Don't produce a parse error on empty buffer_body. 2022-11-18 22:29:06 +01:00
Francisco Casas
f100f5b726 vkd3d-shader/hlsl: Check for non-static object references on resource stores. 2022-11-18 22:29:04 +01:00
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