228 Commits

Author SHA1 Message Date
Giovanni Mascellani
cbce3a8631 tests/shader_runner: Always set descriptor heaps. 2025-04-09 16:42:16 +02:00
Giovanni Mascellani
bb8f1304ba tests/d3d12: Always set descriptor heaps.
It seems AMD and WARP are not particularly sensitive to that, but
NVIDIA drivers crash if descriptor heaps are not set.
2025-04-09 16:41:33 +02:00
Conor McCarthy
fdd21470b9 tests/hlsl: Test casts from double to 16-bit integer types. 2025-04-09 16:39:07 +02:00
Conor McCarthy
bb8b4f3827 tests/hlsl: Test casts to 16-bit uint. 2025-04-09 16:22:19 +02:00
Conor McCarthy
3c950e5977 tests/hlsl: Test casts to 16-bit int. 2025-04-09 16:20:58 +02:00
Conor McCarthy
88a85024e2 tests/hlsl: Test casts to 16-bit float. 2025-04-09 16:20:53 +02:00
Giovanni Mascellani
7fb288819a vkd3d-shader/msl: Set the prefix to "unknown" for unhandled shader types in msl_generator_init().
Like we do for GLSL; there's no reason to abort compilation here. Note
that this also avoids leaking "gen->buffer" and "gen->string_buffers" on
the error path.
2025-04-09 16:08:15 +02:00
Shaun Ren
0c139ef7a0 vkd3d-shader/hlsl: Add special allocation rules for patch constant data. 2025-04-09 16:02:12 +02:00
Shaun Ren
7ba84b7787 tests: Add signature reflection tests for register allocation rules in tessellation shaders. 2025-04-09 16:02:12 +02:00
Shaun Ren
d3b32fefa3 vkd3d-shader/tpf: Support SV_RenderTargetArrayIndex/SV_ViewportArrayIndex sysvals in tessellation shaders. 2025-04-09 16:02:12 +02:00
Shaun Ren
05f8dd8273 vkd3d-shader/hlsl: Prioritize smaller writemasks for all allocators in allocate_semantic_registers(). 2025-04-09 16:02:12 +02:00
Shaun Ren
ec2f18ab17 vkd3d-shader/hlsl: Free all allocators in allocate_semantic_registers(). 2025-04-09 16:02:12 +02:00
Shaun Ren
d1df10ac86 vkd3d-shader/hlsl: Use dcl_output_siv for patch constant function sysval outputs. 2025-04-09 16:02:12 +02:00
Henri Verbeet
70655012ab demos: Move the vkd3d parts of demo_xcb.h into a separate header.
So that they can be used for e.g. Wayland or macOS support. Or Windows,
if we're so inclined.
2025-04-08 20:38:26 +02:00
Henri Verbeet
b12e3d8eec demos: Get rid of some unused includes.
These were used for demo_load_shader(), but that was removed some time
ago in commit aa5d48eec4.
2025-04-08 20:38:26 +02:00
Victor Chiletto
89d3e667e0 tests/hlsl: Add tests for SRV structured buffers. 2025-04-08 19:31:40 +02:00
Victor Chiletto
cc9f4ac587 tests/hlsl: Attempt to deduce the data type of unspecified type texture data.
Try parsing first as integer, and if the parse stops at a decimal separator, parse as float.
2025-04-08 19:18:57 +02:00
Victor Chiletto
7b21183f45 tests/shader_runner_d3d12: Pass the structure byte stride for SRVs. 2025-04-08 19:18:56 +02:00
Anna (navi) Figueiredo Gomes
3e8b56c509 vkd3d-shader/fx: Don't cast between int and uint in state blocks. 2025-04-08 19:14:15 +02:00
Anna (navi) Figueiredo Gomes
8866a43b2d tests/hlsl: Add some fx_4_0 state tests. 2025-04-08 19:14:15 +02:00
Elizabeth Figura
f576ecc992 vkd3d-shader/hlsl: Introduce a compiler pass to vectorize stores. 2025-04-03 20:29:20 +02:00
Elizabeth Figura
1a999f74fc vkd3d-shader/hlsl: Introduce a compiler pass to vectorize expressions. 2025-04-03 20:29:20 +02:00
Giovanni Mascellani
7b4a29da81 tests: Mark a todo as resolved on MoltenVK 1.2.12.
Technically it is not, the Vulkan commands we're generating are
still not correct. But let's get rid of the failure message.
2025-04-03 20:28:31 +02:00
Giovanni Mascellani
653e4f47ac ci: Disable testing with DXC on macOS.
With this we can finally disallow failure for the macOS CI script,
which is more valuable than checking DXC. Eventually DXC tests
will have to be fixed, though.
2025-04-03 20:28:27 +02:00
Giovanni Mascellani
aab8ba02d8 tests: Mark a number of test failures as buggy on macOS before Sequoia.
It's hard to pinpoint exactly what's going wrong with these
tests. They seem to be related to atomics and GPU timestamps,
both categories that are known to have problems on MoltenVK in a
way or another; those failures clearly depend on a few factors
like the MoltenVK version, the macOS version and whether we're in
a virtual machine or not, but the exact dependency on those factors
is hard to describe (for example, in general the paravirtualized
device offered inside virtual machines has a lot more problems than
real devices, but I've seen tests, fixed all other conditions,
working on the paravirtualized device and not on the real device).

The only thing all tests in this batch have in common is that I've
never seen them fail on a Sequoia system, thus I've settled for
using just that as the bug_if() condition. Ultimately, wasting a
lot of time to get to the bottom of each single test failure is
pointless, and being able to mark the CI job as not allowed to
fail gives better regression protection than investigating each
of those. Also, I routinely run the tests on a Sequoia system, so
if these tests get broken this is going to be noticed anyway.
2025-04-03 20:26:26 +02:00
Nikolay Sivov
2540081988 vkd3d-shader/fx: Accept int(0) as well as uint(0) constant value for object-type states.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-04-02 19:34:25 +02:00
Nikolay Sivov
4ff14104b0 vkd3d-shader/fx: Set GeometryShader state type as an object type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-04-02 19:34:25 +02:00
Elizabeth Figura
ea21dddec9 vkd3d-shader/hlsl: Allow compiling directly to GLSL. 2025-04-02 19:33:41 +02:00
Elizabeth Figura
33cd10581e vkd3d-shader/glsl: Invert gl_FragCoord w. 2025-04-02 19:32:39 +02:00
Francisco Casas
4b9c23272a vkd3d-shader/ir: Reset instruction pointers after shader_instruction_array_insert_at().
Every call to shader_instruction_array_insert_at() means a possible
reallocation of all vsir instructions in the program. This means that all
previous pointers are potentially no longer valid.

We are currently using these potentially invalid pointers in some cases,
usually in the form of "ins->location". This commit fixes these.

I moved all pointer changes to right after the call to
shader_instruction_array_insert_at() to make this more evident.
2025-04-02 19:25:12 +02:00
Giovanni Mascellani
875c5df519 vkd3d-shader/ir: Validate register id and index for CONSTBUFFER registers. 2025-04-02 19:24:10 +02:00
Giovanni Mascellani
c181f147ce vkd3d-shader/ir: Validate register id and index for SAMPLER registers. 2025-04-02 19:08:50 +02:00
Giovanni Mascellani
9b7256c0c8 vkd3d-shader/ir: Validate register id and index for UAV registers. 2025-04-02 19:08:00 +02:00
Giovanni Mascellani
10d8760134 vkd3d-shader/ir: Validate register id and index for RESOURCE registers. 2025-04-02 19:06:43 +02:00
Shaun Ren
3e44bd4e5b tests/hlsl: Add a test for copy-propagation of uniform texture object writes. 2025-04-02 18:51:10 +02:00
Shaun Ren
7aebed0eea vkd3d-shader/hlsl: Ensure that uniform objects are never written to in copy_propagation_transform_object_load(). 2025-04-02 18:49:52 +02:00
Shaun Ren
b1d8915440 vkd3d-shader/hlsl: Divert written uniform derefs to temps before copy-propagation passes.
The following pixel shader currently triggers an infinite loop during
copy propagation, which is fixed by this commit:

    sampler s;
    Texture2D t1, t2;

    float4 main() : sv_target
    {
        Texture2D t = t1;
        t1 = t2;
        t2 = t;
        return t1.Sample(s, float2(0, 0)) + t2.Sample(s, float2(0, 0));
    }

