Commit Graph

3780 Commits

Author SHA1 Message Date
Zebediah Figura
28774b3649 vkd3d-shader/spirv: Move spirv_compiler_destroy() to avoid forward declarations. 2023-04-06 17:52:01 +02:00
Zebediah Figura
70cfd58be6 vkd3d-shader/spirv: Introduce a spirv_compile() helper. 2023-04-06 17:51:59 +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
Zebediah Figura
725d408974 vkd3d-shader/hlsl: Introduce an hlsl_block_init() helper. 2023-04-06 17:51:40 +02:00
Zebediah Figura
1da5a9a490 vkd3d-shader/hlsl: Introduce an hlsl_block_add_block() helper. 2023-04-06 17:51:38 +02:00
Zebediah Figura
ceac81b816 vkd3d-shader/hlsl: Introduce an hlsl_block_add_instr() helper. 2023-04-06 17:51:36 +02:00
Conor McCarthy
e27ceddfb4 vkd3d: Leave the command queue op mutex locked after a partial flush.
All return paths in d3d12_command_queue_flush_ops_locked() must
leave the op mutex locked.
2023-04-05 21:38:39 +02:00
Henri Verbeet
d6d9aab31c vkd3d-shader: Align the start offset instead of the size in bytecode_put_bytes().
The practical effect this has is that we avoid potential trailing padding at
the end of DXBC blobs. Unfortunately this also means we need to be more
careful about using bytecode_get_size() to find the offset where subsequent
data would get written, although in many cases this follows a put_u32() call.
2023-04-04 22:01:36 +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
Henri Verbeet
4e32adb8c1 vkd3d-utils: Export D3D12CreateDevice() once again.
Commit d27fee64ab inadvertently stopped
exporting D3D12CreateDevice().
2023-04-04 22:01:04 +02:00
Zebediah Figura
dfa4bfdd03 include: Make test context information nestable.
Based on Wine.
2023-04-04 21:59:58 +02:00
Zebediah Figura
1bf5050d3d tests: Factor out vkd3d_test_printf(). 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
bf4a125087 vkd3d-shader/hlsl: Ignore packoffset() contents for SM1. 2023-04-04 21:59:47 +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
9b70971696 vkd3d-shader/hlsl: Rename struct hlsl_reg_reservation fields. 2023-04-04 21:59:39 +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
Nikolay Sivov
eb71c5f20d vkd3d-shader/hlsl: Handle round() for SM1. 2023-04-03 18:00:03 +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
Conor McCarthy
88667098eb vkd3d: Do not destroy a heap until its resource count is zero.
Fixes a crash on exit in Horizon Zero Dawn (which requres added SM 6.0 support).

Placed resources should hold a reference to their heap:
https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createheap
2023-04-03 17:59:41 +02:00
Zebediah Figura
7a9e393ea0 vkd3d-shader/hlsl: Rename the "type" field of struct hlsl_type to "class".
To be consistent with enum hlsl_type_class and HLSL_CLASS_*.
2023-04-03 17:59:24 +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
Conor McCarthy
c61f9f477c vkd3d-shader/spirv: Declare the phase SPIR-V function in spirv_compiler_enter_shader_phase().
The convoluted code path is no longer needed.
2023-04-03 17:58:26 +02:00
Conor McCarthy
b8472d2270 vkd3d-shader/spirv: Remove the hull shader phase array.
With no more than one phase each of control point and fork/join type,
an array is not required.
2023-04-03 17:58:24 +02:00
Conor McCarthy
16a7de4b38 vkd3d-shader/trace: Trace the normalised instruction array after tracing the input. 2023-04-03 17:58:23 +02:00
Conor McCarthy
eabdccb117 vkd3d-shader/ir: Merge all shader IR fork and join phases into a single phase.
Normalise the incoming vkd3d_shader_instruction IR to the shader model 6
pattern. This allows generation of a single patch constant function in
SPIR-V.
2023-04-03 17:58:21 +02:00
Henri Verbeet
57d92a15cf Release 1.7. 2023-03-24 11:22:28 +01:00
Henri Verbeet
54b0165e32 vkd3d-shader: VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE was introduced in vkd3d 1.7. 2023-03-20 21:28:13 +01:00
Nikolay Sivov
4110f1e547 vkd3d-shader: Fix a few typos in the comments. 2023-03-15 20:13:27 +01:00
Henri Verbeet
8509ec1e72 vkd3d-shader/spirv: Update the current source location in spirv_compiler_generate_spirv(). 2023-03-13 22:10:00 +01:00
Henri Verbeet
0a73c75db8 vkd3d-shader/glsl: Update the current source location in vkd3d_glsl_generator_generate().
Since the introduction of instruction arrays, the parser location no
longer matches the location of the current instruction. Ultimately we'll
likely want to add some kind of explicit location information to struct
vkd3d_shader_instruction_array, because we might do transformations that
change the order of the original instructions.
2023-03-13 22:09:58 +01:00
Henri Verbeet
685abf9c2d vkd3d-shader/sm4: Do not specify a destination register for VKD3D_SM4_OP_DCL_RESOURCE in opcode_table[].
We do not set one in shader_sm4_read_dcl_resource(), and
shader_sm4_read_instruction() explicitly sets this to 0.
2023-03-13 22:09:54 +01:00
Henri Verbeet
65b7154a22 vkd3d-shader/sm4: Set "dst_count" to 0 when we clear "dst" in shader_sm4_read_instruction().
VKD3D_SM4_OP_DCL_RESOURCE currently has 1 for "dst_count", but NULL for
"dst". This is largely harmless because we never attempt to access the
destination register of VKD3DSIH_DCL instructions, but nevertheless not
quite proper.
2023-03-13 22:09:49 +01: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
Zebediah Figura
da2435707b vkd3d-shader/hlsl: Fix some memory leaks in the function call rule. 2023-03-09 22:11:06 +01:00
Henri Verbeet
d405295bc7 build: Fix the order of some .shader_test files. 2023-03-09 22:10:53 +01:00
Henri Verbeet
0c833056f6 build: Actually run asuint.shader_test. 2023-03-09 22:10:53 +01:00
Nikolay Sivov
193692bbcb vkd3d-shader/hlsl: Use array element type for array's regset.
Currently this affects SM1 compilation only, with a minimal example like this:

float4 var[3];
float4 main() : sv_target
{
    return var[1];
}
2023-03-09 22:10:39 +01:00
Nikolay Sivov
2880be647e vkd3d-shader/sm4: Write sample count field for multisampled texture declaration.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-03-08 20:15:11 +01:00