Commit Graph

4069 Commits

Author SHA1 Message Date
Conor McCarthy
e54f770669 vkd3d-shader/dxil: Implement the DXIL CALL instruction. 2023-08-30 22:48:48 +02:00
Conor McCarthy
720a087c28 vkd3d-shader/dxil: Replace the result type enum with a bool.
Changes to failure handling make the enum unnecessary.
2023-08-30 22:48:47 +02:00
Conor McCarthy
58d6e44501 vkd3d-shader/dxil: Validate the function block count. 2023-08-30 22:48:45 +02:00
Conor McCarthy
61a550017f vkd3d-shader/spirv: Handle signature element mask left shift in spirv_compiler_emit_output().
Element masks can have a left shift in DXIL, but these must start at
bit 0 in the register info. The SPIR-V declaration will either be a
builtin or have SpvDecorationComponent.
2023-08-30 22:48:43 +02:00
Conor McCarthy
ebc461f795 vkd3d-shader/spirv: Handle signature element mask left shift in calculate_clip_or_cull_distance_mask().
In DXIL these masks can have a left shift.
2023-08-30 22:48:41 +02:00
Giovanni Mascellani
4a3ad750e0 ci: Introduce a CI pipeline for GitLab. 2023-08-29 22:07:56 +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
Zebediah Figura
9624e2f904 vkd3d-shader/spirv: Declare SRVs and UAVs from the descriptor info. 2023-08-28 20:40:02 +02:00
Zebediah Figura
e8b3561252 vkd3d-shader/spirv: Declare constant buffers from the descriptor info. 2023-08-28 20:40:01 +02:00
Zebediah Figura
547768bcdd vkd3d-shader/spirv: Declare samplers from the descriptor info. 2023-08-28 20:39:59 +02:00
Zebediah Figura
a1e10e5c90 vkd3d-shader/spirv: Split spirv_compiler_has_combined_sampler() into two functions.
These functions do not really share any code in common.
2023-08-28 20:39:57 +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
Conor McCarthy
61841e9423 vkd3d-shader/tpf: Handle the swizzle type bitfield in dst param tokens. 2023-08-28 20:39:49 +02:00
Conor McCarthy
eddae47062 vkd3d-shader/tpf: Handle the dimension bitfield in dst param tokens.
A zero mask is still emitted for some scalar registers. This has no
effect on current tests, but keeping the correction is probably a good
idea.
2023-08-28 20:39:48 +02:00
Conor McCarthy
92021b7a3c vkd3d-shader/tpf: Use the default vec4 swizzle if a src param contains a mask. 2023-08-28 20:39:46 +02:00
Conor McCarthy
7e5d9e3b6f vkd3d-shader/tpf: Handle the dimension bitfield in src param tokens. 2023-08-28 20:39:45 +02:00
Conor McCarthy
5c706152fa vkd3d-shader/tpf: Validate the src register of case conditions.
Case values are constants in TPF.
2023-08-28 20:39:43 +02:00
Conor McCarthy
5c09752194 vkd3d: Do not flush descriptor heaps stored in the command list when the array size is exceeded.
An earlier patch introduced a bug which overflows the descriptor heap
array. The array should not be emptied here in case the list is
resubmitted, so just flush the new heap.
2023-08-24 21:44:03 +02:00
Evan Tang
f374934281 tests: Test CopyResource depth to color. 2023-08-24 21:43:59 +02:00
Francisco Casas
ed9e236b01 vkd3d-shader/tpf: Avoid reading constant value components beyond type's width (Valgrind).
We are passing map writemasks that may have more components than the
constant's data type, so a (j < width) check is added to avoid reading
components from the constant that are not intended to be used.