The infinite loop occurs because copy_propagation_transform_object_load()
replaces t1 in the resource_load(t1, ...) instruction
with t2, t1, t2, ... repeatedly.
2025-04-02 18:49:52 +02:00
Francisco Casas
3ead8d532b vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.
Note that we still have to preempt the propagation to SM1 pixel shader
uniforms. Otherwise this will turn the many constant derefs that appear
from the <index-val> copy generated in lower_index_loads() into a single
non-constant deref, causing it to allocate all the registers instead of
up until the last one used.
2025-04-02 18:27:16 +02:00
Francisco Casas
f65e6265e0 vkd3d-shader/ir: Normalise MOVA and d3dbc indirect addressing. 2025-04-02 18:27:16 +02:00
Francisco Casas
fd02d69dda vkd3d-shader/hlsl: Implement indirect addressing for d3dbc target profiles. 2025-04-02 18:26:03 +02:00
Francisco Casas
0e0ed72652 vkd3d-shader/d3dbc: Respect "idx_count" when writing registers.
Some SM1 src registers have idx_count = 0, in which case we have to
respect that instead of always reading reg->reg.idx[0].offset even when
it is invalid.
2025-04-02 18:06:48 +02:00
Francisco Casas
2327f87e37 tests/hlsl: Test SM1 vertex shader uniform allocation on indirect addressing.
Here, a vertex shader version of the previous test by Shaun is
introduced. Note that in this case the uniform allocates all 4 registers
instead of 3 because it is indirectly addressed.
2025-04-02 18:06:48 +02:00
Francisco Casas
b6ce1479fe tests/hlsl: Test vertex shader uniform indirect addressing.
Note that, for indexes with a decimal part, the behavior is different
depending on whether it is a temp load or a direct uniform load (which
can only happen on vertex shaders). The former rounds to the
closest-to-zero, while the latter rounds to the nearest even.
2025-04-02 18:06:18 +02:00
Elizabeth Figura
20b76f87bf vkd3d-shader/hlsl: Initialize the temp count for sm1. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
7cb5a7bebc vkd3d-shader/hlsl: Leave the swizzle zero for VSIR_DIMENSION_NONE registers. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
950f78041a vkd3d-shader/hlsl: Initialize the vsir dimension for sm1. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
856f4b55f6 vkd3d-shader/hlsl: Set the correct index count for sm1 DEPTHOUT. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
227e2cc0f5 vkd3d-shader/hlsl: Use vsir_*_from_hlsl_node() helpers in more places. 2025-04-02 17:58:18 +02:00
Henri Verbeet
110edf32d0 demos: Add basic DPI handling. 2025-03-19 14:10:24 +01:00
Nikolay Sivov
21e08955d3 vkd3d-shader/fx: Pad fx_2_0 object data blobs with zeroes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-18 15:56:32 +01:00
Giovanni Mascellani
803bf59654 tests: Mark an early depth stencil test as buggy on MoltenVK.
On MoltenVK it seems that all draws are always executed,
independently of the early depth stencil test. The problem doesn't
seem to belong to vkd3d or MoltenVK, because the generated Metal
commands look correct. I tried looking at a GPU capture with Xcode,
which was not very conclusive because it doesn't state clearly
whether early fragment tests were passed or not. Sometimes it
says that a fragment shader execution had no thread execution
data, which I interpret as the early fragment tests having
prevented the fragment shader from running, but it's not really
consistent, and it's never clear which results are based on
software simulation and which on the hardware run.

However taking everything into account I think the most likely
explanation is some incorrect optimization at the Metal level.
2025-03-18 15:55:29 +01:00
Giovanni Mascellani
05f7f03dab tests: Mark a queue synchronization test as buggy on MoltenVK.
The graphics pipeline triggers an internal error in the Metal
pipeline compiler, with a completely generic error message. I have
no idea what the actual problem is.
2025-03-18 15:53:59 +01:00
Shaun Ren
8f19d02501 tests: Add a signature reflection test for geometry shader inputs. 2025-03-18 15:46:07 +01:00
Shaun Ren
62c00be873 vkd3d-shader/tpf: Emit geometry shader property declarations. 2025-03-18 15:46:07 +01:00
Shaun Ren
bd055fac1c vkd3d-shader/hlsl: Store geometry shader properties in struct vsir_program. 2025-03-18 15:46:02 +01:00
Shaun Ren
b1ace5763a vkd3d-shader/hlsl: Implement input semantics for geometry shaders. 2025-03-18 15:40:11 +01:00
Shaun Ren
8af3173955 vkd3d-shader/hlsl: Support input primitive arrays in geometry shaders. 2025-03-18 15:40:11 +01:00
Giovanni Mascellani
2377db33db vkd3d-shader: Represent descriptor information in the vsir program. 2025-03-18 15:38:01 +01:00
Giovanni Mascellani
4308fa3f68 vkd3d-shader/spirv: Do not steal the instruction array from the vsir program.
There is no need, and it only complicates tracking ownership.
2025-03-18 15:37:57 +01:00
Giovanni Mascellani
fc520e7b4c vkd3d-shader/spirv: Do not store duplicate references to the signatures.
They are already available through the program.
2025-03-18 15:34:16 +01:00
Giovanni Mascellani
5ce03258b5 vkd3d-shader/spirv: Immediately store a reference to the program in the SPIR-V generator.
So it doesn't have to be passed around uselessly.
2025-03-18 15:34:04 +01:00
Giovanni Mascellani
549659dab6 vkd3d-shader/spirv: Run the vsir passes before creating the SPIR-V generator.
This makes it more similar to the MSL and GLSL generators. It also looks
like a cleaner design, the backend is supposed to get access to the vsir
program after it has gone through the pipeline.
2025-03-18 15:33:27 +01:00
Francisco Casas
ea99d2c2cd vkd3d-shader/hlsl: Lower integer modulus for d3dbc target profiles. 2025-03-18 15:27:04 +01:00
Francisco Casas
828afe188c vkd3d-shader/hlsl: Don't lower integer MOD and DIV on const passes for d3dbc target profiles.
These bitwise operations are not available in these profiles.
2025-03-18 15:27:03 +01:00
Francisco Casas
e3923876c0 tests/hlsl: Test integer division with big integers.
Similarly to the modulus operator, d3dbc results with constant folding
are different from results when constant folding cannot be applied, and
different from tpf results.
2025-03-18 15:25:41 +01:00
Francisco Casas
080672478d tests/hlsl: Test integer modulus with big integers.
Note that in d3dbc target profiles it gives different results when this
operation is constant folded compared to when it is not.

This suggests that whatever pass lowers the modulus operation to d3dbc
operations doesn't do it before constant folding.

Also note that when constant folded, d3dbc results differ from tpf
results for negative operands, because of the loss of precision that
happens when NEG is constant folded.

So the same integer modulus expression can have 3 different results
depending on the context.
2025-03-18 15:21:43 +01:00
Francisco Casas
a3f80061b1 tests/hlsl: Test for loss of precision on integer negation in d3dbc target profiles. 2025-03-18 14:25:26 +01:00
Elizabeth Figura
bc382c6835 vkd3d-shader/hlsl: Reuse shader model 1-3 constants. 2025-03-18 14:21:02 +01:00
Giovanni Mascellani
e418bbcfac tests: Mark a test about resource aliasing as todo on MoltenVK.
As far as I know there is no way to implement this properly on
Vulkan, and all the other Vulkan implementations essentially work
by luck. In Vulkan the initial layout of a resource must always be
UNDEFINED or PREINITIALIZED and it must be transitioned away from
before any meaningful use of that image is done. Therefore it's
possible to alias two images and let the second one inherit the
content in the first one only if both already exist (and are in
the same layout) before the first writing is done. If, as in this
example, the second image is created after the first one has
already been written to, the obligatory transition away from
UNDEFINED or PREINITIALIZED will potentially wipe out the content.

