Commit Graph

3869 Commits

Author SHA1 Message Date
Nikolay Sivov
69f32796b0 vkd3d-shader: Unify static string arrays initialization pattern. 2023-06-28 21:40:21 +02:00
Zebediah Figura
9ccba35dde vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers. 2023-06-28 21:40:18 +02:00
Zebediah Figura
8fa1750206 vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer. 2023-06-28 21:40:16 +02:00
Zebediah Figura
7d521db3db vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement". 2023-06-28 21:40:15 +02:00
Zebediah Figura
588784e4dc vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule. 2023-06-28 21:40:14 +02:00
Zebediah Figura
b4bf5af475 vkd3d-shader/hlsl: Factor out add_binary_expr_merge(). 2023-06-28 21:40:12 +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
Giovanni Mascellani
bdfec4886d vkd3d-shader/hlsl: Fold logical expressions. 2023-06-27 22:34:33 +02:00
Giovanni Mascellani
5a05fabe62 vkd3d-shader/hlsl: Fold floating point minimum expressions. 2023-06-27 22:34:30 +02:00
Giovanni Mascellani
2a2943c2cf vkd3d-shader/hlsl: Fold floating point maximum expressions. 2023-06-27 22:34:29 +02:00
Giovanni Mascellani
358d656262 vkd3d-shader/hlsl: Fold greater-than-or-equal comparisons. 2023-06-27 22:34:28 +02:00
Giovanni Mascellani
bf452b5907 vkd3d-shader/hlsl: Fold less-than comparisons. 2023-06-27 22:34:27 +02:00
Giovanni Mascellani
488af14144 vkd3d-shader/hlsl: Fold equality comparisons. 2023-06-27 22:34:25 +02:00
Giovanni Mascellani
6c9f6d0fcf vkd3d-shader/hlsl: Sort constant folding helpers alphabetically. 2023-06-27 22:34:24 +02:00
Nikolay Sivov
4ed60cda13 vkd3d-shader: Remove extra newlines from compiler messages. 2023-06-27 22:34:19 +02:00
Conor McCarthy
c4a8e06abf configure: Pass the correct number of parameters for the __atomic_exchange_n() check. 2023-06-27 22:34:10 +02:00
Nikolay Sivov
9ccf291971 vkd3d-shader/hlsl: Use profile version testing helpers in more places. 2023-06-27 22:34:05 +02:00
Nikolay Sivov
5c02e12187 vkd3d-shader/hlsl: Make sample count optional for SM4.1+.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:34:03 +02:00
Conor McCarthy
3aa83e877d vkd3d: Append CopyTileMappings() commands to the command queue op array. 2023-06-27 22:33:58 +02:00
Conor McCarthy
3935e8647f vkd3d: Append UpdateTileMappings() commands to the command queue op array. 2023-06-27 22:33:58 +02:00
Conor McCarthy
e98e6c9b53 vkd3d: Add missing const attributes to ID3D12CommandQueue::UpdateTileMappings() parameters. 2023-06-27 22:33:58 +02:00
Conor McCarthy
5ccadd07f1 vkd3d: Validate plane count for tiled textures. 2023-06-27 22:33:58 +02:00
Conor McCarthy
0b67481496 vkd3d: Validate tiled resources tier for 3D textures. 2023-06-27 22:33:58 +02:00
Conor McCarthy
1a0d85b8d6 vkd3d: Validate tiled resources support during reserved resource creation.
Check directly for Vulkan support because the D3D12 tiled resources
tier may in future be modified by a config option.
2023-06-27 22:33:57 +02:00
Conor McCarthy
e93f2e7746 vkd3d: Always pass null heap properties to vkd3d_create_image() for sparse images. 2023-06-27 22:33:57 +02:00
Conor McCarthy
9532ac5f84 vkd3d: Check sparse image format is supported.
Based on code by Jan Sikorski.
2023-06-27 22:33:55 +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
8d84e206ab vkd3d-shader/hlsl: Parse clip() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-06-27 22:33:48 +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
Nikolay Sivov
b40179da3a vkd3d-shader/hlsl: Add a parameter for jump nodes and use it for 'discard'. 2023-06-27 22:33:47 +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
Zebediah Figura
7b9eb8d189 vkd3d-shader: Introduce documented semantics for the target type and other data passed to vkd3d_shader_scan().
Passing VKD3D_SHADER_TARGET_NONE was actually already allowed.
2023-06-27 22:33:39 +02:00
Stefan Dösinger
5e88ab22aa vkd3d-shader/hlsl: Make sure variants is initialized in declare_predefined_types().
MSVC is too stupid to see it is unused when n_variants=0.
2023-06-27 22:33:31 +02:00
Henri Verbeet
771e442af1 Release 1.8. 2023-06-22 22:00:20 +02:00
Henri Verbeet
e17ee34b92 build: List tests/object-parameters.shader_test before tests/object-references.shader_test. 2023-06-22 22:00:20 +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
Zebediah Figura
1c1f1094a5 vkd3d-shader/hlsl: Handle reserved vars specially in get_allocated_object(). 2023-06-22 22:00:16 +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
Francisco Casas
c1ca0dafe8 vkd3d-shader/d3dbc: Avoid hlsl_type_get_regset() in d3dbc.c.
In SM1 we can expect all variables to always belong to a single regset.
structs in particular, should always be allocated to HLSL_REGSET_NUM,
since they are only allowed if all their components are numeric.

We are not covering the structs case because of the use of
hlsl_type_get_regset(), which is currently not defined for structs.

So the current shader

    struct
    {
        float4 a;
        float4 b;
    } apple;

    float4 main() : sv_target
    {
        return apple.a + apple.b;
    }

fails with

    vkd3d/libs/vkd3d-shader/hlsl.c:224: Aborting, reached unreachable code.

The solution is to iterate over all regsets to find the one where the
variable is allocated (if any), and ignore all others.
2023-06-22 22:00:14 +02:00
Conor McCarthy
bce2a898b3 vkd3d-shader/spirv: Take ownership of the shader signatures in spirv_compiler_create().
Fixes leakage of the replacement elements in shader_signature_merge().
2023-06-19 22:44:07 +02:00
Zebediah Figura
df0a031ad8 vkd3d-shader/spirv: Retrieve input sysvals from the signature for geometry shaders as well.
This only affects clip and cull distances. The HLSL compiler emits these using
dcl_input, but the previous shader (vertex or TES) will write them as a SPIRV
builtin, and hence we want to read this as a SPIRV builtin as well.

This fixes validation errors in Wine's test_clip_distance().
2023-06-12 22:50:19 +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
Nikolay Sivov
99314b6340 vkd3d-shader/hlsl: Store static initialization instructions in a block. 2023-06-12 22:50:11 +02:00
Francisco Casas
5dee6561c2 vkd3d-shader/hlsl: Fold redundant casts again after lower narrowing casts.
lower_narrowing_casts() currently creates a new cast calling
hlsl_new_cast(). This cast may be redundant, but it is not folded, which
is making SM1 emit an unnecessary fixme in some shaders:

    Aborting due to not yet implemented feature: SM1 "cast" expression.

Other passes that call hlsl_new_cast() are lower_int_division() and
lower_int_modulus(), so the new fold_redundant_casts() pass is called
after these as well.
2023-06-08 23:21:40 +02:00
Zebediah Figura
f34b107faf vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_constant(). 2023-06-08 18:50:35 +02:00
Zebediah Figura
740b0ad807 vkd3d-shader/hlsl: Pass a hlsl_constant_value pointer to hlsl_new_constant(). 2023-06-08 18:50:34 +02:00