Remaining values in the register are initialized to zero.
2023-08-24 21:43:55 +02:00
Nikolay Sivov
89eda51855 vkd3d-shader/hlsl: Change warning code for unknown loop attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-24 21:43:50 +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
Giovanni Mascellani
39e62ed2be configure: Require widl >= 3.21.
Commit b7402ddbbecdfaa81daa657fbb5d37661f401434 from wine is required,
which was first released with 3.21, not 3.20.
2023-08-24 21:43:34 +02:00
Zebediah Figura
622311da8e vkd3d-shader: Add a flag marking raw buffers to struct vkd3d_shader_descriptor_info. 2023-08-23 22:45:04 +02:00
Zebediah Figura
c1ebba9515 vkd3d-shader: Add structure stride to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
88f85ffb50 vkd3d-shader: Add constant buffer size to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
8c465c81cf vkd3d-shader: Add sample count to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
ccedb7f711 vkd3d-shader: Set descriptor flags in the caller to vkd3d_shader_scan_add_descriptor().
Return the vkd3d_shader_descriptor_info1 from that function.
2023-08-23 22:45:02 +02:00
Conor McCarthy
f3baf55d97 vkd3d: Implement ID3D12Device1 with stubs. 2023-08-23 22:44:58 +02:00
Giovanni Mascellani
8f8c89fb87 vkd3d: Update a warning so that it aligns with the check that triggers it. 2023-08-23 22:44:52 +02:00
Conor McCarthy
3ca2259807 vkd3d: Fix invalid atomic behaviour in the view cache linked list.
The list suffers from the ABA problem, where comparison with the head
succeeds but the head's `next` pointer has changed. Occurs in Cyberpunk
2077, on NVIDIA at least.
2023-08-23 22:44:45 +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
Zebediah Figura
240b9424fb vkd3d-shader/hlsl: Pass an hlsl_block pointer to append_output_copy(). 2023-08-15 21:51:47 +02:00
Zebediah Figura
a04e3a51dd vkd3d-shader/hlsl: Pass an hlsl_block pointer to prepend_input_copy(). 2023-08-15 21:51:39 +02:00
Zebediah Figura
7a4ac1afb1 vkd3d-shader/hlsl: Pass an hlsl_block pointer to prepend_uniform_copy(). 2023-08-15 21:51:37 +02:00
Francisco Casas
96f66aa4f8 vkd3d-shader/d3dbc: Use the bind count instead of the allocation size in d3dbc.c.
This should have no effect, since in SM1 the allocation size is the
same as the bind count because there are no texture registers.
It is just done for consistency.
2023-08-15 21:51:33 +02:00
Francisco Casas
d4a49d788a vkd3d-shader/hlsl: Simplify computation of allocation size. 2023-08-15 21:51:32 +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
81afe43569 vkd3d-shader/tpf: Put the actual bind count in the RDEF table. 2023-08-15 21:51:29 +02:00
Francisco Casas
7eba063136 vkd3d-shader/hlsl: Rename hlsl_reg.bind_count to hlsl_reg.allocation_size.
We have to distinguish between the "bind count" and the "allocation size"
of variables.

The "allocation size" affects the starting register id for the resource to
be allocated next, while the "bind count" is determined by the last field
actually used. The former may be larger than the latter.

What we are currently calling hlsl_reg.bind_count is actually the
"allocation size", so a rename is in order.

The real "bind count", which will be introduced in following patches,
is important because it is what should be shown in the RDEF table and
some resource allocation rules depend on it.

For instance, for this shader:

    texture2D texs[3];
    texture2D tex;

    float4 main() : sv_target
    {
        return texs[0].Load(int3(0, 0, 0)) + tex.Load(int3(0, 0, 0));
    }

the variable "texs" has a "bind count" of 1, but an "allocation size" of
3:

    // Resource Bindings:
    //
    // Name                                 Type  Format         Dim      HLSL Bind  Count
    // ------------------------------ ---------- ------- ----------- -------------- ------
    // texs                              texture  float4          2d             t0      1
    // tex                               texture  float4          2d             t3      1
2023-08-15 21:51:27 +02:00
Francisco Casas
948c4145f5 tests: Test texture allocation ordering in complex scenarios. 2023-08-15 21:51:26 +02:00
Nikolay Sivov
98f63c46f8 vkd3d-shader/hlsl: Use type width in fold_rcp().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:21 +02:00
Nikolay Sivov
932c5e36dc vkd3d-shader/hlsl: Add constant folding for 'log2'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:20 +02:00
Nikolay Sivov
58bc61e48d vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:18 +02:00
Nikolay Sivov
7e99188dc7 vkd3d-shader: Add constant folding for 'dp2add' operation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-08-14 18:38:15 +02:00