Therefore I am marking this as todo, not as a bug. I might also be
that there is a bug in MoltenVK, and ultimately that's the reason
why we're reading invalid data, but technically the Vulkan
commands we generate are incorrect anyway.
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
44072062ff tests: Transition texture state to inherit aliased data.
When textures[1] is read for the second time it is aliased to
textures[0]. But textures[0] was left in COPY_DEST state (since
its creation), and textures[1] is currently recreated in COPY_SOURCE
state, which AFAIU is invalid. So recreate textures[1] in COPY_DEST
state and then transition it before reading it.
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
c3f01d7db9 tests: Mark two other tessellation tests as buggy on MoltenVK.
I haven't investigated the actual problem here, but the generated
Vulkan commands look correct (and work with basically all other
Vulkan implementations) and MoltenVK is known to have incomplete
tessellation support, so it's likely that the problem is there.
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
8cf61c859d tests: Mark a few other timestamp query tests as buggy on MoltenVK.
Similarly to 5d4edba925, it seems
that sometimes MoltenVK returns 0 to timestamp queries. It
doesn't happen deterministically and it might depend on the
hardware (I have seen differences between the M2 I used some
time ago and the M3 Max I have now).
2025-03-17 15:14:23 +01:00
Giovanni Mascellani
101f070f12 ci: Define VKD3D_TEST_DEBUG when running the CI scripts.
Essentially to make d3d12.log more readable.
2025-03-17 15:14:23 +01:00
Henri Verbeet
0dff53ada7 build: Add @DL_LIBS@ to tests_vkd3d_shader_api_LDADD.
It uses dxcompiler_create(), which (potentially) uses dlopen().
2025-03-17 15:13:42 +01:00
Giovanni Mascellani
674614cc7a vkd3d-shader/ir: Disallow IMMCONSTBUFFER registers in destination parameters. 2025-03-17 15:12:13 +01:00
Giovanni Mascellani
0761d73e9c vkd3d-shader/ir: Disallow CONSTBUFFER registers in destination parameters. 2025-03-17 15:12:13 +01:00
Giovanni Mascellani
0c9c29fb34 vkd3d-shader/ir: Validate CONSTBUFFER registers. 2025-03-17 15:11:52 +01:00
Henri Verbeet
808931b108 vkd3d-shader/glsl: Implement VKD3DSIH_XOR. 2025-03-17 15:07:51 +01:00
Nikolay Sivov
ba79890398 vkd3d-shader/fx: Support dumping parameter and array selector assignments for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-17 15:05:14 +01:00
Nikolay Sivov
ff7591171b vkd3d-shader/fx: Dump complex state value blobs for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-17 14:54:26 +01:00
Nikolay Sivov
fb16ae2325 vkd3d-shader/fx: Add support for dumping fx_2_0 shader blobs.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-17 14:48:12 +01:00
Nikolay Sivov
36e1a0ceae vkd3d-shader/fx: Add support for parsing fx_2_0 sampler states.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-17 14:46:36 +01:00
Nikolay Sivov
3e86484091 vkd3d-shader/fx: Read fx_2_0 assignment data outside of its dumping helper.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-17 14:46:36 +01:00
Nikolay Sivov
fb5d53bf57 vkd3d-shader/fx: Add a helper to escape printed strings.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-17 14:46:18 +01:00
Giovanni Mascellani
fc4316f664 tests/shader_runner: Avoid creating devices for backends that won't execute.
My main motivation to this is avoiding generating a lot of useless
log lines from other executors when I'm interested in just one of
them, but I can imagine this also somewhat improving efficiency.
2025-03-17 14:01:22 +01:00
Giovanni Mascellani
0b273ea88c tests: Store the compiler string in the shader runner capabilities.
Just like the executor.
2025-03-17 13:50:19 +01:00
Shaun Ren
a4f58be00c vkd3d-shader/hlsl: Remove the unused hlsl_array_type_to_string() declaration.
Accidentally introduced in 870c68dd27.
2025-03-13 14:02:26 +01:00
Elizabeth Figura
c9a5f586b7 vkd3d-shader/hlsl: Zero-initialize "nonconst_i" and "ret_swizzle" in copy_propagation_replace_with_deref().
GCC without LTO is unable to determine that these are never used
uninitialized.
2025-03-13 13:59:05 +01:00
Francisco Casas
09b9f8ff9f vkd3d-shader/hlsl: Fix invalidation of the wrong components in copy-propagation.
Fixes: 1bba18aa75.
2025-03-12 22:14:25 +01:00
Francisco Casas
bff9068a7f tests: Add a hard test for copy-propagation invalidation.
This test is currently miscompiling on SM4 because
copy_propagation_invalidate_variable_from_deref_recurse() is not always
invalidating the right components.
2025-03-12 22:14:15 +01:00
Elizabeth Figura
a87b1efbd2 vkd3d-shader/hlsl: Don't invalidate OOB constant derefs. 2025-03-12 22:09:57 +01:00
Elizabeth Figura
193e40c271 vkd3d-shader/hlsl: Stop checking for failure from intrinsic_float_convert_arg(). 2025-03-12 22:02:39 +01:00
Elizabeth Figura
7b5b5dbb8d vkd3d-shader/hlsl: Do not abort when performing an invalid implicit cast. 2025-03-12 22:02:39 +01:00
Elizabeth Figura
2ee19c4d34 vkd3d-shader/hlsl: Do not abort when performing an invalid explicit cast. 2025-03-12 22:02:39 +01:00
Elizabeth Figura
25f476c7ad vkd3d-shader/hlsl: Return an error expression from add_cast() on allocation failure. 2025-03-12 22:02:39 +01:00
Elizabeth Figura
0642531c2a vkd3d-shader/hlsl: Introduce hlsl_block_add_swizzle(). 2025-03-12 22:02:31 +01:00
Elizabeth Figura
f8c53fae37 vkd3d-shader/hlsl: Introduce hlsl_block_add_resource_load(). 2025-03-12 22:02:21 +01:00
Henri Verbeet
b9ebf87114 vkd3d-shader/hlsl: Do not collect expressions across different operations in hlsl_normalize_binary_exprs(). 2025-03-12 21:34:17 +01:00
Henri Verbeet
b4296e1a2d tests/hlsl: Add another constant folding test. 2025-03-12 21:34:02 +01:00
Shaun Ren
dd1072a99b tests/hlsl: Add geometry shader syntax tests. 2025-03-12 21:21:35 +01:00
Shaun Ren
ae5261b98b vkd3d-shader/hlsl: Forbid output parameters in geometry shaders.
Outputs in geometry shaders must be written to streams.
2025-03-12 21:15:15 +01:00
Shaun Ren
4137ea5ab7 vkd3d-shader/hlsl: Validate stream output parameters in geometry shaders. 2025-03-12 21:13:59 +01:00
Shaun Ren
b650e7a503 vkd3d-shader/hlsl: Validate stream output object declarations.
Valid stream output objects must be single-element containing a
PointStream/LineStream/TriangleStream object.

Moreover, stream output objects cannot be declared globally.
2025-03-12 21:12:56 +01:00
Shaun Ren
870c68dd27 vkd3d-shader/hlsl: Validate and record input primitive types in geometry shaders. 2025-03-12 21:11:46 +01:00
Shaun Ren
57bb28e841 vkd3d-shader/hlsl: Parse primitive type modifiers in geometry shaders. 2025-03-12 20:42:59 +01:00
Shaun Ren
e880b11626 vkd3d-shader/hlsl: Parse the maxvertexcount attribute. 2025-03-12 20:42:15 +01:00
Francisco Casas
7be7e589a9 vkd3d-shader/hlsl: Lower TRUNC expressions for SM1.
Basically, separate lower_casts_to_int() into the lowering of the CAST
and the lowering of the TRUNC, so that TRUNCs that are not part of a
cast are lowered as well.
2025-03-12 18:26:23 +01:00
Shaun Ren
1b03676a36 tests/hlsl: Add dynamic addressing copy-propagation tests. 2025-03-12 18:22:01 +01:00
Shaun Ren
7ab7b2ab8b vkd3d-shader/hlsl: Implement copy-propagation of derefs with a non-constant index.
We implement a transformation that propagates loads with a single
non-constant index in its deref path. Consider a load of the form
var[[a0][a1]...[i]...[an]], where ak are integral constants, and i is
an arbitrary non-constant node. If, for all j, the following holds:

  var[[a0][a1]...[j]...[an]] = x[[c0*j + d0][c1*j + d1]...[cm*j + dm]],

where ck, dk are constants, then we can replace the load with
x[[c0*i + d0]...[cm*i + dm]]. This pass is implemented by
copy_propagation_replace_with_deref().
2025-03-12 18:16:59 +01:00
Shaun Ren
f484527cfb vkd3d-shader/hlsl: Rename init_deref() to hlsl_init_deref(). 2025-03-12 17:22:44 +01:00
Shaun Ren
2bc7fa568f vkd3d-shader/hlsl: Introduce component_index_from_deref_path_node(). 2025-03-12 17:19:56 +01:00
Shaun Ren
2368ff6637 vkd3d-shader/hlsl: Introduce simplify_exprs().
Also invoke simplify_exprs() after replace_deref_path_with_offset().
2025-03-12 17:18:52 +01:00
Shaun Ren
c6f18c9394 vkd3d-shader/hlsl: Support indirect addressing of uniforms in sm4_generate_vsir_reg_from_deref(). 2025-03-12 17:14:52 +01:00
Shaun Ren
f6c35144e4 vkd3d-shader/hlsl: Support patch arrays in hlsl_reg_from_deref(). 2025-03-12 17:10:32 +01:00
Shaun Ren
261b5120f6 vkd3d-shader/hlsl: Allow non-constant indices in register_deref_usage(). 2025-03-12 17:10:32 +01:00
Shaun Ren
1c2434f4d3 vkd3d-shader/hlsl: Allow uint1-typed deref path nodes.
When derefs with non-constant indices are copy-propagated, it is
possible to end up with uint1-typed path nodes.

Also, introduce hlsl_is_vec1().
2025-03-12 17:09:35 +01:00
Shaun Ren
766492d1cc vkd3d-shader/glsl: Implement support for indirect constant buffer addressing. 2025-03-12 17:06:47 +01:00
Shaun Ren
16b0afc192 vkd3d-shader/tpf: Write non-zero static offsets in relative addressing mode in sm4_write_register_index(). 2025-03-12 17:04:52 +01:00
Henri Verbeet
81dc67b1ef demos: Add copyright headers to the HLSL shaders. 2025-03-10 15:18:07 +01:00
Elizabeth Figura
8f28956108 vkd3d-shader/hlsl: Fix writing the sincos extra constants.
Fixes: 4ed16108f0
2025-03-10 15:17:19 +01:00
Elizabeth Figura
d075c3c274 vkd3d-shader/hlsl: Fix temp allocation for ps 1.x.
Iterate over the extern vars, not the parameters. The synthesized inputs and
output don't go in the function parameters.

Fixes: 8b57a612d7
2025-03-10 15:17:19 +01:00
Nikolay Sivov
553e37314a vkd3d-shader/fx: Print string object entries for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-10 15:14:32 +01:00
Nikolay Sivov
3749171656 vkd3d-shader/fx: Output object initialiser IDs for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-10 15:14:24 +01:00
Giovanni Mascellani
d34f5fbae2 tests/shader_runner: Allow selecting the compiler. 2025-03-10 15:12:45 +01:00
Giovanni Mascellani
5a898254b0 tests/shader_runner: Allow selecting the executor. 2025-03-10 15:12:33 +01:00
Petrichor Park
f05386e006 tests/shader_runner: Allow controlling which shader models to run via command line.
Adds new flags --sm-min and --sm-max. They each take a shader model
identifier, with the same syntax as in the test harness. If either is
present, then it will only run tests within the (inclusive) range.
Omitting one allows anything as the min/max.
2025-03-10 15:12:25 +01:00
Henri Verbeet
2f260a344e build: Get rid of some redundant instances of "checking" in AC_MSG_CHECKING messages.
AC_MSG_CHECKING already prints "checking" itself.
2025-03-10 15:03:23 +01:00
Elizabeth Figura
f4042ba752 vkd3d-shader/hlsl: Add a hlsl_block_add_resource_store() helper. 2025-03-10 14:56:11 +01:00
Elizabeth Figura
e7ff5da5b1 vkd3d-shader/hlsl: Add a hlsl_block_add_index() helper. 2025-03-10 14:56:11 +01:00
Elizabeth Figura
e5cabeafe5 vkd3d-shader/hlsl: Add a hlsl_block_add_loop() helper. 2025-03-10 14:56:11 +01:00
Elizabeth Figura
62196b2bf1 vkd3d-shader/hlsl: Add a hlsl_block_add_if() helper. 2025-03-10 14:56:11 +01:00
Elizabeth Figura
20aa37237d vkd3d-shader/hlsl: Add a hlsl_block_add_jump() helper. 2025-03-10 14:56:11 +01:00
Henri Verbeet
5d55a5894c vkd3d-shader/spirv: Handle "BitEnum" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
00039ba629 vkd3d-shader/spirv: Handle "ValueEnum" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
321154d25a vkd3d-shader/spirv: Handle "LiteralString" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
0e092aef70 vkd3d-shader/spirv: Handle "LiteralInteger" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
8afeb13035 vkd3d-shader/spirv: Handle "IdResultType" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
b9e78f2e2e vkd3d-shader/spirv: Handle "IdResult" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
e83f4f40f9 vkd3d-shader/spirv: Handle "IdRef" operands. 2025-03-10 14:47:03 +01:00
Henri Verbeet
bebc550f02 vkd3d-shader/spirv: Implement outputting opcode names. 2025-03-10 14:47:00 +01:00
Henri Verbeet
997f3f8266 vkd3d-shader/spirv: Implement outputting instruction offsets. 2025-03-10 14:45:06 +01:00
Giovanni Mascellani
8c785f1dc9 vkd3d-shader/spirv: Emit immediate words for unhandled instructions.
The assembler can parse these to reconstruct the original bytecode.
2025-03-10 14:45:06 +01:00
Nikolay Sivov
1417af2eab vkd3d-shader/fx: Add support for parsing numeric states in fx_2_0 passes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-06 17:21:10 +01:00
Nikolay Sivov
fb76e5daa2 vkd3d-shader/fx: Add support for parsing fx_2_0 parameters.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-06 17:21:10 +01:00
Henri Verbeet
36b8186021 vkd3d-shader/fx: Handle parser failures in fx_parse(). 2025-03-06 17:19:28 +01:00
Henri Verbeet
a6fda3e65d vkd3d-shader/fx: Output error messages for invalid sizes. 2025-03-06 17:19:28 +01:00
Elizabeth Figura
18ca7affad vkd3d-shader/hlsl: Make min16uint into a first-class type.
And properly implement translation into some binary enumerations.
2025-03-06 17:15:15 +01:00
Elizabeth Figura
16be9181a0 vkd3d-shader/hlsl: Pass the correct type to base_type_get_semantic_equivalent(). 2025-03-06 17:15:15 +01:00
Elizabeth Figura
3cf4a4e95e vkd3d-shader/hlsl: Use common hlsl_type_is_integer() and hlsl_base_type_is_integer() helpers. 2025-03-06 17:15:15 +01:00
Elizabeth Figura
bd34ec1fb3 vkd3d-shader/hlsl: Emit the minimum-precision SFI0 flag. 2025-03-06 17:15:15 +01:00
Elizabeth Figura
6cdfe38319 vkd3d-shader/hlsl: Emit minimum-precision signatures. 2025-03-06 17:15:15 +01:00
Elizabeth Figura
c2ca6b6bdf vkd3d-shader/hlsl: Emit the minimum-precision global flag when minimum-precision semantics are used.
There are other things we need to check, but this is a start.
2025-03-06 17:15:15 +01:00
Elizabeth Figura
055625448b vkd3d-shader/hlsl: Add a hlsl_block_add_simple_load() helper. 2025-03-05 14:12:12 +01:00
Elizabeth Figura
d52df527ba vkd3d-shader/hlsl: Add a hlsl_block_add_load_index() helper. 2025-03-05 14:12:12 +01:00
Elizabeth Figura
7b486fe239 vkd3d-shader/hlsl: Return an error expr from hlsl_add_load_component() on allocation failure. 2025-03-05 14:12:12 +01:00
Elizabeth Figura
009f5765df vkd3d-shader/hlsl: Return void from hlsl_block_add_store_component(). 2025-03-05 14:12:12 +01:00
Elizabeth Figura
9e3ac35669 vkd3d-shader/hlsl: Pass the target block to hlsl_new_store_component(). 2025-03-05 14:12:12 +01:00
Henri Verbeet
5ab5a721a1 vkd3d-shader/spirv: Do not sign-extend *ptr in vkd3d_spirv_build_string().
"char" is (potentially) signed, so casting it to uint32_t will
sign-extend it. Because we use |= to assign it to "word", and don't
otherwise mask out the higher bits either, we effectively set subsequent
bytes in the same word to 0xff for input bytes > 0x7f. That potentially
includes the \0 terminator. For example, "Ă©" (U+00e9) is "\xc3\xa9"
when encoded as UTF-8, and would get us 0xffffffc3 instead of
0x0000a9c3.
2025-03-05 14:10:58 +01:00
Nikolay Sivov
871c9c61a5 vkd3d-shader/fx: Fix const strings array types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-05 14:09:58 +01:00
Nikolay Sivov
1c43b7b55c vkd3d-shader/fx: Add support for parsing fx_2_0 annotations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-05 14:02:09 +01:00
Nikolay Sivov
db7c22d9d6 vkd3d-shader/fx: Parse technique and pass blocks for fx_2_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-05 14:01:53 +01:00
Anna (navi) Figueiredo Gomes
50254c284b vkd3d-shader: Parse angle bracket initializer in state blocks.
While fxc allows full expressions inside the angle brackets, we don't parse that
yet as it'd be quite a mess to properly do so with yacc, and I'm not aware of any
game doing so in their shaders.
2025-03-03 18:00:23 +01:00
Anna (navi) Figueiredo Gomes
9809bda0e5 tests/hlsl: Add angle bracket state block syntax test. 2025-03-03 18:00:23 +01:00
Nikolay Sivov
9f09ac6893 vkd3d-shader/fx: Fix condition when printing literal constant arguments.
To reproduce:

float4 v;

SamplerState s
{
    BorderColor = 0.1 + v*0.2;
};

Expression should use more than one literal constant,
as a scalar in operation that involves a vector.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-03 17:54:17 +01:00
Giovanni Mascellani
aa032f31bb vkd3d: Split Vulkan debug messages.
So that they do not get truncated if they're too long.
2025-03-03 17:53:17 +01:00
Elizabeth Figura
e76c596d56 vkd3d-shader/hlsl: Add a hlsl_block_add_simple_store() helper. 2025-03-03 17:48:03 +01:00
Elizabeth Figura
fc4f440245 vkd3d-shader/hlsl: Add a hlsl_block_add_store_index() helper. 2025-03-03 17:48:03 +01:00
Elizabeth Figura
eafc97bcb3 vkd3d-shader/hlsl: Pass the target block to hlsl_new_load_component(). 2025-03-03 17:48:03 +01:00
Elizabeth Figura
d053f3665d vkd3d-shader/hlsl: Pass a block to hlsl_new_void_expr(). 2025-03-03 17:48:03 +01:00
Elizabeth Figura
662d60ad6b vkd3d-shader/hlsl: Add a hlsl_block_add_expr() helper. 2025-03-03 17:48:03 +01:00
Francisco Casas
f24cc55c14 vkd3d-shader/hlsl: Remove lower_nonfloat_exprs().
The only purpose it has at this point is wrapping integer DIV in casts,
which can be moved to lower_division().
2025-03-03 17:47:42 +01:00
Francisco Casas
7cb1970952 vkd3d-shader/hlsl: Don't cast all expressions to float.
Instead, allow half, bool, int, and uint, expressions that map to the
same float op to reach sm1_generate_vsir_instr_expr().
2025-03-03 17:26:15 +01:00
Anna (navi) Figueiredo Gomes
0ce2b1359f tests/hlsl: Add lower sm1 saturate test. 2025-03-03 17:25:20 +01:00
Henri Verbeet
57518d5312 ci: Install libjson-perl. 2025-03-02 17:08:51 +01:00
Giovanni Mascellani
8297ea9aa6 vkd3d/device: Require VK_KHR_zero_initialize_workgroup_memory when appropriate.
That extension (and the corresponding feature) must be enabled when
the Initializer operand is used for workgroup variables.
2025-02-26 16:11:50 +01:00
Nikolay Sivov
e746a4c12f vkd3d-shader/fx: Improve state object nesting for the fx -> text output.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-02-24 16:19:07 +01:00
Nikolay Sivov
09226543fe vkd3d-shader/fx: Implement parsing complex value and index expressions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-02-24 16:19:07 +01:00
Henri Verbeet
58aed8fd0d vkd3d-shader/fx: Use vkd3d_string_buffer_print_f32() in parse_fx_4_numeric_value().
Instead of "%f". vkd3d_string_buffer_print_f32() will use sufficient
precision to represent the stored value exactly, and will use '.' as
decimal separator regardless of the current locale.
2025-02-24 16:19:07 +01:00
Elizabeth Figura
2989373212 vkd3d-shader/hlsl: Add a hlsl_block_add_binary_expr() helper. 2025-02-24 16:19:07 +01:00
Elizabeth Figura
858b6a3e0b vkd3d-shader/hlsl: Add a hlsl_block_add_cast() helper. 2025-02-24 16:19:07 +01:00
Elizabeth Figura
2e09257d94 vkd3d-shader/hlsl: Add a hlsl_block_add_unary_expr() helper. 2025-02-24 16:19:07 +01:00
Elizabeth Figura
b7ea23303e vkd3d-shader/hlsl: Add a hlsl_block_add_float_constant() helper. 2025-02-24 16:19:07 +01:00
Elizabeth Figura
e830cdee71 vkd3d-shader/hlsl: Inline add_pow_expr().
The helper is used in one place.
2025-02-24 16:19:07 +01:00
Conor McCarthy
439652f023 tests: Replace test_vs_ps_relative_addressing() with a shader runner test.
Besides simply being more compact, this allows the test to cover more
shader types, perhaps most notably DXIL.
2025-02-24 16:19:01 +01:00
Henri Verbeet
1fd89abcc3 vkd3d-shader: Enable DXIL support in the default configuration. 2025-02-24 15:10:08 +01:00
Henri Verbeet
73c0356861 tests: Add a shader model 6 signature reflection test for different types. 2025-02-24 15:10:08 +01:00
Henri Verbeet
fe4143ad19 vkd3d-shader/dxil: Generate I/O signatures with 16-bit component types for native 16-bit shaders.
Which incidentally matches the I/O signatures from the DXBC container.
2025-02-24 15:10:08 +01:00
Henri Verbeet
f5d702b09a vkd3d-shader/dxbc: Validate component types in shader_parse_signature(). 2025-02-24 15:10:08 +01:00
Henri Verbeet
b8d740ebfc vkd3d-shader/dxbc: Output messages for invalid semantic name references in shader_parse_signature(). 2025-02-24 15:10:08 +01:00
Henri Verbeet
3bcdb85ddc vkd3d-shader/dxbc: Set the "elements_capacity" field as well in shader_parse_signature().
Leaving it as 0 mostly ends up doing the right thing in practice, but isn't
quite right.
2025-02-24 15:10:08 +01:00
Giovanni Mascellani
2feb3a3bba vkd3d: Take the root signature from shaders when creating graphics pipelines.
If the root signature wasn't explicitly specified.

This fixes a failure in The Touryst.
2025-02-20 16:00:55 +01:00
Giovanni Mascellani
42b65e80cf tests: Test embedding the root signature in shaders for graphics pipelines. 2025-02-20 15:59:22 +01:00
Henri Verbeet
0796af7b4b vkd3d: Avoid vkd3d_shader_parse_input_signature(). 2025-02-20 15:57:26 +01:00
Henri Verbeet
2e62e9ea7e vkd3d-shader: Handle arrayed elements in vkd3d_shader_signature_from_shader_signature(). 2025-02-20 15:57:26 +01:00
Henri Verbeet
ce5164e26e tests: Add a signature reflection test for arrayed inputs and outputs. 2025-02-20 15:57:26 +01:00
Henri Verbeet
4e28d1c658 vkd3d-shader/dxbc: Do not extract I/O signatures for DXIL shaders.
The DXIL parser doesn't need them.
2025-02-20 15:57:26 +01:00
Henri Verbeet
f4a3d17269 vkd3d-shader/dxil: Avoid using the I/O signatures from the DXBC container.
We currently generate our own I/O signatures inside the DXIL parser, but
use the element counts from the DXBC container signatures to allocate
the input_params/output_params/patch_constant_params arrays. That
happens to work for well-behaved inputs, but it's asking for trouble.
2025-02-20 15:57:26 +01:00
Henri Verbeet
970a1a2b35 vkd3d-shader/dxbc: Update the vkd3d_shader_parse_input_signature() documentation for dxbc-dxil shaders. 2025-02-20 15:57:26 +01:00
Elizabeth Figura
d5a2ff5c12 vkd3d-shader/hlsl: Add a hlsl_block_add_int_constant() helper. 2025-02-20 15:56:31 +01:00
Elizabeth Figura
992d20def3 vkd3d-shader/hlsl: Add a hlsl_block_add_uint_constant() helper. 2025-02-20 15:50:13 +01:00
Elizabeth Figura
79ad8c9354 vkd3d-shader/hlsl: Handle error instructions in hlsl_new_swizzle().
We already check for error instructions when parsing swizzles, but if allocation
fails at codegen time we would like to avoid asserting when subsequently
constructing a swizzle.
2025-02-20 15:49:40 +01:00
Elizabeth Figura
4072aa4a4b vkd3d-shader/hlsl: Remove the type equality assertions in hlsl_new_ternary_expr().
Similar to d1c2ae3f0e, this is a bit too strict
and may prevent e.g. simultaneous use of float and float1 at codegen time.

However, in this case the inciting factor is that in the case of allocation
failure at codegen time, we would like to allow one or more arguments to have
error type.
2025-02-20 15:48:25 +01:00
Elizabeth Figura
ba868ed4a6 vkd3d-shader/hlsl: Skip transformation passes on error.
The primary motivation here is to avoid needing to worry about instructions
potentially pointing to the preallocated error instruction in the case of
allocation failure.

This doesn't cover all passes, but none of the other passes make assumptions
about instruction sources.
2025-02-20 15:48:24 +01:00
Francisco Casas
153b7c8460 vkd3d-shader/hlsl: Run folding passes again after lower_nonconstant_array_loads.
This is because lower_nonconstant_array_loads() can potentially turn
nonconstant loads into constant loads, allowing copy-prop to turn these
loads into previous instructions, which might help other passes as well.

This patch lowers the number of required temps for the following ps_2_0
shader from 19 to 16:

    int i;
    float3x3 mats[4];

    float4 main() : sv_target
    {
        return mul(mats[i], float3(1, 2, 3)).xyzz;
    }
2025-02-20 15:44:09 +01:00
Francisco Casas
e60c89c532 tests: Test unused invalid samples with a static sampler. 2025-02-20 15:44:09 +01:00
Francisco Casas
321fda9c26 vkd3d-shader/hlsl: Only use the temp copy for variables that are written.
This can save a significant amount of temp registers because it allows to
avoid referencing the temp (and having to store it) when not needed.

For instance, this patch lowers the number of required temps for the
following ps_2_0 shader from 24 to 19:

    int i;
    float3x3 mats[4];

    float4 main() : sv_target
    {
        return mul(mats[i], float3(1, 2, 3)).xyzz;
    }

Also, it is needed for SM1 vertex shader relative addressing since
non-constant loads are required to be directly on the uniform ('c'
registers) instead of the temp, and non-constant loads cannot be
transformed by copy propagation.
2025-02-20 15:44:09 +01:00
Elizabeth Figura
8e6ddb0c1a vkd3d-shader/hlsl: Don't mark extern variables with an explicit first_write or last_read.
Fix the last few places that care.
2025-02-20 15:44:09 +01:00
Francisco Casas
1d74ff075e vkd3d-make/hlsl: Trace the number of registers allocated in allocate_temp_registers(). 2025-02-20 15:44:04 +01:00
Nikolay Sivov
f830ac1206 vkd3d-shader/preproc: Do not attempt to load empty included files.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-02-20 15:40:34 +01:00
Giovanni Mascellani
07b7975d09 vkd3d: Put all root descriptors in a single Vulkan descriptor set when using Vulkan heaps.
Since 4a94bfc2f6 we segregate
different D3D12 descriptor types in different Vulkan descriptor sets.
This change was introduced to reduce descriptor wasting when
allocating a new descriptor pool; that can be very useful when
using virtual heaps, which have to often cycle through many
descriptors, but it is expected to have limited impact for Vulkan
heaps, given that in that case most descriptors are allocated through
the descriptor heap rather than through the command allocator.

Instead, it has a rather detrimental effect with Vulkan heaps,
because it tends to use many more Vulkan descriptor sets than
necessary, often with just a handful of descriptors each. This
causes a regression on some Vulkan implementations that support
too few descriptor sets.

With this change we revert to a situation similar to before,
stuffing all the descriptors that do not live in a root
descriptor table in as few descriptor sets as possible (at most
one or two, depending on whether push descriptors are used).
2025-02-19 17:58:23 +01:00
Giovanni Mascellani
6415c6b0e0 vkd3d: Rename push_descriptor_set to root_descriptor_set.
Soon it won't be used necessarily for push descriptors anymore, but
it will still contain root descriptors.
2025-02-19 17:57:15 +01:00
Conor McCarthy
67d8cf744c tests/hlsl: Add a conditional 16-bit test. 2025-02-19 17:53:57 +01:00
Conor McCarthy
36f9510bb3 tests/hlsl: Add interstage interface 16-bit tests. 2025-02-19 17:52:05 +01:00
Conor McCarthy
6ee650f316 tests/hlsl: Add a typed SRV load 16-bit test. 2025-02-19 17:48:38 +01:00
Conor McCarthy
2b325d3b59 tests/hlsl: Add a TGSM 16-bit test. 2025-02-19 17:47:29 +01:00
Conor McCarthy
94b8747da4 tests/hlsl: Add a sampler 16-bit test. 2025-02-19 17:46:05 +01:00
Conor McCarthy
e355cdbae0 tests/hlsl: Add typed buffer SRV 16-bit tests. 2025-02-19 17:44:59 +01:00
Giovanni Mascellani
a7337bc999 vkd3d: Require extension VK_KHR_maintenance2.
We're already implicitly using it for image layouts in which
either depth or stencil is writeable and the other is not.
Correspondingly, add the _KHR suffix in those cases, so the
extension usage is more evident.

According to the Vulkan Hardware Database, only four reports
without this extension were filed since 2023, and all of them
for configurations we likely don't target.
2025-02-19 17:41:30 +01:00
Francisco Casas
604fe3ccee tests/test-driver: Merge the same consecutive tags togeter. 2025-02-19 17:36:19 +01:00
Francisco Casas
681b839419 tests/test-driver: Group together tags in the same line and shader model. 2025-02-19 17:36:19 +01:00
Francisco Casas
72b603780c tests/test-driver: Print the shader model for the detailed output of the hlsl backend. 2025-02-19 17:36:19 +01:00
Francisco Casas
3aecbc5ac1 vkd3d-shader/hlsl: Also dump preprocessed shaders.
This could be useful since there are many shaders that contain `#include`
directives or use parameter-defined macros and we can't reproduce bugs
from the source alone.
2025-02-19 17:34:24 +01:00
Giovanni Mascellani
665c29f0be vkd3d-shader/tpf: Allow I/O index ranges to not intersect a signature element for a given register.
The current TPF validator enforces that for each register involved
in a DCL_INDEX_RANGE instruction there must be a signature element
for that register and the DCL_INDEX_RANGE write mask. This is an
excessively strong request, and causes some shaders from The Falconeer
to be invalidly rejected.

The excessively strong check was needed to avoid triggering a bug
in the I/O normaliser. Since that bug is now solved, the check
can be relaxed.
2025-02-19 17:30:25 +01:00
Giovanni Mascellani
4b84fb486b vkd3d-shader/ir: Handle index ranges that do not touch a signature element for each register.
A good part of the I/O normaliser job is to merge together signature
elements that are spanned by DCL_INDEX_RANGE instructions. The
current algorithm assumes that each index range touches exactly
one signature element for each index spanned by the range. The
assumption is used in shader_signature_merge() in the form of
expecting that, if the index range is N registers long, then,
once you find the first signature element of an index range, the
other elements that will have to be merged with it are exactly the
following N-1 according to the order given by
signature_element_register_compare() or
signature_element_mask_compare(), depending on the signature type.

This doesn't necessarily happen. For example, The Falconeer has a
few hull shaders in which this happens:

    hs_fork_phase
    dcl_hs_fork_phase_instance_count 13
    dcl_input vForkInstanceId
    dcl_output o4.z
    dcl_output o5.z
    dcl_output o6.z
    dcl_output o7.z
    dcl_output o12.z
    dcl_output o13.z
    dcl_output o14.z
    dcl_output o15.z
    dcl_output o16.z
    dcl_output o17.z
    dcl_output o18.z
    dcl_output o19.z
    dcl_output o20.z
    dcl_temps 1
    dcl_index_range o4.z 17
    iadd r0.x, vForkInstanceId.x, l(4)
    ult r0.y, vForkInstanceId.x, l(4)
    movc r0.x, r0.y, vForkInstanceId.x, r0.x
    mov o[r0.x + 4].z, l(0)
    ret

Here the index range "skips" o8.z through o11.z, because those
registers only use mask .xy. The current algorithm fails on such
a shader.

Even depending on the signature element order doesn't look ideal.
I don't have a full counterexample for that, but it looks fragile,
especially given that the register allocation algorithm in FXC is
notoriously full of unexpected corner cases.

We solve both problems by slightly changing the architecture of
the normaliser: first we move computing the masks for the merge
signature element from signature_element_range_expand_mask(),
which is executed while merging signature, to
io_normaliser_add_index_range(), which is executed before merging
signatures. Then, while we are merging signatures, we can decide
for each single signature element whether it has to be retained
or not, and how it should be patched. The algorithm becomes
independent of the order, because each signature element can be
processed individually.
2025-02-19 17:30:00 +01:00
Giovanni Mascellani
b5350f9387 vkd3d-shader/ir: Use a structure to record range data in the I/O normaliser.
In order to make it able to have other fields.
2025-02-19 17:01:54 +01:00
Giovanni Mascellani
ec7bac7ba7 vkd3d-shader/ir: Report errors in the I/O normaliser instead of asserting.
The assumptions the I/O normaliser makes on its input program are
rather intricated. In theory the VSIR validator checks should be
strong enough, but the validator isn't run by default anyway.
Whether the TPF parser validation is strong enough is not
completely clear to me, and considering that the I/O normaliser
could end up being used on different programs as well it's
probably better to revalidate locally just in case.
2025-02-19 17:01:54 +01:00
Giovanni Mascellani
8887501042 tests: Test I/O index ranges not intersecting a signature element for a given register.
Since this test depend on the specific code generated by the
native d3dcompiler we add the possibility to specify a "raw"
shader using a hex format. When the shader assembler is finally
available they should be replaced with assembly code.
2025-02-19 17:01:17 +01:00
Giovanni Mascellani
84a59fe4c0 tests: Enable tessellation shaders in the Vulkan shader runner. 2025-02-19 16:22:04 +01:00
95 changed files with 26902 additions and 3581 deletions

View File

@@ -2,6 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = @VKD3D_CFLAGS@
AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include/private
AM_LDFLAGS = -no-undefined
VKD3D_PERL = $(PERL) -w
widl_headers = \
include/vkd3d_d3d12.h \
@@ -108,6 +109,7 @@ vkd3d_shader_tests = \
tests/hlsl/effect-compile.shader_test \
tests/hlsl/effect-initial-values-fx_2.shader_test \
tests/hlsl/effect-initial-values-fx_4.shader_test \
tests/hlsl/effect-pass-states-fx_4.shader_test \
tests/hlsl/effect-pass-states-fx_5.shader_test \
tests/hlsl/effect-shader-objects-fx_2.shader_test \
tests/hlsl/effect-shader-objects-fx_5.shader_test \
@@ -140,6 +142,7 @@ vkd3d_shader_tests = \
tests/hlsl/gather-cmp.shader_test \
tests/hlsl/gather-offset.shader_test \
tests/hlsl/gather.shader_test \
tests/hlsl/geometry-shader-syntax.shader_test \
tests/hlsl/geometry.shader_test \
tests/hlsl/get-sample-pos.shader_test \
tests/hlsl/getdimensions.shader_test \
@@ -198,6 +201,7 @@ vkd3d_shader_tests = \
tests/hlsl/object-parameters.shader_test \
tests/hlsl/object-references.shader_test \
tests/hlsl/patch-syntax.shader_test \
tests/hlsl/pixel-position.shader_test \
tests/hlsl/point-sprite.shader_test \
tests/hlsl/pointer-cast.shader_test \
tests/hlsl/pow.shader_test \
@@ -241,6 +245,7 @@ vkd3d_shader_tests = \
tests/hlsl/sqrt.shader_test \
tests/hlsl/srv-buffers.shader_test \
tests/hlsl/srv-byteaddressbuffer.shader_test \
tests/hlsl/srv-structuredbuffer.shader_test \
tests/hlsl/state-block-function-syntax.shader_test \
tests/hlsl/state-block-syntax.shader_test \
tests/hlsl/static-initializer.shader_test \
@@ -315,10 +320,12 @@ vkd3d_demos = \
vkd3d_demos_headers = \
demos/demo.h \
demos/demo_vkd3d.h \
demos/demo_win32.h \
demos/demo_xcb.h
BUILT_SOURCES = $(widl_headers) \
include/private/spirv_grammar.h \
include/private/vkd3d_version.h
noinst_LTLIBRARIES = libvkd3d-common.la
@@ -377,6 +384,7 @@ nodist_libvkd3d_shader_la_SOURCES = $(vkd3d_shader_yyfiles)
libvkd3d_shader_la_SOURCES = \
include/private/list.h \
include/private/rbtree.h \
include/private/spirv_grammar.h \
include/private/vkd3d_common.h \
include/private/vkd3d_memory.h \
include/vkd3d_shader.h \
@@ -513,7 +521,7 @@ tests_vkd3d_api_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_vkd3d_api_LDADD = libvkd3d.la @DL_LIBS@
tests_vkd3d_shader_api_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_vkd3d_shader_api_CFLAGS = $(AM_CFLAGS) @OPENGL_CFLAGS@
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la @OPENGL_LIBS@
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la @OPENGL_LIBS@ @DL_LIBS@
SHADER_TEST_LOG_COMPILER = tests/shader_runner
SHADER_TEST_LOG_DRIVER = $(srcdir)/tests/test-driver.sh
endif
@@ -578,6 +586,15 @@ libvkd3d.pc: $(srcdir)/libs/vkd3d/libvkd3d.pc.in Makefile
-e 's![@]PACKAGE_VERSION[@]!$(PACKAGE_VERSION)!g' \
$< > $@
VKD3D_V_PERL = $(vkd3d_v_perl_@AM_V@)
vkd3d_v_perl_ = $(vkd3d_v_perl_@AM_DEFAULT_V@)
vkd3d_v_perl_0 = @echo " PERL " $@;
vkd3d_v_perl_1 =
include/private/spirv_grammar.h: libs/vkd3d-shader/make_spirv include/private/spirv.core.grammar.json
@$(MKDIR_P) $(@D)
$(VKD3D_V_PERL)$(VKD3D_PERL) $^ > $@.tmp && mv $@.tmp $@
include/private/vkd3d_version.h: dummy-vkd3d-version
@$(MKDIR_P) include/private
version=`(GIT_DIR=$(top_srcdir)/.git git rev-parse --short HEAD 2>/dev/null || echo '') \
@@ -586,7 +603,7 @@ include/private/vkd3d_version.h: dummy-vkd3d-version
&& (echo $$version | cmp -s - $@) \
|| echo $$version >$@ || ($(RM) $@ && exit 1)
.SILENT: include/private/vkd3d_version.h
CLEANFILES += include/private/vkd3d_version.h
CLEANFILES += include/private/spirv_grammar.h include/private/vkd3d_version.h
.PHONY: dummy-vkd3d-version
dummy-vkd3d-version:

9
README
View File

@@ -9,7 +9,8 @@ similar, but not identical, to Direct3D 12.
Building vkd3d
==============
Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.3.228).
Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.3.228), as well as Perl
and libjson-perl.
Vkd3d generates some of its headers from IDL files. If you are using the
release tarballs, then these headers are pre-generated and are included. If
@@ -149,12 +150,6 @@ in future versions of vkd3d.
emitted; this can be useful for developers to make error conditions as
conspicuous as possible.
* VKD3D_SHADER_UNSUPPORTED_DXIL - enable DXIL (DirectX Intermediate Language)
support in vkd3d-shader, which is disabled by default because it is not
considered ready for release yet. Please note that this feature is not
currently supported, and it might change in a non-compatible way before it is
released.
* VKD3D_SHADER_UNSUPPORTED_GLSL - enable GLSL (GL Shading Language) support in
vkd3d-shader, which is disabled by default because it is not considered ready
for release yet. Please note that this feature is not currently supported,

View File

@@ -5,6 +5,7 @@ AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(include/config.h)
AC_ARG_VAR([PERL], [The Perl 5 language interpreter])
AC_ARG_VAR([WIDL], [widl IDL compiler])
AC_ARG_VAR([CROSSCC32], [32-bit Windows cross compiler])
AC_ARG_VAR([CROSSCC64], [64-bit Windows cross compiler])
@@ -32,6 +33,11 @@ AC_PROG_MKDIR_P
VKD3D_PROG_WIDL(3, 21)
AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
AC_CHECK_PROGS([PERL], [perl], [none])
AS_IF([test "$PERL" = "none"], [AC_MSG_ERROR([no suitable perl found. Please install the 'perl-base' package.])])
VKD3D_CHECK_PERL_MODULE([JSON],
[AC_MSG_ERROR([perl module 'JSON' not found. Please install the 'libjson-perl' package.])])
AC_CHECK_PROGS([FLEX], [flex], [none])
AS_IF([test "$FLEX" = "none"], [AC_MSG_ERROR([no suitable flex found. Please install the 'flex' package.])])
AC_ARG_VAR([LFLAGS], [extra flags for flex])

View File

@@ -178,5 +178,5 @@ static inline HRESULT demo_create_root_signature(ID3D12Device *device,
#include "demo_win32.h"
#else
#define INFINITE VKD3D_INFINITE
#include "demo_xcb.h"
#include "demo_vkd3d.h"
#endif

508
demos/demo_vkd3d.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -31,6 +31,8 @@ struct demo
void *user_data;
void (*idle_func)(struct demo *demo, void *user_data);
UINT (*GetDpiForSystem)(void);
};
struct demo_window
@@ -48,6 +50,11 @@ struct demo_swapchain
IDXGISwapChain3 *swapchain;
};
static inline void demo_get_dpi(struct demo *demo, double *dpi_x, double *dpi_y)
{
*dpi_x = *dpi_y = demo->GetDpiForSystem();
}
static inline struct demo_window *demo_window_create(struct demo *demo, const char *title,
unsigned int width, unsigned int height, void *user_data)
{
@@ -191,6 +198,11 @@ static inline void demo_process_events(struct demo *demo)
}
}
static inline UINT demo_GetDpiForSystem(void)
{
return 96;
}
static inline bool demo_init(struct demo *demo, void *user_data)
{
WNDCLASSEXW wc;
@@ -215,6 +227,11 @@ static inline bool demo_init(struct demo *demo, void *user_data)
demo->user_data = user_data;
demo->idle_func = NULL;
if ((demo->GetDpiForSystem = (void *)GetProcAddress(GetModuleHandleA("user32"), "GetDpiForSystem")))
SetProcessDPIAware();
else
demo->GetDpiForSystem = demo_GetDpiForSystem;
return true;
}

File diff suppressed because it is too large Load Diff

View File

@@ -849,12 +849,16 @@ static int cxg_main(void)
{
unsigned int width = 300, height = 300;
struct cx_gears cxg;
double dpi_x, dpi_y;
memset(&cxg, 0, sizeof(cxg));
if (!demo_init(&cxg.demo, &cxg))
return EXIT_FAILURE;
demo_set_idle_func(&cxg.demo, cxg_idle);
demo_get_dpi(&cxg.demo, &dpi_x, &dpi_y);
width *= dpi_x / 96.0;
height *= dpi_y / 96.0;
cxg.window = demo_window_create(&cxg.demo, "Vkd3d Gears", width, height, &cxg);
demo_window_set_key_press_func(cxg.window, cxg_key_press);
demo_window_set_expose_func(cxg.window, cxg_expose);

View File

@@ -1,3 +1,21 @@
/*
* Copyright 2016 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
cbuffer gear_block : register(b0)
{
float4x4 mvp_matrix;

View File

@@ -368,12 +368,16 @@ static int cxt_main(void)
{
unsigned int width = 640, height = 480;
struct cx_triangle cxt;
double dpi_x, dpi_y;
memset(&cxt, 0, sizeof(cxt));
if (!demo_init(&cxt.demo, NULL))
return EXIT_FAILURE;
demo_get_dpi(&cxt.demo, &dpi_x, &dpi_y);
width *= dpi_x / 96.0;
height *= dpi_y / 96.0;
cxt.window = demo_window_create(&cxt.demo, "Vkd3d Triangle", width, height, &cxt);
demo_window_set_expose_func(cxt.window, cxt_render_frame);
demo_window_set_key_press_func(cxt.window, cxt_key_press);

View File

@@ -1,3 +1,46 @@
/*
* Copyright 2016 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* This application contains code derived from Microsoft's "HelloTriangle"
* demo, the license for which follows:
*
* Copyright (c) 2015 Microsoft
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
struct ps_in
{
float4 position : SV_POSITION;

View File

@@ -12,7 +12,7 @@ mkdir build
cd build
export LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH-}"
if ../configure --enable-demos --with-spirv-tools DXCOMPILER_LIBS="-L/usr/local/lib" CFLAGS="-g -O2 -Werror" \
CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_DXIL -DVKD3D_SHADER_UNSUPPORTED_GLSL -DVKD3D_ABORT_ON_ERR" && \
CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_GLSL -DVKD3D_ABORT_ON_ERR" && \
make -j$(nproc) ; then
make -j$(nproc) AM_COLOR_TESTS=always check || \
touch ../tests_failed

View File

@@ -12,7 +12,7 @@ mkdir build
cd build
if ../configure CFLAGS="-I/opt/homebrew/opt/vulkan-headers/include -I/opt/homebrew/opt/spirv-headers/include -g -O2 -Wno-implicit-fallthrough -Wno-ignored-attributes -Wno-unknown-attributes -Wno-unused-but-set-variable -Werror" \
OBJCFLAGS="-g -O2 -Wno-unknown-attributes -Wno-ignored-attributes -Werror" \
CPPFLAGS="-DVKD3D_ABORT_ON_ERR -DVKD3D_SHADER_UNSUPPORTED_DXIL -DVKD3D_SHADER_UNSUPPORTED_MSL" \
CPPFLAGS="-DVKD3D_ABORT_ON_ERR -DVKD3D_SHADER_UNSUPPORTED_MSL" \
VULKAN_LIBS=-L/opt/homebrew/opt/vulkan-loader/lib --with-spirv-tools && \
make -j$(sysctl -n hw.ncpu) ; then
make -j$(sysctl -n hw.ncpu) AM_COLOR_TESTS=always check || \

View File

@@ -32,6 +32,7 @@ build-radv-64:
variables:
VK_LOADER_DRIVERS_SELECT: 'radeon_*'
VKD3D_SHADER_CONFIG: 'force_validation'
VKD3D_TEST_DEBUG: '1'
build-llvmpipe-64:
extends: .build-linux
@@ -41,6 +42,7 @@ build-llvmpipe-64:
variables:
VK_LOADER_DRIVERS_SELECT: 'lvp_*'
VKD3D_SHADER_CONFIG: 'force_validation'
VKD3D_TEST_DEBUG: '1'
build-radv-32:
extends: .build-linux
@@ -50,6 +52,7 @@ build-radv-32:
VK_LOADER_DRIVERS_SELECT: 'radeon_*'
CC: 'i686-linux-gnu-gcc'
VKD3D_SHADER_CONFIG: 'force_validation'
VKD3D_TEST_DEBUG: '1'
build-llvmpipe-32:
extends: .build-linux
@@ -60,6 +63,7 @@ build-llvmpipe-32:
VK_LOADER_DRIVERS_SELECT: 'lvp_*'
CC: 'i686-linux-gnu-gcc'
VKD3D_SHADER_CONFIG: 'force_validation'
VKD3D_TEST_DEBUG: '1'
build-llvmpipe-64-mesa24:
extends: .build-linux
@@ -68,6 +72,7 @@ build-llvmpipe-64-mesa24:
LD_LIBRARY_PATH: '/opt/mesa24/lib/x86_64-linux-gnu'
__EGL_VENDOR_LIBRARY_FILENAMES: '/opt/mesa24/share/glvnd/egl_vendor.d/50_mesa.json'
VKD3D_SHADER_CONFIG: 'force_validation'
VKD3D_TEST_DEBUG: '1'
build-crosstest:
stage: build
@@ -135,7 +140,6 @@ build-mac:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: winehq-sonoma-pristine
allow_failure: true
interruptible: true
needs:
- job: image-mac
@@ -154,7 +158,8 @@ build-mac:
- mkdir artifacts
- export PATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/opt/flex/bin:$PATH"
- export VK_DRIVER_FILES="$PWD/image/moltenvk/MoltenVK_icd.json"
- export SONAME_LIBDXCOMPILER="$PWD/image/dxc/libdxcompiler.dylib"
# Currently disabled because it has too many failures
#- export SONAME_LIBDXCOMPILER="$PWD/image/dxc/libdxcompiler.dylib"
- system_profiler SPSoftwareDataType SPHardwareDataType > artifacts/systeminfo.txt
- vulkaninfo > artifacts/vulkaninfo.txt
- git rebase $CI_MERGE_REQUEST_DIFF_BASE_SHA --exec ./gitlab/build-mac
@@ -163,6 +168,7 @@ build-mac:
variables:
VKD3D_DISABLE_EXTENSIONS: "VK_EXT_descriptor_indexing"
VKD3D_SHADER_CONFIG: 'force_validation'
VKD3D_TEST_DEBUG: '1'
MVK_CONFIG_LOG_LEVEL: 2
SONAME_LIBVULKAN: "/opt/homebrew/opt/vulkan-loader/lib/libvulkan.1.dylib"
WIDL: "x86_64-w64-mingw32-widl"

View File

@@ -34,7 +34,7 @@ RUN export DEBIAN_FRONTEND=noninteractive; \
doxygen doxygen-latex graphviz \
mesa-vulkan-drivers mesa-vulkan-drivers:i386 \
vulkan-tools spirv-headers \
libegl-dev libegl-dev:i386 \
libegl-dev libegl-dev:i386 libjson-perl libjson-xs-perl \
libvulkan-dev libvulkan-dev:i386 \
libncurses-dev libncurses-dev:i386 \
libopengl-dev libopengl-dev:i386 \

View File

@@ -20,12 +20,14 @@ test-win-64:
variables:
TEST_ARCH: "64"
VKD3D_TEST_SKIP_DXC: "1"
VKD3D_TEST_DEBUG: '1'
test-win-32:
extends: .test-win
variables:
TEST_ARCH: "32"
VKD3D_TEST_SKIP_DXC: "1"
VKD3D_TEST_DEBUG: '1'
test-win-64-dxc:
stage: test
@@ -37,6 +39,8 @@ test-win-64-dxc:
- job: build-crosstest
tags:
- win10-21h2
variables:
VKD3D_TEST_DEBUG: '1'
script:
- 'Invoke-WebRequest -Uri "https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.8.2407/dxc_2024_07_31.zip" -OutFile ".\dxc.zip"'
- 'Expand-Archive -Path "dxc.zip" -DestinationPath ".\dxc"'

File diff suppressed because it is too large Load Diff

View File

@@ -65,9 +65,12 @@
#define vkd3d_clamp(value, lower, upper) max(min(value, upper), lower)
#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')
#define TAG_CLI4 VKD3D_MAKE_TAG('C', 'L', 'I', '4')
#define TAG_CTAB VKD3D_MAKE_TAG('C', 'T', 'A', 'B')
#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
#define TAG_DXIL VKD3D_MAKE_TAG('D', 'X', 'I', 'L')
#define TAG_FX10 VKD3D_MAKE_TAG('F', 'X', '1', '0')
#define TAG_FXLC VKD3D_MAKE_TAG('F', 'X', 'L', 'C')
#define TAG_ISG1 VKD3D_MAKE_TAG('I', 'S', 'G', '1')
#define TAG_ISGN VKD3D_MAKE_TAG('I', 'S', 'G', 'N')
#define TAG_OSG1 VKD3D_MAKE_TAG('O', 'S', 'G', '1')

View File

@@ -43,16 +43,12 @@ static inline enum vkd3d_result vkd3d_shader_parse_dxbc_source_type(const struct
if (tag == TAG_SHDR || tag == TAG_SHEX)
{
*type = VKD3D_SHADER_SOURCE_DXBC_TPF;
#ifndef VKD3D_SHADER_UNSUPPORTED_DXIL
break;
#else
}
else if (tag == TAG_DXIL)
{
*type = VKD3D_SHADER_SOURCE_DXBC_DXIL;
/* Default to DXIL if both are present. */
break;
#endif
}
}

View File

@@ -249,6 +249,10 @@ enum vkd3d_shader_compile_option_feature_flags
* QUAD bits set.
* - supportedStages include COMPUTE and FRAGMENT. \since 1.12 */
VKD3D_SHADER_COMPILE_OPTION_FEATURE_WAVE_OPS = 0x00000004,
/** The SPIR-V target environment supports zero-initializing workgroup
* memory. This corresponds to the "shaderZeroInitializeWorkgroupMemory"
* Vulkan feature. \since 1.16 */
VKD3D_SHADER_COMPILE_OPTION_FEATURE_ZERO_INITIALIZE_WORKGROUP_MEMORY = 0x00000008,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLAGS),
};
@@ -2286,6 +2290,14 @@ enum vkd3d_shader_component_type
VKD3D_SHADER_COMPONENT_DOUBLE = 0x5,
/** 64-bit unsigned integer. \since 1.11 */
VKD3D_SHADER_COMPONENT_UINT64 = 0x6,
/** 64-bit signed integer. \since 1.16 */
VKD3D_SHADER_COMPONENT_INT64 = 0x7,
/** 16-bit IEEE floating-point. \since 1.16 */
VKD3D_SHADER_COMPONENT_FLOAT16 = 0x8,
/** 16-bit unsigned integer. \since 1.16 */
VKD3D_SHADER_COMPONENT_UINT16 = 0x9,
/** 16-bit signed integer. \since 1.16 */
VKD3D_SHADER_COMPONENT_INT16 = 0xa,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPONENT_TYPE),
};
@@ -2991,7 +3003,8 @@ VKD3D_SHADER_API void vkd3d_shader_free_scan_descriptor_info(
* signature. To retrieve signatures from other shader types, or other signature
* types, use vkd3d_shader_scan() and struct vkd3d_shader_scan_signature_info.
* This function returns the same input signature that is returned in
* struct vkd3d_shader_scan_signature_info.
* struct vkd3d_shader_scan_signature_info for dxbc-tpf shaders, but may return
* different information for dxbc-dxil shaders.
*
* \param dxbc Compiled byte code, in DXBC format.
*

Some files were not shown because too many files have changed in this diff Show More