606 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
Henri Verbeet
985d317e0e Release 1.15. 2025-02-19 12:00:00 +01:00
Henri Verbeet
872a96e599 vkd3d-shader/ir: Remove vForkInstanceId and vJoinInstanceId declarations in vsir_program_flatten_hull_shader_phases().
Commit 4717775abb removed the code turning
the corresponding DCL_INPUT instructions into NOPs, presumably because
vsir_program_remove_io_decls() now already removes them. That function
only removes the instructions though, not the declarations as such; we
now need to remove these from the "io_dcls" bitmap instead.
2025-02-19 10:44:18 +01:00
Henri Verbeet
e0df4cdc6d include: Add missing VKD3D_FORCE_32_BIT_ENUM enum elements. 2025-02-19 10:43:39 +01:00
Henri Verbeet
86462db9ed include: Add vkd3d_shader_scan_hull_shader_tessellation_info to the list of chained compilation structures. 2025-02-18 17:48:47 +01:00
Henri Verbeet
751f8b313c vkd3d-compiler: Introduce "dxbc-fx" as a source type.
Commit 949708450b introduced support for
effect binaries embedded in DXBC containers, but only when using
auto-detection to determine the source type. That's undesirable;
although auto-detection is convenient for interactive use, it's not
necessarily suitable for use in e.g. scripts. It also meant this wasn't
listed through --print-source-types.
2025-02-18 17:47:22 +01:00
Henri Verbeet
a169ae05e8 vkd3d-compiler: Store the source type as a struct source_type_info pointer. 2025-02-18 17:47:22 +01:00
Henri Verbeet
1cf6e8a85d vkd3d-compiler: Store the target type as a struct target_type_info pointer. 2025-02-18 17:47:22 +01:00
Conor McCarthy
c3555a34dc tests/hlsl: Add structured buffer UAV 16-bit tests. 2025-02-12 20:03:50 +01:00
Conor McCarthy
504bdcc8bb tests/hlsl: Add a raw buffer UAV 16-bit test. 2025-02-12 20:00:33 +01:00
Conor McCarthy
163801507c tests/hlsl: Add typed buffer UAV 16-bit tests. 2025-02-12 19:59:19 +01:00
Conor McCarthy
7ee6101291 tests/hlsl: Add GetDimensions() 16-bit tests. 2025-02-12 19:56:21 +01:00
Conor McCarthy
498e86fb86 tests/hlsl: Add constant buffer 16-bit tests. 2025-02-12 19:49:28 +01:00
Henri Verbeet
940c67f521 vkd3d: Avoid freeing the input signature twice on error paths in d3d12_pipeline_state_init_graphics().
This used to be safe enough before commit
b5ac6ac636, although that was never guaranteed
by the API.
2025-02-12 19:44:10 +01:00
Conor McCarthy
1b7340a6ed tests/hlsl: Add a numeric types 16-bit test. 2025-02-10 13:19:16 +01:00
Conor McCarthy
49a683f260 tests/hlsl: Add arithmetic float16 tests. 2025-02-10 13:19:16 +01:00
Conor McCarthy
becb749792 tests/hlsl: Add arithmetic int16 tests. 2025-02-10 13:19:16 +01:00
Conor McCarthy
2a0d49bb58 tests/hlsl: Add more arithmetic uint16 tests. 2025-02-10 13:19:16 +01:00
Elizabeth Figura
fe52e69662 vkd3d-shader/hlsl: Use a block in hlsl_normalize_binary_exprs(). 2025-02-05 13:53:53 +01:00
Elizabeth Figura
d7cd33fd88 vkd3d-shader/hlsl: Use a block in prepend_input_var_copy(). 2025-02-05 13:53:53 +01:00
Elizabeth Figura
b7d7deb983 vkd3d-shader/hlsl: Pass the block to add_zero_mipmap_level(). 2025-02-05 13:18:42 +01:00
Elizabeth Figura
602103dcf0 vkd3d-shader/hlsl: Handle error instructions in add_switch(). 2025-02-05 13:18:42 +01:00
Elizabeth Figura
fb290f3847 vkd3d-shader/hlsl: Add an add_switch() helper. 2025-02-05 13:18:42 +01:00
Shaun Ren
2f77d56b77 tests: Test signature reflection for patch inputs in hull/domain shaders. 2025-02-03 16:36:21 +01:00
Shaun Ren
ec6b4ed4ff vkd3d-shader/hlsl: Generate vsir registers from patch variable derefs. 2025-02-03 16:36:16 +01:00
Shaun Ren
3fb241d4d6 tests/shader_runner: Support the negation of tag matches. 2025-02-03 16:15:11 +01:00
Shaun Ren
2a1e3b100b vkd3d-shader/hlsl: Allocate semantic registers for patch variables. 2025-02-03 16:15:11 +01:00
Shaun Ren
2ddbc69f1a vkd3d-shader/hlsl: Declare semantics for patch variables in vsir. 2025-02-03 16:15:03 +01:00
Shaun Ren
f127f0849e vkd3d-shader/hlsl: Generate vsir signature entries for patch variables. 2025-02-03 16:04:21 +01:00
Shaun Ren
aa29d0a2e5 vkd3d-shader/tpf: Improve readability of compat mapping in sm4_sysval_semantic_from_semantic_name(). 2025-02-03 16:04:21 +01:00
Shaun Ren
29abe73918 vkd3d-shader/hlsl: Implement input semantic variable copies for patch variables.
The semantic variables from a patch parameter are split as usual, with
the difference being that the semantic variable being added is a patch
variable itself, with the type being the split variable type, and its
number of control points being equal to the original patch variable's
number of control points. It is then stored in the original patch
variable as follows:

  for (i = 0; i < n; ++i)
      patch[i][f] := <inputpatch-sem-var>[i]

where n is the number of control points of "patch", and f is the field
index in patch corresponding to "<inputpatch-sem-var>".

We use special prefixes, "inputpatch-" or "outputpatch-", when adding
the semantic patch variables, in order to distinguish them from
non-patch semantic variables of the same name.
2025-02-03 16:04:11 +01:00
Shaun Ren
f5d216835a vkd3d-shader/hlsl: Add an "is_patch_constant_func" field to struct hlsl_ctx.
In anticipation of the need for is_patch_constant_func in
sm4_generate_vsir_reg_from_deref(), in order to generate vsir
registers from InputPatch/OutputPatch dereferences.
2025-02-03 16:00:38 +01:00
Shaun Ren
0c8414c13f tests/hlsl: Test OutputPatch usage in patch constant functions. 2025-02-03 15:59:07 +01:00
Francisco Casas
0f7bb922ba tests/shader_runner: Pass the correct buffer size to swprintf() in dxc_compiler_compile_shader().
swprintf() expects the length of the buffer in WCHARs instead of bytes,
so ARRAY_SIZE() is used instead of sizeof().

This caused almost all tests to terminate abruptly with the following
message, in my machine:

*** buffer overflow detected ***: terminated
2025-02-03 15:58:19 +01:00
Elizabeth Figura
f1412e422c vkd3d-shader/hlsl: Handle error instructions in add_shader_compilation(). 2025-01-29 17:58:00 +01:00
Elizabeth Figura
fbd17266cf vkd3d-shader/hlsl: Do not abort on variable redefinition.
There is no harm in defining two variables with the same name.
2025-01-29 17:58:00 +01:00
Elizabeth Figura
e40d4a0e12 vkd3d-shader/hlsl: Factor out the error message into hlsl_add_var(). 2025-01-29 17:58:00 +01:00
Elizabeth Figura
2863d86bcc vkd3d-shader/hlsl: Do not define a separate scope for function parameters.
Remove the no longer needed code to detect redefinition in this case.
2025-01-29 17:58:00 +01:00
Elizabeth Figura
75ef230fbe tests: Add some stress tests for scope and variable definition. 2025-01-29 17:58:00 +01:00
Shaun Ren
7d1e4a40b1 tests/hlsl: Test hull shader control point function output parameters. 2025-01-29 17:53:26 +01:00
Shaun Ren
73183d33c5 tests/hlsl: Test passthrough hull shader control point function. 2025-01-29 17:52:49 +01:00
Shaun Ren
8a5559ab17 tests/hlsl: Test the syntax of InputPatch/OutputPatch variables. 2025-01-29 17:51:18 +01:00
Shaun Ren
f064a4022a vkd3d-shader/hlsl: Validate and record InputPatch/OutputPatch types. 2025-01-29 17:45:46 +01:00
Shaun Ren
f4d5e05d96 vkd3d-shader/hlsl: Parse InputPatch and OutputPatch objects. 2025-01-29 17:41:51 +01:00
Shaun Ren
32c081ba8c tests/hlsl: Test invalid const variables with no initializer. 2025-01-29 17:36:58 +01:00
Shaun Ren
a77dca528a vkd3d-shader/hlsl: Forbid declaring const variables with no initializer. 2025-01-29 17:36:58 +01:00
Elizabeth Figura
25c6d16b45 vkd3d-shader/hlsl: Use the casted value in exp(). 2025-01-28 13:14:50 +01:00
Conor McCarthy
033a0d29c5 tests/hlsl: Add some arithmetic uint16 shader tests. 2025-01-28 13:13:44 +01:00
Conor McCarthy
a5d4cbddac tests/hlsl: Pass a profile string instead of a shader type to dxc_compiler_compile_shader(). 2025-01-28 12:07:43 +01:00
Elizabeth Figura
40c225095f vkd3d-utils: Fix matrix packing precedence in D3DCompile2VKD3D().
D3DCOMPILE_PACK_MATRIX_ROW_MAJOR takes precedence over
D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR.
2025-01-27 15:00:26 +01:00
Conor McCarthy
f63254d905 vkd3d-shader/dxil: Handle SV_RenderTargetArrayIndex. 2025-01-27 14:52:28 +01:00
Conor McCarthy
a557ad0aea tests/hlsl: Add a test for SV_RenderTargetArrayIndex. 2025-01-27 14:52:28 +01:00
Elizabeth Figura
d049ea640f vkd3d-shader/hlsl: Implement broadcasts in constant folding.
Normally lower_broadcasts() takes care of this, but loop unrolling executes before other constant passes.
2025-01-27 14:48:03 +01:00
Elizabeth Figura
9065a1ee23 tests: Add another unrolling test. 2025-01-27 14:47:12 +01:00
Giovanni Mascellani
5bfcd81182 ci: Explicitly install SPIRV-Tools in the macOS CI environment. 2025-01-22 14:56:43 +01:00
Giovanni Mascellani
d36864500f vkd3d-common: Write a thread id in the log on macOS too. 2025-01-22 14:54:52 +01:00
Giovanni Mascellani
343022cdc1 vkd3d-shader/spirv: Interpret the write mask as a destination swizzle for double comparison operations.
This fixes a failure on a shader in Wild hearts.
2025-01-22 14:51:16 +01:00
Francisco Casas
4d18fb39b6 vkd3d-shader/hlsl: Don't forbid first base type cast on var assignments. 2025-01-22 14:46:02 +01:00
Francisco Casas
0a15ab702f vkd3d-shader/hlsl: Don't count cast to param type on IN as part of OUT var's lhs.
If the parameter is HLSL_STORAGE_IN, we add a cast from the arg to the
param type so that it can enter the function, however this cast should
not be considered part of the lhs on the implicit assignment that happens
if the var is also HLSL_STORAGE_OUT.
2025-01-22 14:39:20 +01:00
Francisco Casas
b55fe1950e vkd3d-shader/hlsl: Support non-size-changing lhs casts. 2025-01-22 14:38:10 +01:00
Francisco Casas
c2e224c5fb vkd3d-shader/hlsl: Delay lowering complex casts until after parse time.
While so far it has been posible to do this at parse time, this must
happen after knowing if the complex cast is on the lhs or not.

The modified tests show that before this patch we are currently
miscompiling when this happens, because a complex lhs cast is transformed
into a load, and add_assigment() just stores to the generated "cast"
temp.
2025-01-22 14:34:19 +01:00
Francisco Casas
dc37d90190 tests/hlsl: Add more function cast tests. 2025-01-22 14:29:54 +01:00
Francisco Casas
60f75cc542 tests/hlsl: Test partial assignments due to lhs casts. 2025-01-22 14:27:57 +01:00
Francisco Casas
51db232368 tests/hlsl: Add lhs cast tests. 2025-01-22 14:23:29 +01:00
Anna (navi) Figueiredo Gomes
c7b209124b vkd3d-shader/hlsl: Consider conversions across all parameters in function_compare().
For example, given two arguments, half3 and float, and two functions,
func(float, float) and func(float3, float3), fxc/d3dcompiler prefers to
widen both arguments to float3.
2025-01-22 14:18:54 +01:00
Anna (navi) Figueiredo Gomes
de57afd672 tests/hlsl: Add mixed argument size tests. 2025-01-22 14:17:17 +01:00
Elizabeth Figura
004a381d9c tests: Adjust abs.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Elizabeth Figura
e805fe3e36 tests: Adjust array-size-expr.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Elizabeth Figura
e5ec52d63b tests: Adjust array-parameters.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Elizabeth Figura
e40b191943 tests: Adjust arithmetic-int.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Elizabeth Figura
fb75c0530a tests: Adjust arithmetic-float-uniform.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Elizabeth Figura
8b4f0f348a tests: Adjust arithmetic-float.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Elizabeth Figura
5f55f5adc7 tests: Adjust angle-unit.shader_test to pass with 1.x.
Pixel shader 1.x constants must be between -1 and 1, or they will be clamped,
even constants defined in the shader.

Also mark 1.x-specific features if any.
2025-01-22 13:43:38 +01:00
Giovanni Mascellani
5b2d62e59a vkd3d: Explicitly call the appropriate waiting function in the fence worker.
Avoid using an indirect call that makes the code less clear for no
real advantage.
2025-01-21 14:09:29 +01:00
Shaun Ren
f3f2880261 vkd3d-shader/d3d-asm: Print vocp registers with subscript. 2025-01-21 14:05:21 +01:00
Shaun Ren
f0070cd595 tests: Test invalid out const parameters. 2025-01-21 14:03:44 +01:00
Shaun Ren
a9d7c65eb8 vkd3d-shader/hlsl: Forbid declaring parameters as both out and const.
Note that inout const parameters are allowed.
2025-01-21 14:03:44 +01:00
Giovanni Mascellani
22d0841412 vkd3d: Support signalling a fence once all outstanding work is submitted to Vulkan.
When the client acquires the Vulkan queue it has to ensure that
it is not submitting work before other work it depends on already
submitted through the Direct3D 12 API but currently in the internal
vkd3d queue. Currently we suggest to enqueue signalling a fence and
than wait for it before acquiring the Vulkan queue, which is
correct but excessive: it will wait not just for the work currently
in the queue to be submitted, but for it to be executed too,
introducing useless dependencies.

By adding a way to enqueue signalling a fence on the CPU side we
allow the client to wait for the currently outstanding work to
be submitted to Vulkan, but nothing more.
2025-01-21 14:02:22 +01:00
Giovanni Mascellani
bdb8291f6c vkd3d: Release queued fences when stopping the fence worker. 2025-01-21 13:45:33 +01:00
Giovanni Mascellani
ed7a846e2e vkd3d: Only call d3d12_fence_garbage_collect_vk_semaphores_locked() when using binary semaphores.
The function is specific to binary semaphores, and will unconditionally
access the "u.binary" field of struct vkd3d_signaled_semaphore.
2025-01-21 13:45:27 +01:00
Shaun Ren
4fbfb44681 vkd3d-shader/spirv: Emit the tessellator domain for domain shaders.
Commit 1ed8d907b3 inadvertently dropped
emitting the tessellator domain for domain shaders. Although Vulkan
environments allow us to write the tessellator domain from the hull
shader, the domain shader, or both, that's not generally true for OpenGL
environments.
2025-01-20 15:50:04 +01:00
Shaun Ren
802d7317cb vkd3d-shader/hlsl: Implement the InterlockedXor() intrinsic. 2025-01-20 15:42:45 +01:00
Shaun Ren
cbd504e888 vkd3d-shader/hlsl: Implement the InterlockedOr() intrinsic. 2025-01-20 15:42:45 +01:00
Shaun Ren
5b9634a7b7 vkd3d-shader/hlsl: Implement the InterlockedMin() intrinsic. 2025-01-20 15:42:43 +01:00
Shaun Ren
63fbe161f2 vkd3d-shader/hlsl: Implement the InterlockedMax() intrinsic. 2025-01-20 15:42:07 +01:00
Shaun Ren
b447fdce51 vkd3d-shader/hlsl: Implement the InterlockedExchange() intrinsic. 2025-01-20 15:41:07 +01:00
Shaun Ren
3fb47373a1 vkd3d-shader/hlsl: Implement the InterlockedCompareStore() intrinsic. 2025-01-20 15:41:07 +01:00
Shaun Ren
22ab08f4d8 vkd3d-shader/hlsl: Implement the InterlockedCompareExchange() intrinsic. 2025-01-20 15:41:07 +01:00
Shaun Ren
3b19a4aaf3 vkd3d-shader/hlsl: Implement the InterlockedAnd() intrinsic. 2025-01-20 15:41:07 +01:00
Shaun Ren
660a71ef22 vkd3d-shader/hlsl: Implement the InterlockedAdd() intrinsic. 2025-01-20 15:40:34 +01:00
Shaun Ren
5f943e9110 tests/hlsl: Add tests for valid destination types of atomic operations. 2025-01-20 15:30:54 +01:00
Shaun Ren
b3c13b443f tests/hlsl: Add tests to check the void return type of atomic ops. 2025-01-20 15:26:10 +01:00
Shaun Ren
728cf1dcfe tests/hlsl: Add tests to check the types of the value arguments of atomic ops. 2025-01-20 15:26:10 +01:00
Shaun Ren
c8b87f9bd9 tests/hlsl: Add a test for UAV InterlockedCompareExchange(). 2025-01-20 15:26:10 +01:00
Shaun Ren
24653b88f3 tests/shader_runner_gl: Bind buffer UAVs for compute shaders. 2025-01-20 15:25:56 +01:00
Shaun Ren
9fab6e4383 tests/shader_runner_gl: Add "opengl" tag. 2025-01-20 15:23:09 +01:00
Shaun Ren
31c3d46925 tests/shader_runner_vulkan: Check if create_shader_stage() fails in create_compute_pipeline(). 2025-01-20 14:59:12 +01:00
Conor McCarthy
10edcec030 vkd3d: Do not require the ALLOW_DEPTH_STENCIL flag for depth/stencil formats in GetCopyableFootprints(). 2025-01-20 14:37:13 +01:00
Conor McCarthy
e99906f05d vkd3d: Return correctly aligned depth/stencil sizes from GetCopyableFootprints(). 2025-01-20 13:59:46 +01:00
Conor McCarthy
1a4dedbc8d vkd3d: Return the correct depth/stencil plane format from GetCopyableFootprints(). 2025-01-20 13:45:16 +01:00
Giovanni Mascellani
17adde7f73 vkd3d: Describe DXGI_UNKNOWN as having one plane.
We're explicitly replacing zero with one in the only place where the
plane count being zero or one makes a difference. It also make sense:
UNKNOWN is used for buffers, which for all intents and purposes have one
plane.
2025-01-20 13:43:36 +01:00
Nikolay Sivov
a082daeb56 vkd3d-shader/hlsl: Implement the isinf() intrinsic.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-01-16 19:25:02 +01:00
Henri Verbeet
ce4f2728ba vkd3d-shader/msl: Get rid of a stray vkd3d_string_buffer_printf() in the VEC4 UINT immediate constant handling.
Uncovered by the ininf() test in the next commit. This is why we insist
on test coverage; unfortunately this one slipped through in
fd1beedc07.
2025-01-16 19:18:08 +01:00
Francisco Casas
cf19b4da49 vkd3d-shader/hlsl: Specialize lowering SM1 casts to int for vertex shaders.
Vertex shaders do not have CMP, so we use SLT and MAD.

For example, this vertex shader:

    uniform float4 f;

    void main(inout float4 pos : position, out float4 t1 : TEXCOORD1)
    {
        t1 = (int4)f;
    }

results in:

    vs_2_0
    dcl_position v0
    slt r0, c0, -c0
    frc r1, c0
    add r2, -r1, c0
    slt r1, -r1, r1
    mad oT1, r0, r1, r2
    mov oPos, v0

while we have the lower_cmp() pass, each time it is applied many
instructions are generated, so this patch introduces a specialized
version of the cast-to-int lowering for efficiency.
2025-01-16 18:48:35 +01:00
Francisco Casas
2d91bd9200 vkd3d-shader/hlsl: Properly lower casts to int for negative numbers.
While it looks complicated, it is what fxc/d3dcompiler does.

A shader as simple as:

    float4 f;

    float4 main() : sv_target
    {
        return (int4)f;
    }

results in the following instructions:

    ps_2_0
    def c1, 0, 1, 0, 0
    frc r0, c0
    cmp r1, -r0, c1.x, c1.y
    add r0, -r0, c0
    mov r2, c0
    cmp r1, r2, c1.x, r1
    add r0, r0, r1
    mov oC0, r0
2025-01-16 18:46:49 +01:00
Francisco Casas
4f7c117296 tests: Test casting negative floats to int.
Turns out we are not doing this correctly in SM1, because the rounding
should be to the number that is closer to zero and lower_casts_to_int()
doesn't do that.

A vertex shader test is added since in SM1 they must rely on the SLT
operation instead of the CMP operation.
2025-01-16 18:43:12 +01:00
Francisco Casas
efd7f2e014 vkd3d-shader/hlsl: Don't lower separate samples with texel offsets. 2025-01-14 17:59:50 +01:00
Francisco Casas
0a5955372a vkd3d-shader/hlsl: Lower separate SampleGrad() for SM1. 2025-01-14 17:59:50 +01:00
Francisco Casas
00b79cd781 tests: Test SampleGrad() on ps_3_0.
fxc compiles this method even without the backcompat option.

Furthermore, it even does it on ps_2_0 despite the fact that it maps to
a texldd instruction, which is not available on plain ps_2_0, nor ps_2_b,
only on ps_2_a and ps_3_0 according to documentation.

It is worth mentioning that the additional offset parameter is not
supported when lowering.
2025-01-14 17:59:50 +01:00
Giovanni Mascellani
c7e173a1ff vkd3d: Log the requested feature levels for D3D12_FEATURE_FEATURE_LEVELS. 2025-01-13 16:41:53 +01:00
Henri Verbeet
fb4b150f27 demos: Use the assembler to embed HLSL sources. 2025-01-13 16:39:35 +01:00
Henri Verbeet
4227858cfe vkd3d-shader/hlsl: Move RDEF generation to hlsl_codegen.c. 2025-01-10 20:03:14 +01:00
Francisco Casas
9b3b47b1b8 vkd3d-shader: Avoid left shifting signed integers. (ubsan)
Otherwise ubsan reports these errors on the bitwise.shader_test:

    libs/vkd3d-shader/hlsl_constant_ops.c:970:50: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    libs/vkd3d-shader/hlsl_constant_ops.c:970:50: runtime error: left shift of negative value -12
2025-01-10 19:51:55 +01:00
Francisco Casas
8056058aa1 vkd3d-shader: Avoid passing NULL to memset(). (ubsan)
Otherwise ubsan reports errors such as:

    libs/vkd3d-shader/spirv.c:7266:5: runtime error: null pointer passed as argument 1, which is declared to never be null
2025-01-10 19:51:55 +01:00
Francisco Casas
7b23cd4d3c vkd3d-shader: Avoid passing NULL to qsort(). (ubsan)
Otherwise ubsan reports runtime errors such as:

    libs/vkd3d-shader/ir.c:4731:5: runtime error: null pointer passed as argument 1, which is declared to never be null
2025-01-10 19:51:55 +01:00
Francisco Casas
eaf4d0bfbf vkd3d-shader: Avoid passing NULL to memcpy(). (ubsan)
Otherwise when passing "-fsanitize=undefined" to the compiler, ubsan
reports such as:

   libs/vkd3d-shader/ir.c:3794:5: runtime error: null pointer passed as argument 1, which is declared to never be null
2025-01-10 19:51:43 +01:00
Elizabeth Figura
29bac62ba2 vkd3d-shader/hlsl: Move the "dimx" and "dimy" fields to the type-specific union. 2025-01-10 19:38:13 +01:00
Elizabeth Figura
392398794f vkd3d-shader/d3dbc: Do not access the type dimensions for non-numeric types. 2025-01-10 19:24:21 +01:00
Elizabeth Figura
1ff1a51e4b vkd3d-shader/hlsl: Avoid some uses of the default case when switching over hlsl_base_type.
Since we have -Wswitch, this forces the developer to update all relevant
switches when an enum case is added.

Places where the default is just a FIXME are left alone.
2025-01-10 19:24:10 +01:00
Shaun Ren
646087d54c vkd3d-shader/hlsl: Collect together terms with constant coefficients.
We apply distributivity to applicable expressions, specifically with
the following rewrite rules:

  (x OPL a) OPR (x OPL b) -> x OPL (a OPR b)
  (y OPR (x OPL a)) OPR (x OPL b) -> y OPR (x OPL (a OPR b))
  ((x OPL a) OPR y) OPR (x OPL b) -> (x OPL (a OPR b)) OPR y
  (x OPL a) OPR ((x OPL b) OPR y) -> (x OPL (a OPR b)) OPR y
  (x OPL a) OPR (y OPR (x OPL b)) -> (x OPL (a OPR b)) OPR y

where a, b are constants.
2025-01-10 19:17:43 +01:00
Henri Verbeet
b60995b106 tests/shader_runner: Do not use skip() for shader model requirements.
Like we did before commit 067e6deee4.
These skips aren't all that interesting; it's entirely intentional that
e.g. a 2.0-3.0 run wouldn't run 4.0 shaders.
2024-12-19 21:17:05 +01:00
Henri Verbeet
45d9a097e6 vkd3d-shader/hlsl: Move sm4_free_extern_resources() to hlsl_codegen.c. 2024-12-19 21:09:32 +01:00
Henri Verbeet
b143754360 vkd3d-shader/hlsl: Move sm4_get_extern_resources() to hlsl_codegen.c. 2024-12-19 21:09:32 +01:00
Henri Verbeet
0236c480e3 vkd3d-shader/hlsl: Make sm4_get_interpolation_mode() static. 2024-12-19 21:09:32 +01:00
Giovanni Mascellani
4f7eb890ef vkd3d-shader/ir: Validate OUTCONTROLPOINT source parameters. 2024-12-19 21:06:13 +01:00
Giovanni Mascellani
495e10e93b vkd3d-shader/ir: Validate INCONTROLPOINT source parameters. 2024-12-19 21:06:13 +01:00
Giovanni Mascellani
513609ef0e vkd3d-shader/ir: Validate INPUT source parameters. 2024-12-19 21:06:13 +01:00
Giovanni Mascellani
23d4bd1dae vkd3d-shader/ir: Validate PATCHCONST source parameters using a uniform helper. 2024-12-19 21:06:13 +01:00
Giovanni Mascellani
67420aa8b6 vkd3d-shader/ir: Validate OUTPUT source parameters using a uniform helper. 2024-12-19 21:06:13 +01:00
Giovanni Mascellani
7de7025750 vkd3d-shader/ir: Disallow array signature elements for normalisation levels < SM6. 2024-12-19 21:06:13 +01:00
Giovanni Mascellani
922af42aca tests/hlsl: Add some clip/cull distance tests. 2024-12-19 20:54:56 +01:00
Anna (navi) Figueiredo Gomes
d5ed4df254 tests/shader_runner: Add a "mesa<23.3" tag. 2024-12-19 20:34:55 +01:00
Henri Verbeet
31ea11fb0e tests/shader_runner: Ignore the "backcompat" option for shader model 5.1+. 2024-12-19 12:24:02 +01:00
Elizabeth Figura
d164752efc vkd3d-shader/d3dbc: Introduce d3dbc_parse_register(). 2024-12-18 17:30:16 +01:00
Elizabeth Figura
3c53293028 vkd3d-shader/ir: Separate VKD3DSPR_OUTPUT and VKD3DSPR_TEXCRDOUT.
This simplifies the IR.
2024-12-18 17:30:16 +01:00
Elizabeth Figura
8132239ed2 vkd3d-shader/ir: Separate VKD3DSPR_ADDR and VKD3DSPR_TEXTURE.
This simplifies the IR.
2024-12-18 17:30:16 +01:00
Elizabeth Figura
0df5dea653 vkd3d-shader/d3d-asm: Define register names in a table. 2024-12-18 17:30:16 +01:00
Elizabeth Figura
65f3f56f63 vkd3d-shader/d3dbc: Normalize to a single VKD3DSPR_CONST register set when reading.
We don't need VKD3DSPR_CONST2 et al in the IR, even for disassembly.
2024-12-18 17:30:16 +01:00
Elizabeth Figura
118617916a vkd3d-shader: Explicitly translate between d3dbc and vsir register types. 2024-12-18 17:30:16 +01:00
Elizabeth Figura
dd450c526f tests/d3d12: Make the dtof test a bit more interesting. 2024-12-18 17:30:16 +01:00
Elizabeth Figura
efe686105d vkd3d-shader/spirv: Correctly implement DTOU. 2024-12-18 17:30:16 +01:00
Elizabeth Figura
4130ce5bb9 vkd3d-shader/spirv: Correctly implement DTOI. 2024-12-18 17:30:16 +01:00
Elizabeth Figura
f416713608 vkd3d-shader/spirv: Correctly implement DTOF. 2024-12-18 17:30:16 +01:00
Francisco Casas
825784322d vkd3d-shader/ir: Properly lower texldp. 2024-12-18 17:30:15 +01:00
Francisco Casas
02fc26507b tests/hlsl: Test tex2Dproj(). 2024-12-18 17:29:10 +01:00
Francisco Casas
7cc802afd7 vkd3d-shader/ir: Properly lower texldb. 2024-12-18 17:27:43 +01:00
Francisco Casas
59df26af79 vkd3d-shader/hlsl: Lower sample lods for SM1.
For SM1 the lod bias should be in src0.w.
2024-12-18 17:27:43 +01:00
Anna (navi) Figueiredo Gomes
f09ac4959e vkd3d-shader/hlsl: Implement the GatherCmp() methods. 2024-12-18 17:27:43 +01:00
Anna (navi) Figueiredo Gomes
fd8bcc188f tests/hlsl: Add GatherCmp() tests. 2024-12-18 17:27:43 +01:00
Conor McCarthy
8d479d2ea6 vkd3d-shader/dxil: Implement DX intrinsic EvalCentroid. 2024-12-18 17:27:43 +01:00
Conor McCarthy
1bb3b13c0a vkd3d-shader/dxil: Implement DX intrinsic EvalSampleIndex. 2024-12-18 17:27:43 +01:00
Giovanni Mascellani
ed552e4519 tests/hlsl: Add tests for the EvaluateAttribute*() intrinsics.
Based on earlier tests by Conor McCarthy.
2024-12-18 17:27:31 +01:00
Giovanni Mascellani
a68fd1b0de vkd3d-shader/ir: Simplify shader_register_normalise_arrayed_addressing().
The two branches do essentially the same thing, but in different
ways and each one omitting different details. In particular there
is no need to discriminate on whether the register is a relative
address, we can just copy the NULL pointer.
2024-12-17 16:44:00 +01:00
Giovanni Mascellani
3db458697e vkd3d-shader/ir: Remove a redundant assignment.
The hull shader control point normalisation pass already ensures
that output registers in the control point phase have two
indices (the control point index and the register index).
2024-12-17 16:44:00 +01:00
Henri Verbeet
e8cc288426 vkd3d-shader/hlsl: Move CTAB generation to hlsl_codegen.c. 2024-12-17 16:42:53 +01:00
Henri Verbeet
c681673993 vkd3d-shader/d3dbc: Separate writing the comment bytecode from write_sm1_uniforms().
Consistent with how D3DXFindShaderComment() allows looking up comments
by tag. This also makes it a little easier to move CTAB generation out
of d3dbc.c.
2024-12-17 16:42:53 +01:00
Giovanni Mascellani
00538c377e vkd3d-shader/ir: Validate OUTCONTROLPOINT destination parameters. 2024-12-17 16:39:32 +01:00
Giovanni Mascellani
3dc7f322cc vkd3d-shader/ir: Validate INCONTROLPOINT destination parameters. 2024-12-17 16:39:32 +01:00
Giovanni Mascellani
7d87b4e869 vkd3d-shader/ir: Validate OUTPUT destination parameters. 2024-12-17 16:39:32 +01:00
Giovanni Mascellani
b194e5dc4e vkd3d-shader/ir: Validate PATCHCONST destination parameters using a uniform helper. 2024-12-17 16:39:32 +01:00
Giovanni Mascellani
38a5c905db vkd3d-shader/ir: Validate INPUT destination parameters using a uniform helper. 2024-12-17 16:39:32 +01:00
Giovanni Mascellani
8d4b790eb2 vkd3d-shader/ir: Represent information about I/O registers with a table.
It makes the code quite longer, but also easier to read and extend
with further properties.

A (desirable) side effect of this commit is that it is checked
whether I/O register types are legal depending on the shader type
and phase, while before that was assumed.

This commit introduces enum vsir_io_reg_type and enum vsir_phase
which shadow enum vkd3d_shader_register_type and enum
vkd3d_shader_opcode, with the goal of making the data tables
smaller.
2024-12-17 16:39:32 +01:00
Elizabeth Figura
27c7776947 tests: Use fail(sm<5) instead of [require] for uav-atomics. 2024-12-17 16:37:41 +01:00
Elizabeth Figura
8fcbbfb8b1 tests/shader_runner: Test versions where the compilation result changes.
Adjust the algorithm for deciding for which profiles to test compilation.

We first ensure that if the compilation result changes (most often as the result
of a feature introduced in a specific version), we test the versions immediately
on either side of the change, to validate that vkd3d-shader is emulating the
same version behaviour.

We then ensure that we are testing at least one version from each set of sm1,
sm4, and sm6.
2024-12-17 16:35:09 +01:00
Elizabeth Figura
067e6deee4 tests/shader_runner: Test HLSL compilation in a separate pass.
Mainly in order to not waste time compile-testing the same version
more than once [as we do with e.g. the d3d11 and d3d12 runners, or
d3d12, GL, and Vulkan].
2024-12-17 16:24:00 +01:00
Elizabeth Figura
e91c07e1de tests/shader_runner: Record HLSL todo/fail state for each shader model.
When a shader fails to compile for a range of versions, we want to validate that
we are correctly implementing that behaviour. E.g. if a feature requires shader
model 5.0, we should validate that it compiles correctly with 5.0 (which we do),
but also that it *fails* to compile with 4.1 (which we do not).

The obvious and simple solution is to simply run compile tests for each version.
There are, however, at least 12 versions of HLSL up to and including 6.0, at
least 10 of which are known to introduce new features. Shader compilation takes
about 10-15% of the time that draw and dispatch does, both for native and
(currently) vkd3d. Testing every version for every shader would add a
noticeable amount of time to the tests.

In practice, the interesting versions to test for most shaders are:

* At least one from each range 1-3, 4-5, and 6. It's common enough for the
  semantics of the HLSL to differ between bytecode formats, or for features to
  be added or removed across those boundaries.

* If the shader requires a given feature, we want to test both sides of the cusp
  to ensure we're requiring the same version for the feature.

In practice this is 3 or 4 versions, which is measurably less than the 12 we'd
otherwise be running.

In order to achieve this goal of testing only the 3 or 4 interesting versions
for a shader, we need to know what version is actually required for a feature.
This is encoded in the shader itself using e.g. [pixel shader fail(sm<5)].

This patch therefore implements the first step towards this goal, namely,
determining which versions succeed and fail, so we can figure out which ones are
interesting.

We could require the test writer to specify which versions are interesting ahead
of time (e.g. "for version in 2.0 4.1 5.0 6.0") but this is both redundant (and
there are a *lot* of tests that need some feature gate) and easy for a test
writer to get wrong by missing interesting versions.
2024-12-17 16:18:21 +01:00
Elizabeth Figura
de615609dc vkd3d-shader/d3dbc: Use struct vkd3d_shader_instruction instead of struct sm1_instruction. 2024-12-16 17:11:57 +01:00
Elizabeth Figura
77ac13e6b9 vkd3d-shader/d3dbc: Use struct vkd3d_shader_src_param instead of struct sm1_src_register. 2024-12-16 17:11:57 +01:00
Elizabeth Figura
1e43088662 vkd3d-shader/d3dbc: Use struct vkd3d_shader_dst_param instead of struct sm1_dst_register. 2024-12-16 17:11:57 +01:00
Henri Verbeet
c4f69f4d3d vkd3d-shader/hlsl: Prefer overload candidates without component count widening. 2024-12-16 17:09:40 +01:00
Henri Verbeet
64bb4150f0 vkd3d-shader/hlsl: Prefer overload candidates without component type narrowing. 2024-12-16 17:09:40 +01:00
Henri Verbeet
32d432ab5e vkd3d-shader/hlsl: Prefer overload candidates with matching component types. 2024-12-16 17:09:40 +01:00
Henri Verbeet
6b8878377f vkd3d-shader/hlsl: Prefer overload candidates with matching component type classes. 2024-12-16 17:09:40 +01:00
Henri Verbeet
63fce3062e vkd3d-shader/hlsl: Prefer overload candidates without component count narrowing. 2024-12-16 17:09:40 +01:00
Henri Verbeet
cdf6100fe5 tests: Add yet more overload resolution tests. 2024-12-16 17:09:40 +01:00
Elizabeth Figura
5827197246 tests/shader_runner: Don't bother distinguishing directive substrings.
Consider ']' a terminator for any string.
2024-12-12 17:28:45 +01:00
Elizabeth Figura
830bdd0037 tests/shader_runner: Use a separate variable for shader type. 2024-12-12 17:26:49 +01:00
Elizabeth Figura
edb36c078f tests/shader_runner: Use is_todo instead of separate shader states. 2024-12-12 17:26:37 +01:00
Giovanni Mascellani
dd0ed989a1 vkd3d-shader/d3dbc: Normalise I/O register write masks when not disassembling.
Sometimes SM1-3 shaders contain write masks that exceed the
signature element masks. That happens because SM1-3 shaders do not
have a concept of signature and signature masks, and OTOH aren't
always able to express any given write mask.

In VSIR we don't want to deal with I/O register masks exceeding the
corresponding signature element mask or usage mask, because, for
instance, for higher shader models it can complicate dealing with
DCL_INDEX_RANGE. In order to have uniform rules for all shader
models we normalise masks coming from SM1-3 shaders.

We don't do that normalisation when disassembling, in order to
preserve the expected output.
2024-12-12 17:21:49 +01:00
Giovanni Mascellani
64126a00c3 vkd3d-shader/ir: Give more meaningful names to I/O normalisation levels.
The previous names "not normalised" and "fully normalised" have meanings
which are likely to change with time. OTOH including a description of the
normalisation level in the enumerant seems excessive. Relating
normalisation levels to shader model versions might be a reasonable
compromise.
2024-12-12 17:21:49 +01:00
Elizabeth Figura
09095403ac vkd3d-shader/hlsl: Store swizzles in vsir format.
The previous format matched sm1 and sm4, but if we're going to be feeding
everything through vsir, we want vsir's format.
2024-12-12 17:20:23 +01:00
Elizabeth Figura
474a0ac4e2 vkd3d-shader/hlsl: Use swizzle helpers in more places. 2024-12-12 17:11:53 +01:00
Elizabeth Figura
a905a78a96 vkd3d-shader/hlsl: Use a structure for matrix swizzles. 2024-12-12 17:11:27 +01:00
Elizabeth Figura
70e2148fcb vkd3d-shader/hlsl: Document matrix swizzles. 2024-12-12 16:56:52 +01:00
Victor Chiletto
ed6061dfae vkd3d-shader/hlsl: Drop the _ir_ infix from enum hlsl_loop_unroll_type. 2024-12-12 16:54:07 +01:00
Victor Chiletto
a1d995e740 vkd3d-shader/hlsl: Unroll loops with conditional jumps. 2024-12-12 16:54:04 +01:00
Victor Chiletto
351d58a95b vkd3d-shader/hlsl: Partially defer continue resolution.
We need 'for' iter blocks to be separate for loop unrolling.
2024-12-12 16:41:34 +01:00
Victor Chiletto
5d8448a44e vkd3d-shader/hlsl: Remove loop_unrolling_find_unrollable_loop().
Since loop unrolling doesn't clone the entire program anymore, we can
express it as a hlsl_transform_ir() transform.
2024-12-12 16:41:34 +01:00
Victor Chiletto
de3a365fea vkd3d-shader/hlsl: Do not clone the entire program for loop unrolling. 2024-12-12 16:41:34 +01:00
Victor Chiletto
0a8c4a6fa2 vkd3d-shader/hlsl: Run copy propagation incrementally during loop unrolling. 2024-12-12 16:41:34 +01:00
Victor Chiletto
6c3a60cc54 vkd3d-shader/hlsl: Constant fold casts to boolean. 2024-12-12 16:41:34 +01:00
Victor Chiletto
7bee33f948 vkd3d-shader/hlsl: Allow copy propagation to be stopped early. 2024-12-12 16:41:34 +01:00
Victor Chiletto
3cb9e8dc3b vkd3d-shader/hlsl: Explicitly track the copy propagation state stack. 2024-12-12 16:41:18 +01:00
Elizabeth Figura
77843aa837 vkd3d-shader/ir: Always initialise "*control_point_count" in vsir_signature_from_register_type().
Avoid a spurious -Wmaybe-uninitialized warning.
2024-12-11 15:33:06 +01:00
Shaun Ren
2c9cf7c78b vkd3d-shader/hlsl: Implement normalization of binary expressions.
We normalize binary expressions by attempting to group constants
together, in order to facilitate further simplification of the
expressions.

For any binary operator OP, non-constants x, y, and constants a, b, we
apply the following rewrite rules:

  a OP x -> x OP a, if OP is commutative.

  (x OP a) OP b -> x OP (a OP b), if OP is associative.

  (x OP a) OP y -> (x OP y) OP a, if OP is associative and commutative.

  x OP (y OP a) -> (x OP y) OP a, if OP is associative.

Note that we consider floating point operations to be
non-associative.
2024-12-11 15:32:22 +01:00
Francisco Casas
65b67e84a8 vkd3d-shader/tpf: Remove hlsl_ctx from tpf_compiler.
This completes the hlsl->vsir->tpf translation.
2024-12-10 15:52:52 +01:00
Francisco Casas
f22729461e vkd3d-shader/hlsl: Store hull and domain shader properties in vsir_program.
The alternative to adding the vsir_program->tess_output_primitive and
vsir_program->tess_partitioning fields would be to emit the vsir
DCL_TESSELLATOR_OUTPUT_PRIMITIVE and DCL_TESSELLATOR_PARTITIONING
instructions, like DXIL does, but I think that the preference is to store
these kind of data directly in the vsir_program.
2024-12-10 15:52:52 +01:00
Francisco Casas
347e7a396d vkd3d-shader/hlsl: Generate CTAB outside sm1_generate_vsir().
For consistency with the sm4_generate_rdef() and sm4_generate_vsir()
functions.
2024-12-10 15:52:52 +01:00
Francisco Casas
ca9bb2e089 vkd3d-shader/hlsl: Generate RDEF outside tpf_compile(). 2024-12-10 15:52:52 +01:00
Francisco Casas
ecddc39b31 vkd3d-shader/hlsl: Store SM4 constant buffer declarations in vsir program. 2024-12-10 15:52:52 +01:00
Francisco Casas
aa3a716249 vkd3d-shader/hlsl: Allow lowering separate sampler arrays on deref offset 0. 2024-12-10 15:52:52 +01:00
Francisco Casas
2c9269ac3a vkd3d-shader/hlsl: Allocate samplers by decreasing bind count in SM1. 2024-12-10 15:52:50 +01:00
Francisco Casas
455846a305 vkd3d-shader/hlsl: Support combined samplers from texture arrays. 2024-12-10 15:51:43 +01:00
Francisco Casas
3a6bf3be24 vkd3d-shader/hlsl: Lower separated samplers for SM1.
The combined sampler is created as a SAMPLER instead of a TEXTURE
because that fits all our current infrastructure. The only problem is
that in the CTAB it must appear as a Texture, so the new field
hlsl_type.is_combined_sampler is added.

Co-authored-by: Elizabeth Figura <zfigura@codeweavers.com>
2024-12-10 15:51:43 +01:00
Francisco Casas
58d318719c tests: Test sampler array allocation. 2024-12-10 15:51:34 +01:00
Francisco Casas
a0a555878f tests: Add additional sampler allocation tests for SM1. 2024-12-10 14:02:00 +01:00
Giovanni Mascellani
c1df64b3a6 vkd3d-shader/ir: Check that signature elements do not conflict with each other. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
b6a00579a2 vkd3d-shader/ir: Validate the signature element register index, for some sysvals. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
59a3a8e2d6 vkd3d-shader/ir: Validate the signature element stream index. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
db5a3197b7 vkd3d-shader/ir: Validate the register index and count for signature elements. 2024-12-09 16:11:34 +01:00
Giovanni Mascellani
267c70fa55 vkd3d-shader/ir: Check that signature element masks are left-aligned with in a DCL_INDEX_RANGE. 2024-12-09 16:10:47 +01:00
Giovanni Mascellani
703da18955 vkd3d-shader/ir: Check that the DCL_INDEX_RANGE effective mask stabilizes after one iteration. 2024-12-09 16:10:47 +01:00
Henri Verbeet
bbeecfc835 vkd3d: Drop smaller pools in d3d12_command_allocator_reset_descriptor_pool_array().
Effectively consolidating them.
2024-12-09 16:10:22 +01:00
Francisco Casas
d2feb33b47 vkd3d-shader/hlsl: Store SM4 texture declarations in the vsir program. 2024-12-09 16:09:16 +01:00
Francisco Casas
1d290bf5db vkd3d-shader/hlsl: Store SM4 sampler declarations in the vsir program.
Looking at the implementation of shader_sm4_read_dcl_sampler(), vsir
stores the resource index range both in

    vkd3d_shader_instruction.declaration.sampler.range

and in the

    vkd3d_shader_instruction.declaration.sampler.src.reg.idx[1-2]

indexes, so we do the same.

It is also worth noting that for shader models lower than 5.1, vsir
has a normalization on the ins->declaration src register indexes.
Refer to the following comment:

    /* SM5.1 places a symbol identifier in idx[0] and moves
     * other values up one slot. Normalize to SM5.1. */

on shader_sm4_read_param().

This normalization is also added to the generated vsir instructions.
2024-12-09 16:09:16 +01:00
Francisco Casas
37a61bf41a vkd3d-shader/hlsl: Store the global flags in the vsir program. 2024-12-09 16:09:16 +01:00
Francisco Casas
d3108de72a vkd3d-shader/hlsl: Store ROV feature requirement in the vsir_program. 2024-12-09 16:09:16 +01:00
Francisco Casas
d9c4a257c2 vkd3d-shader/dxbc: Parse the SFI0 ROV requirement. 2024-12-09 16:09:16 +01:00
Henri Verbeet
b484288a82 vkd3d-shader/spirv: Parse SPIR-V instructions. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
ac2901d2cb vkd3d-shader/spirv: Parse the SPIR-V instruction schema. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
9b4f5dab77 vkd3d-shader/spirv: Parse the SPIR-V id bound. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
3f548ccf9c vkd3d-shader/spirv: Parse the SPIR-V generator magic number. 2024-12-09 16:09:16 +01:00
Giovanni Mascellani
e218dae281 vkd3d-shader/spirv: Parse the SPIR-V version number. 2024-12-09 16:08:33 +01:00
Giovanni Mascellani
6cac18e395 vkd3d-shader/spirv: Parse the SPIR-V magic number. 2024-12-09 15:41:24 +01:00
Giovanni Mascellani
49fba97b0a vkd3d-shader/spirv: Introduce a SPIR-V parser. 2024-12-09 14:22:24 +01:00
Conor McCarthy
f3fac95bb6 tests/hlsl: Add int64 wave op tests. 2024-12-09 14:21:49 +01:00
Conor McCarthy
50306a8b08 tests/hlsl: Add uint64 wave op tests. 2024-12-09 14:20:28 +01:00
Conor McCarthy
f0f8bb3f36 tests/hlsl: Add float64 wave op tests. 2024-12-09 14:17:05 +01:00
Feifan He
9d4bcc951d vkd3d-shader/msl: Implement VKD3DSIH_USHR. 2024-12-05 21:26:03 +01:00
Feifan He
138e7caa03 vkd3d-shader/msl: Implement VKD3DSIH_ISHR. 2024-12-05 21:26:03 +01:00
Feifan He
5d6ed0fa30 vkd3d-shader/msl: Implement VKD3DSIH_ISHL. 2024-12-05 21:26:03 +01:00
Feifan He
a425c242a4 vkd3d-shader/msl: Implement VKD3DSIH_MAD. 2024-12-05 21:26:03 +01:00
Feifan He
8e0de82c74 vkd3d-shader/msl: Implement support for VKD3DSPDM_SATURATE modifiers. 2024-12-05 21:26:03 +01:00
Feifan He
ebf5828542 vkd3d-shader/msl: Implement VKD3DSIH_ELSE. 2024-12-05 21:25:35 +01:00
Feifan He
bbe10dcf17 vkd3d-shader/msl: Implement VKD3DSIH_NOT. 2024-12-05 21:13:29 +01:00
Giovanni Mascellani
74fa51d57c vkd3d-shader/ir: Check that DCL_INDEX_RANGE ranges do not overlap with unrelated signature elements. 2024-12-05 21:06:31 +01:00
Giovanni Mascellani
aae0a74d60 vkd3d-shader/ir: Validate the DCL_INDEX_RANGE instruction. 2024-12-05 21:06:31 +01:00
Giovanni Mascellani
38c53dca08 vkd3d-shader/ir: Introduce a helper function to determine the signature for a register type. 2024-12-05 21:05:50 +01:00
Giovanni Mascellani
b5e1c45827 vkd3d-shader/ir: Validate the register type for registers used as relative addresses. 2024-12-05 21:00:43 +01:00
Giovanni Mascellani
abf7a91834 vkd3d-shader/ir: Validate the array index when it is statically known. 2024-12-05 21:00:43 +01:00
Giovanni Mascellani
239c88e8d3 vkd3d: Do not use more than a few million descriptors in Vulkan heap set layouts.
Currently, when using Vulkan heaps, we create descriptor set
layouts with as many descriptors as allowed by the Vulkan
implementation limits. For some implementations this can mean
hundreds of millions of descriptors or more, which is wasteful,
given that even on the best resource binding tier Direct3D 12
applications should not expect to have more than a million usable
descriptors.

Recently this began being a problem, because since Mesa 24.2.7
the Intel driver advertises more than 200 million descriptors,
but pipeline compilation takes linear RAM in the number of
descriptors declared in the pipeline layout. This means that
compiling even a simple shader requires 10-20 GB of RAM.

In order to avoid using too much memory, with this commit we clamp
the number of descriptors declared in the set layouts to how many
we actually need to guarantee tier 3 resource binding support.
2024-12-05 21:00:03 +01:00
Conor McCarthy
a43f6a6600 vkd3d: Create descriptor pools of geometrically increasing size.
Creating a pool of 16k descriptors is wasteful if an allocator only uses
a fraction of them, so start at 1k and double for each subsequent
allocation until 16k is reached.
2024-12-05 20:54:45 +01:00
Conor McCarthy
e729ceeb1a vkd3d: Create separate descriptor pools for each vkd3d descriptor type.
Now that our Vulkan descriptor sets contain only a single vkd3d
descriptor type, we're able to create descriptor pools containing only a
single vkd3d descriptor type as well. This avoids wasting unallocated
descriptors of one type when we run out of descriptors of another type.
2024-12-05 20:54:45 +01:00
Henri Verbeet
a97c7c1fda vkd3d: Introduce d3d12_descriptor_set_layout_init(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
19c6df1adb vkd3d: Introduce vkd3d_vk_descriptor_pool_array_destroy_pools(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
8dc9fe725a vkd3d: Introduce vkd3d_vk_descriptor_pool_array_pop(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
9d46a1863b vkd3d: Introduce vkd3d_vk_descriptor_pool_array_push(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
7c0ce25bb7 vkd3d: Introduce vkd3d_vk_descriptor_pool_array_push_array(). 2024-12-05 20:54:45 +01:00
Conor McCarthy
3c620e88a0 vkd3d: Introduce struct vkd3d_vk_descriptor_pool_array. 2024-12-05 20:54:45 +01:00
Conor McCarthy
4a94bfc2f6 vkd3d: Store only a single vkd3d descriptor type in each Vulkan descriptor set.
We currently create statically sized descriptor pools, shared among
different descriptor types. Once we're unable to allocate a descriptor
set from a pool, we create a new pool. The unfortunate but predictable
consequence is that when we run out of descriptors of one type, we waste
any unallocated descriptors of the other types.

Dynamically adjusting the pool sizes could mitigate the issue, but it
seems non-trivial to handle all the edge cases, particularly in
situations where the descriptor count ratios change significantly
between frames. Instead, by storing only a single vkd3d descriptor type
in each Vulkan descriptor set we're able to create separate descriptor
pools for each vkd3d descriptor type, which also avoids the issue.

The main drawback of using separate descriptor sets for each descriptor
type is that we can no longer pack all bounded descriptor ranges into a
single descriptor set, potentially leaving fewer descriptor sets
available for unbounded ranges. That seems worth it, but we may end up
having to switch to a more complicated strategy if this ends up being a
problem on Vulkan implementations with a very limited number of
available descriptor sets.
2024-12-05 20:54:45 +01:00
Elizabeth Figura
01117c716d vkd3d-shader/hlsl: Remove unused expr ops.
These correspond to specific SM1 opcodes which we don't use (and which the native compiler never uses either).
2024-12-04 14:38:32 +01:00
Elizabeth Figura
a3c74fd429 tests: Add a reflection test for shader model 4.0. 2024-12-04 14:37:33 +01:00
Giovanni Mascellani
82963035e9 vkd3d-shader/ir: Validate the control point index when it is statically known. 2024-12-04 14:36:36 +01:00
Feifan He
a06e664730 vkd3d-shader/msl: Implement VKD3DSIH_RSQ. 2024-12-04 14:26:20 +01:00
Feifan He
bc67f2eb75 vkd3d-shader/msl: Implement VKD3DSIH_MIN. 2024-12-04 14:26:20 +01:00
Feifan He
ab2cb43e15 vkd3d-shader/msl: Implement VKD3DSIH_MAX. 2024-12-04 14:26:20 +01:00
Feifan He
64ea033c81 vkd3d-shader/msl: Implement VKD3DSIH_LOG. 2024-12-04 14:26:20 +01:00
Feifan He
b1e6dbe83f vkd3d-shader/msl: Handle SV_IS_FRONT_FACE inputs. 2024-12-04 14:26:20 +01:00
Feifan He
568296c88f vkd3d-shader/msl: Implement VKD3DSIH_ROUND_NE. 2024-12-04 14:26:20 +01:00
Feifan He
610a11ddf8 vkd3d-shader/msl: Implement VKD3DSIH_IF and VKD3DSIH_ENDIF. 2024-12-04 14:26:20 +01:00
Feifan He
28068c9d4c vkd3d-shader/msl: Implement VKD3DSIH_ROUND_NI. 2024-12-04 14:26:20 +01:00
Elizabeth Figura
36fda8e28c vkd3d-shader: Correct the disassembly for POSITIONT. 2024-12-03 14:49:02 +01:00
Elizabeth Figura
3d6f836801 vkd3d-shader: Fix the disassembly names of IFC and BREAKC. 2024-12-03 14:49:02 +01:00
Elizabeth Figura
7a7dc4bf0e vkd3d-shader/d3dbc: Mark some more instructions as version-limited. 2024-12-03 14:47:00 +01:00
Elizabeth Figura
e2961a2e3c vkd3d-shader/d3dbc: Omit unnecessary instruction maximum versions. 2024-12-03 14:47:00 +01:00
Feifan He
a81a9fb7bc vkd3d-shader/msl: Implement VKD3DSIH_LTO. 2024-12-03 14:44:32 +01:00
Feifan He
24753747a1 vkd3d-shader/msl: Implement VKD3DSIH_EXP. 2024-12-03 14:44:32 +01:00
Feifan He
ac897781ba vkd3d-shader/msl: Implement VKD3DSIH_IEQ. 2024-12-03 14:44:32 +01:00
Feifan He
67dd1d2b0c vkd3d-shader/msl: Handle the VKD3DSIM_LINEAR interpolation modifier on inputs. 2024-12-03 14:42:49 +01:00
Feifan He
8ae6a04561 vkd3d-shader/msl: Implement VKD3DSIH_SQRT. 2024-12-03 14:42:27 +01:00
Feifan He
77ed788a60 vkd3d-shader/msl: Implement VKD3DSIH_DP2. 2024-12-03 14:42:27 +01:00
Feifan He
6f7ee57e29 vkd3d-shader/msl: Implement VKD3DSIH_DP4. 2024-12-03 14:42:27 +01:00
Feifan He
046e9b5286 vkd3d-shader/msl: Implement VKD3DSIH_DP3. 2024-12-03 14:42:19 +01:00
Henri Verbeet
74365417ac vkd3d-shader/hlsl: Output the candidates for ambiguous function calls. 2024-12-03 14:38:33 +01:00
Henri Verbeet
4ca4dc0b2a vkd3d-shader/hlsl: Introduce hlsl_dump_ir_function_decl(). 2024-12-03 14:38:33 +01:00
Henri Verbeet
0b726e4408 vkd3d-shader/hlsl: Introduce hlsl_dump_type(). 2024-12-03 14:38:33 +01:00
Henri Verbeet
d0e4331640 vkd3d-shader/hlsl: Use hlsl_error() instead of hlsl_fixme() for ambiguous function calls.
This changes the return code, and some tests start passing as a result.
2024-12-03 14:38:33 +01:00
Giovanni Mascellani
1c93d706d7 vkd3d-shader/ir: Merge removing I/O declarations in the general instruction lowering pass. 2024-12-03 14:36:13 +01:00
Giovanni Mascellani
4717775abb vkd3d-shader/ir: Remove I/O declarations before flattening hull shader phases. 2024-12-03 14:19:50 +01:00
Giovanni Mascellani
4ef946287c vkd3d-shader/ir: Remove I/O declarations before normalising hull shader control point I/O. 2024-12-03 14:19:50 +01:00
Giovanni Mascellani
66382f0d68 vkd3d-shader/ir: Remove I/O declarations before I/O normalisation. 2024-12-03 14:19:50 +01:00
Giovanni Mascellani
18e422dfe4 vkd3d-shader/ir: Encode I/O declarations in vsir_program.
Most I/O registers are already described by the shader signatures.
The registers that are not do not have any property other then
being used by the program or not, so they can be collectively
described with a bitmap.
2024-12-03 14:19:24 +01:00
Giovanni Mascellani
a92b602b33 vkd3d-shader/spirv: Merge emitting input and output registers.
The register storage class is now represented in
vkd3d_register_builtins, so the spirv_compiler_emit_io_register()
doesn't need to know it from the caller.
2024-12-03 13:48:39 +01:00
Elizabeth Figura
8bc9e15618 vkd3d-shader/hlsl: Translate invalid implicit-size arrays to an error type.
Instead of returning nonsense (such as, currently, a type with zero size).
In practice this improves error reporting for shaders such as the following:

void func(float x[])
{
    float y[] = {x};
}

Currently this outputs a nonsense

test.hlsl:1:19: E5002: Implicit size arrays not allowed in function parameters.
test.hlsl:3:7: E5002: Implicit size arrays need to be initialized.

With this patch the second warning is removed.
2024-12-03 12:39:27 +01:00
Elizabeth Figura
e060b47330 vkd3d-shader/hlsl: Return an error expression when a function is used as a variable. 2024-12-03 12:39:27 +01:00
Elizabeth Figura
c553c45f00 vkd3d-shader/hlsl: Move the numeric type check to add_constructor(). 2024-12-03 12:39:27 +01:00
Elizabeth Figura
97eac342d3 vkd3d-shader/hlsl: Do not abort parsing when invalid modifiers are used. 2024-12-03 12:39:27 +01:00
Elizabeth Figura
9c70348b39 vkd3d-shader/hlsl: Do not abort when modifying a const expression. 2024-12-03 12:39:27 +01:00
Giovanni Mascellani
3264378fa0 tests: Print the file name instead of the test name in test logs.
Some test programs, particularly the shader runner, are built from
many different files nowadays, and a line number is relatively
cumbersome to use if you don't know which file that line comes from.
2024-12-03 12:38:26 +01:00
Giovanni Mascellani
73be28a252 tests: Use plain skip() when skipping a test in the shader runner.
The context already gives the location in the .shader_test file.
2024-12-03 12:38:26 +01:00
Henri Verbeet
39cbef9e01 tests: Get rid of some redundant "glsl" todo's.
These are redundant either because we already have a broader tag like
"sm<6", or because the tests are never executed with the GLSL runner in
the first place.
2024-12-02 17:13:17 +01:00
Elizabeth Figura
d56601c8d0 vkd3d-shader/ir: Implement exponential fog. 2024-12-02 17:12:20 +01:00
Elizabeth Figura
1fbbc82f3a vkd3d-shader/ir: Allow controlling the fog source through a parameter. 2024-12-02 17:12:16 +01:00
Elizabeth Figura
fc98cb482f vkd3d-shader/ir: Add a couple of traces for signature remapping. 2024-12-02 17:12:13 +01:00
Elizabeth Figura
f86d1e72a4 vkd3d-shader/ir: Allow controlling fog through parameters.
Fog requires several parameters to even implement the most basic of
functionality correctly, so this commit is relatively large.
2024-12-02 17:12:06 +01:00
Elizabeth Figura
a1de406de4 vkd3d-shader/spirv: Handle SSA registers in spirv_compiler_get_register_info().
Instead of in spirv_compiler_emit_load_reg(). This allows arbitrary swizzles to
work and reduces the amount of duplicated code.
2024-12-02 17:08:43 +01:00
Feifan He
7d2819249b vkd3d-shader/msl: Implement support for the VKD3DSPR_DEPTHOUT register. 2024-11-30 14:25:10 +01:00
Feifan He
b7203b0bbe tests/shader_runner_metal: Implement clears. 2024-11-30 14:14:26 +01:00
Feifan He
004a6d3055 tests/shader_runner_metal: Implement depth texture and state. 2024-11-30 14:12:21 +01:00
Nikolay Sivov
949708450b vkd3d-compiler: Support fx_4_0 sources embedded in DXBC containers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-30 14:03:50 +01:00
Feifan He
9619582d1b vkd3d-shader/msl: Implement VKD3DSIH_ROUND_Z. 2024-11-27 14:00:51 +01:00
Feifan He
778382cd94 vkd3d-shader/msl: Implement VKD3DSIH_ROUND_PI. 2024-11-27 14:00:51 +01:00
Feifan He
a7ae6404de vkd3d-shader/msl: Implement VKD3DSIH_FTOU. 2024-11-27 14:00:51 +01:00
Feifan He
9fd7f4f1ec vkd3d-shader/msl: Implement VKD3DSIH_UTOF. 2024-11-27 14:00:51 +01:00
Feifan He
ffbade9ed1 vkd3d-shader/msl: Implement VKD3DSIH_FTOI. 2024-11-27 14:00:50 +01:00
Feifan He
16409569fd vkd3d-shader/msl: Implement VKD3DSIH_ITOF. 2024-11-27 14:00:50 +01:00
Giovanni Mascellani
9e0c02a0ea vkd3d-shader/ir: Evaluate OUTCONTROLPOINT usage in the patch constant phase directly.
Instead of using DCL_INPUT.

The main goal here is to eventually get rid of the I/O
declaration instructions. A positive side effect is that we don't
add a useless barrier to shaders which have a DCL_INPUT instruction
in the patch constant phase but don't actually read OUTCONTROLPOINT
registers.
2024-11-27 13:59:39 +01:00
Giovanni Mascellani
1cfe23569c vkd3d-shader/ir: Synthesize the default control point phase in the HS control point I/O normaliser.
This makes it available to all backends, without requiring an
ad-hoc solution for each of them. It also gets rid of an
undocumented flag we're currently passing to
DCL_CONTROL_POINT_PHASE.
2024-11-27 13:57:09 +01:00
Francisco Casas
198c3dc7b9 vkd3d-shader/hlsl: Remove hlsl_ir_vsir_instruction_ref, again. 2024-11-27 13:03:15 +01:00
Francisco Casas
d6d6f37578 vkd3d-shader/hlsl: Migrate SM4 control flow instructions to the vsir program.
Translate the instructions that contain hlsl_blocks. Also move
other control flow instructions such as HS_CONTROL_POINT_PHASE and
RET to the vsir_program so that we can directly iterate over it now.
2024-11-27 13:02:53 +01:00
Francisco Casas
81fa4d45b9 vkd3d-shader/tpf: Apply extra bits to all conditional ops. 2024-11-27 12:54:27 +01:00
Francisco Casas
28ad600b43 vkd3d-shader/hlsl: Store SM4 jumps in the vsir program. 2024-11-27 12:54:15 +01:00
Giovanni Mascellani
2c3a7b0dd9 vkd3d-shader/ir: Validate the register type for DCL_OUTPUT_SIV instructions. 2024-11-25 20:51:29 +01:00
Giovanni Mascellani
3832e38ce0 vkd3d-shader/ir: Validate the register type for DCL_OUTPUT instructions. 2024-11-25 20:51:25 +01:00
Giovanni Mascellani
e7770eaaf6 vkd3d-shader/ir: Validate the register type for DCL_INPUT_PS_SGV instructions. 2024-11-25 20:48:39 +01:00
Giovanni Mascellani
1d9862261f vkd3d-shader/ir: Validate the register type for DCL_INPUT_PS_SIV instructions. 2024-11-25 20:48:39 +01:00
Giovanni Mascellani
09ede1e7f2 vkd3d-shader/ir: Validate the register type for DCL_INPUT_PS instructions. 2024-11-25 20:48:39 +01:00
Giovanni Mascellani
31f6b18c84 vkd3d-shader/ir: Validate the register type for DCL_INPUT_SGV instructions. 2024-11-25 20:48:39 +01:00
Giovanni Mascellani
fadaa69b92 vkd3d-shader/ir: Validate the register type for DCL_INPUT_SIV instructions. 2024-11-25 20:48:39 +01:00
Giovanni Mascellani
b007b1dd79 vkd3d-shader/ir: Validate the register type for DCL_INPUT instructions. 2024-11-25 20:48:39 +01:00
Giovanni Mascellani
a8c5f9e667 vkd3d-shader/dxil: Emit register SAMPLEMASK for output sysval SV_Coverage. 2024-11-25 20:47:24 +01:00
Giovanni Mascellani
c22812e20b vkd3d-shader/ir: Validate index count for OUTSTENCILREF registers. 2024-11-25 20:45:44 +01:00
Giovanni Mascellani
e367dc0783 vkd3d-shader/ir: Validate index count for WAVELANEINDEX registers. 2024-11-25 20:45:44 +01:00
Giovanni Mascellani
5b04a7973b vkd3d-shader/ir: Validate index count for WAVELANECOUNT registers. 2024-11-25 20:45:44 +01:00
Giovanni Mascellani
820a545950 vkd3d-shader/ir: Validate index count for GSINSTID registers. 2024-11-25 20:45:44 +01:00
Giovanni Mascellani
07b31761fb vkd3d-shader/ir: Validate index count for SAMPLEMASK registers. 2024-11-25 20:45:44 +01:00
Giovanni Mascellani
9f3bbad6bc vkd3d-shader/ir: Validate index count for COVERAGE registers. 2024-11-25 20:45:44 +01:00
Feifan He
71ce43313f vkd3d-shader/msl: Implement VKD3DSIH_MOVC. 2024-11-25 20:43:13 +01:00
Feifan He
32a507ace6 vkd3d-shader/msl: Implement VKD3DSIH_FRC. 2024-11-25 20:43:13 +01:00
Feifan He
154847c696 vkd3d-shader/msl: Implement VKD3DSIH_GEO. 2024-11-25 20:43:13 +01:00
Feifan He
38d7f8415d vkd3d-shader/msl: Implement support for VKD3DSPSM_NEG modifiers. 2024-11-25 20:43:13 +01:00
Feifan He
64ea19b7f7 vkd3d-shader/msl: Implement VKD3DSIH_DIV. 2024-11-25 20:43:13 +01:00
Feifan He
b7605f1c34 vkd3d-shader/msl: Implement VKD3DSIH_OR. 2024-11-25 20:43:13 +01:00
Feifan He
f2a32589ea vkd3d-shader/msl: Implement VKD3DSIH_INE. 2024-11-25 20:43:13 +01:00
Feifan He
a2d56c8bfc vkd3d-shader/msl: Implement VKD3DSIH_MUL. 2024-11-25 20:43:13 +01:00
Francisco Casas
4f549155c5 vkd3d-shader/hlsl: Store SM4 HLSL_RESOURCE_RESINFOs in the vsir program. 2024-11-24 00:01:03 +01:00
Francisco Casas
c89f503604 vkd3d-shader/hlsl: Store SM4 HLSL_RESOURCE_SAMPLE_INFOs in the vsir program. 2024-11-24 00:00:46 +01:00
Francisco Casas
4382af6e1b vkd3d-shader/hlsl: Store SM4 HLSL_RESOURCE_GATHERs in the vsir program. 2024-11-23 23:55:07 +01:00
Francisco Casas
42ce821603 vkd3d-shader/hlsl: Store SM4 HLSL_RESOURCE_SAMPLEs in the vsir program. 2024-11-23 23:52:24 +01:00
Francisco Casas
52b81f42eb vkd3d-shader/hlsl: Store SM4 HLSL_RESOURCE_LOADs in the vsir program. 2024-11-23 23:49:57 +01:00
Feifan He
fd1beedc07 vkd3d-shader/msl: Implement support for VSIR_DIMENSION_VEC4 immediate constants. 2024-11-23 23:43:42 +01:00
Feifan He
68d7470fc2 vkd3d-shader/msl: Implement VKD3DSIH_NEU. 2024-11-23 23:43:42 +01:00
Feifan He
65b0e13a1a vkd3d-shader/msl: Implement VKD3DSIH_AND. 2024-11-23 23:43:42 +01:00
Feifan He
4add058cd8 vkd3d-shader/msl: Implement support for VKD3DSPSM_ABS modifiers. 2024-11-23 23:43:42 +01:00
Feifan He
5bb7dcaba3 vkd3d-shader/msl: Implement support for VKD3DSPR_IMMCONST registers. 2024-11-23 23:43:42 +01:00
Feifan He
05b9331d0d vkd3d-shader/msl: Implement VKD3DSIH_ADD. 2024-11-23 23:43:42 +01:00
Nikolay Sivov
b314a9eb84 vkd3d-shader/fx: Remove newlines from the parser error messages.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-23 23:24:05 +01:00
Nikolay Sivov
3784919213 vkd3d-shader/fx: Implement parsing inline shader blobs.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-23 23:21:39 +01:00
Giovanni Mascellani
0f362ab720 vkd3d-shader/ir: Check that tessellation system value registers are consecutive. 2024-11-23 23:19:57 +01:00
Giovanni Mascellani
5894e79064 vkd3d-shader/ir: Check that all tessellation system values appear in the patch constant signature. 2024-11-23 23:19:57 +01:00
Giovanni Mascellani
0245d22c83 vkd3d-shader/ir: Validate index count for LOCALTHREADINDEX registers. 2024-11-23 23:15:40 +01:00
Giovanni Mascellani
050840f493 vkd3d-shader/ir: Validate index count for LOCALTHREADID registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
595fe9a7aa vkd3d-shader/ir: Validate index count for THREADGROUPID registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
fd9da5db2d vkd3d-shader/ir: Validate index count for THREADID registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
26251d02a9 vkd3d-shader/ir: Validate index count for TESSCOORD registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
f2659c14a2 vkd3d-shader/ir: Validate index count for JOININSTID registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
808b28b425 vkd3d-shader/ir: Validate index count for FORKINSTID registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
860bb59c89 vkd3d-shader/ir: Validate index count for OUTPOINTID registers. 2024-11-23 23:15:39 +01:00
Giovanni Mascellani
0c3c4e0563 vkd3d-shader/ir: Validate index count for PRIMID registers. 2024-11-23 23:15:39 +01:00
Francisco Casas
64bc0515e0 vkd3d-shader/hlsl: Add special allocation rules for FFACE and SAMPLE. 2024-11-23 23:13:13 +01:00
Francisco Casas
2c15015ec2 tests: Test allocation rules for FFACE and SAMPLE.
These seem to have their own interpolation mode.
2024-11-23 23:10:56 +01:00
Francisco Casas
ad5377f995 vkd3d-shader/hlsl: Add special allocation rules for PRIMID, RTINDEX, and VPINDEX.
These system values are bound to the same allocation rules as other
semantics: they can share registers with other semantics with the same
interpolation mode and they prefer forming shorter writemasks. However,
for some reason, these don't allow further semantics to share the same
register once allocated, except among themselves.
2024-11-23 23:10:46 +01:00
Francisco Casas
2c0773c9ad tests: Test signature reflection for PRIMID, RTINDEX and VPINDEX. 2024-11-23 22:57:23 +01:00
Giovanni Mascellani
e383834049 vkd3d-shader/ir: Check that tessellation system values only appear in the patch constant signature. 2024-11-21 19:28:46 +01:00
Giovanni Mascellani
018f3e8094 vkd3d-shader/ir: Validate tessellation system values for the given tessellator domain. 2024-11-21 19:28:46 +01:00
Giovanni Mascellani
1ed8d907b3 vkd3d-shader/ir: Keep track of the tessellator domain in struct vsir_program. 2024-11-21 19:28:46 +01:00
Giovanni Mascellani
49ec9add38 vkd3d-shader/ir: Check that semantic indices for tessellation system values are not duplicated. 2024-11-21 19:28:46 +01:00
Giovanni Mascellani
8d8de1db10 vkd3d-shader/ir: Validate the semantic index for tessellation system values. 2024-11-21 19:28:46 +01:00
Anna (navi) Figueiredo Gomes
9f3bbab2f0 vkd3d-shader/hlsl: Implement cast from bool to int for SM1. 2024-11-21 19:28:46 +01:00
Nikolay Sivov
1a6409cd5b vkd3d-shader/hlsl: Add parser support for stream-output object types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-21 19:28:46 +01:00
Francisco Casas
13dfccc1c6 vkd3d-shader/hlsl: Store SM4 resource stores in the vsir program. 2024-11-21 19:28:46 +01:00
Francisco Casas
5b4af411f5 vkd3d-shader/hlsl: Store SM4 loads in the vsir program. 2024-11-21 19:28:46 +01:00
Francisco Casas
874ca85a95 vkd3d-shader/hlsl: Store SM4 stores in the vsir program. 2024-11-21 19:28:46 +01:00
Francisco Casas
5dedcff665 vkd3d-shader/tpf: Remove HLSL_IR_SWIZZLE handling. 2024-11-21 19:28:46 +01:00
Shaun Ren
843fc980b5 tests/shader_runner_gl: Implement tessellation support. 2024-11-21 19:27:51 +01:00
Shaun Ren
12ac1dd46b tests/shader_runner_vulkan: Enable patch list topology support. 2024-11-21 15:11:02 +01:00
Shaun Ren
e20b63c55e vkd3d-shader: Implement scanning hull shader tessellation information. 2024-11-21 15:03:02 +01:00
Shaun Ren
1f4d17a4a2 vkd3d-shader/dxil: Allow zero domain input control point count. 2024-11-21 14:56:23 +01:00
Victor Chiletto
3669763835 tests: Add more function overloading tests. 2024-11-21 14:52:17 +01:00
257 changed files with 44946 additions and 11457 deletions

1278
ANNOUNCE

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
Copyright 2016-2024 the Vkd3d project authors (see the file AUTHORS for a
Copyright 2016-2025 the Vkd3d project authors (see the file AUTHORS for a
complete list)
Vkd3d is free software; you can redistribute it and/or modify it under

View File

@@ -1,3 +1,89 @@
# What's new in vkd3d 1.15 (19 February 2025)
### libvkd3d
- New interfaces:
- vkd3d_queue_signal_on_cpu() allows a Direct3D 12 fence to be signalled
when all preceding work on a Direct3D 12 command queue has been submitted
to the corresponding Vulkan queue.
### libvkd3d-shader
- New features for the HLSL source type:
- InputPatch and OutputPatch tessellation shader objects. This was the
main feature required by most tessellation shaders that was still missing,
and tessellation shaders should be considered generally usable now.
- Unrolling of loops containing conditional jumps.
- Improved function overload resolution. Previously the compiler was unable
to decide between multiple function overloads with the same number of
parameters.
- The parser is able to continue parsing in a larger number of error cases.
This allows more issues in the input to be reported during a single
compilaton attempt.
- The following intrinsic functions are supported:
- GatherCmp()
- GatherCmpAlpha(), GatherCmpBlue(), GatherCmpGreen(), and GatherCmpRed()
- InterlockedAdd(), InterlockedAnd(), InterlockedCompareExchange(),
InterlockedCompareStore(), InterlockedExchange(), InterlockedMax(),
InterlockedMin(), InterlockedOr(), and InterlockedXor()
- isinf()
- Separate resource and sampler support for shader model 1-3 target
profiles.
- Casts on the left hand side of assignments.
- Reassociation and redistribution of constants in binary expressions, to
facilitate constant folding.
- Packing of interstage I/O variables with the SV_IsFrontFace,
SV_PrimitiveID, SV_RenderTargetArrayIndex, SV_SampleIndex, and
SV_ViewPortArrayIndex semantics matches d3dcompiler/fxc more closely.
- Parser support for the LineStream, PointStream, and TriangleStream
Stream-Output objects.
- A number of instructions have been implemented for the experimental MSL
target. Although more and more shaders are starting to work, support is
still fairly limited. For example, shader resource views and unordered
access views are still entirely unsupported.
- Shader code generation for fixed-function fog. Like the existing shader code
generation for other fixed-function features, this is mainly relevant for
executing shader model 1-3 sources in modern target environments like
Vulkan.
- The fx parser can parse binary effects containing inline shader blobs.
- Internal validator support for validating I/O signatures, as well as I/O
source and destination parameters. The validator is enabled by the
force_validation option, specified through the VKD3D_SHADER_CONFIG
environment variable.
- Internal validator support for validating the number of indices used with a
register, as well as basic bounds checking for static indices.
- New interfaces:
- The vkd3d_shader_scan_hull_shader_tessellation_info structure extends the
vkd3d_shader_compile_info structure, and can be used to retrieve the
output primitive type and partitioning mode used by a hull shader. This
information is particularly useful for specifying
vkd3d_shader_spirv_domain_shader_target_info structures when targetting
SPIR-V in OpenGL environments.
- The VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE shader parameter
specifies the kind of fog to generate in a fragment shader.
- The VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR shader parameter
specifies the fog colour.
- The VKD3D_SHADER_PARAMETER_NAME_FOG_END shader parameter
specifies the end parameter used for linear fog generation.
- The VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE shader parameter
specifies the scale parameter used for fog generation.
- The VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE shader parameter
specifies the kind of fog coordinate to output from a pre-rasterisation
shader.
### vkd3d-compiler
- The new dxbc-fx source type specifies an effect binary embedded in a DXBC
container. This is a convenience feature;
vkd3d-compiler -x dxbc-fx blob.dxbc is equivalent to
vkd3d-dxbc -x t:FX10 blob.dxbc | vkd3d-compiler -x fx.
# What's new in vkd3d 1.14 (21 November 2024)
### libvkd3d

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 \
@@ -80,7 +81,7 @@ vkd3d_shader_tests = \
tests/hlsl/ceil.shader_test \
tests/hlsl/cf-cond-types.shader_test \
tests/hlsl/clamp.shader_test \
tests/hlsl/clip-distance.shader_test \
tests/hlsl/clip-cull-distance.shader_test \
tests/hlsl/clip-planes.shader_test \
tests/hlsl/clip.shader_test \
tests/hlsl/combined-samplers.shader_test \
@@ -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 \
@@ -118,6 +120,7 @@ vkd3d_shader_tests = \
tests/hlsl/effect-variables-fx_4.shader_test \
tests/hlsl/effect-variables-fx_5.shader_test \
tests/hlsl/entry-point-semantics.shader_test \
tests/hlsl/eval-attrib.shader_test \
tests/hlsl/exp.shader_test \
tests/hlsl/expr-indexing.shader_test \
tests/hlsl/f16tof32.shader_test \
@@ -136,8 +139,10 @@ vkd3d_shader_tests = \
tests/hlsl/function.shader_test \
tests/hlsl/fwidth.shader_test \
tests/hlsl/fxgroup-syntax.shader_test \
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 \
@@ -162,9 +167,12 @@ vkd3d_shader_tests = \
tests/hlsl/invalid.shader_test \
tests/hlsl/inverse-trig.shader_test \
tests/hlsl/is-front-face.shader_test \
tests/hlsl/isinf.shader_test \
tests/hlsl/ldexp.shader_test \
tests/hlsl/length.shader_test \
tests/hlsl/lerp.shader_test \
tests/hlsl/lhs-cast.shader_test \
tests/hlsl/lhs-partial-assignment.shader_test \
tests/hlsl/lit.shader_test \
tests/hlsl/load-level.shader_test \
tests/hlsl/log.shader_test \
@@ -192,6 +200,8 @@ vkd3d_shader_tests = \
tests/hlsl/object-field-offsets.shader_test \
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 \
@@ -207,6 +217,7 @@ vkd3d_shader_tests = \
tests/hlsl/return-implicit-conversion.shader_test \
tests/hlsl/return.shader_test \
tests/hlsl/round.shader_test \
tests/hlsl/rt-array-index.shader_test \
tests/hlsl/rt-format-mismatch.shader_test \
tests/hlsl/rt-get-sample-info.shader_test \
tests/hlsl/sample-bias.shader_test \
@@ -217,6 +228,7 @@ vkd3d_shader_tests = \
tests/hlsl/sampler-state.shader_test \
tests/hlsl/sampler.shader_test \
tests/hlsl/saturate.shader_test \
tests/hlsl/scope.shader_test \
tests/hlsl/shade-mode.shader_test \
tests/hlsl/shader-interstage-interface.shader_test \
tests/hlsl/shader-point-size.shader_test \
@@ -233,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 \
@@ -307,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
@@ -369,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 \
@@ -392,7 +408,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader_main.c \
libs/vkd3d-shader/vkd3d_shader_private.h
libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SHADER_SOURCE -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 13:0:12
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 14:0:13
libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ -lm
if HAVE_LD_VERSION_SCRIPT
libvkd3d_shader_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-shader/vkd3d_shader.map
@@ -427,7 +443,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d_shaders.h \
libs/vkd3d/vulkan_procs.h
libvkd3d_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SOURCE
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 15:0:14
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 16:0:15
libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @DL_LIBS@ @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d/vkd3d.map
@@ -440,7 +456,7 @@ libvkd3d_utils_la_SOURCES = \
libs/vkd3d-utils/vkd3d_utils_main.c \
libs/vkd3d-utils/vkd3d_utils_private.h
libvkd3d_utils_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_UTILS_SOURCE
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:0:6
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:1:6
libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la libvkd3d.la @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_utils_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-utils/vkd3d_utils.map
@@ -505,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
@@ -514,16 +530,18 @@ EXTRA_DIST += $(vkd3d_shader_tests)
if BUILD_DEMOS
DEMOS_LDADD = $(LDADD) libvkd3d-shader.la @DL_LIBS@ @DEMO_LIBS@
DEMOS_CFLAGS = $(AM_CFLAGS) @DEMO_CFLAGS@
DEMOS_CFLAGS = $(AM_CFLAGS) @DEMO_CFLAGS@ -Wa,-I$(srcdir)/demos
bin_PROGRAMS += $(vkd3d_demos)
demos_vkd3d_gears_SOURCES = demos/gears.c demos/gears_hlsl.h
demos_vkd3d_gears_SOURCES = demos/gears.c demos/gears.hlsl
demos_vkd3d_gears_CFLAGS = $(DEMOS_CFLAGS)
demos_vkd3d_gears_LDADD = $(DEMOS_LDADD) -lm
demos/vkd3d_gears-gears.$(OBJEXT): demos/gears.hlsl
demos_vkd3d_triangle_SOURCES = demos/triangle.c demos/triangle_hlsl.h
demos_vkd3d_triangle_SOURCES = demos/triangle.c demos/triangle.hlsl
demos_vkd3d_triangle_CFLAGS = $(DEMOS_CFLAGS)
demos_vkd3d_triangle_LDADD = $(DEMOS_LDADD)
demos/vkd3d_triangle-triangle.$(OBJEXT): demos/triangle.hlsl
endif
noinst_HEADERS = $(vkd3d_test_headers) $(vkd3d_demos_headers)
@@ -568,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 '') \
@@ -576,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:
@@ -584,7 +611,7 @@ dummy-vkd3d-version:
## Cross-compile tests
cross_implibs = crosslibs/d3d12
CROSS_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include -I$(builddir)/tests
CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} \
CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -Wa,-I$(srcdir)/demos \
-D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=0 -DVKD3D_CROSSTEST=1
EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def)
EXTRA_DIST += tests/driver.c tests/shader_runner_d3d11.c tests/shader_runner_d3d9.c
@@ -608,6 +635,8 @@ CROSS32_EXEFILES += $(vkd3d_cross_tests:=.cross32.exe)
endif
if BUILD_DEMOS
CROSS32_EXEFILES += $(vkd3d_demos:demos/vkd3d-%=demos/%.cross32.exe)
demos/gears.cross32.exe: demos/gears.hlsl
demos/triangle.cross32.exe: demos/triangle.hlsl
endif
CROSS32_FILES = $(CROSS32_EXEFILES)
@@ -655,6 +684,8 @@ CROSS64_EXEFILES += $(vkd3d_cross_tests:=.cross64.exe)
endif
if BUILD_DEMOS
CROSS64_EXEFILES += $(vkd3d_demos:demos/vkd3d-%=demos/%.cross64.exe)
demos/gears.cross64.exe: demos/gears.hlsl
demos/triangle.cross64.exe: demos/triangle.hlsl
endif
CROSS64_FILES = $(CROSS64_EXEFILES)

14
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,
@@ -165,6 +160,11 @@ in future versions of vkd3d.
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_SPIRV_PARSER - enable SPIR-V parser 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.
============================
Testing with the Agility SDK
============================

View File

@@ -1,2 +0,0 @@
-
0dc07f5cce72cce47b1a2787a910aeb5edc2a65e vkd3d-shader: Silence a spurious -Wmaybe-uninitialized in vsir_program_insert_alpha_test().

View File

@@ -1,10 +1,11 @@
AC_PREREQ([2.69])
AC_INIT([vkd3d],[1.14])
AC_INIT([vkd3d],[1.15])
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])
@@ -173,6 +179,7 @@ VKD3D_CHECK_FUNC([HAVE_SYNC_ADD_AND_FETCH], [__sync_add_and_fetch], [__sync_add_
VKD3D_CHECK_FUNC([HAVE_SYNC_BOOL_COMPARE_AND_SWAP], [__sync_bool_compare_and_swap], [__sync_bool_compare_and_swap((int *)0, 0, 0)])
VKD3D_CHECK_FUNC([HAVE_ATOMIC_EXCHANGE_N], [__atomic_exchange_n], [__atomic_exchange_n((int *)0, 0, 0)])
AC_CHECK_FUNCS([gettid])
AC_CHECK_FUNCS([pthread_threadid_np])
dnl Makefiles
case $host_os in

View File

@@ -39,6 +39,42 @@
#include <vkd3d_d3d12.h>
#include <inttypes.h>
#ifdef __WIN32__
#define DEMO_ASM_PUSHSECTION ".section rdata\n\t"
#define DEMO_ASM_POPSECTION ".text\n\t"
#define DEMO_ASM_OBJECT_TYPE(name)
#else
#define DEMO_ASM_PUSHSECTION ".pushsection .rodata\n\t"
#define DEMO_ASM_POPSECTION ".popsection\n\t"
#define DEMO_ASM_OBJECT_TYPE(name) ".type "name", @object\n\t"
#endif
#if defined(__WIN32__) && defined(__i386__)
#define DEMO_ASM_NAME(name) "_"#name
#else
#define DEMO_ASM_NAME(name) #name
#endif
#define DEMO_EMBED_ASM(name, file) \
DEMO_ASM_PUSHSECTION \
".global "name"\n\t" \
DEMO_ASM_OBJECT_TYPE(name) \
".balign 8\n\t" \
name":\n\t" \
".incbin \""file"\"\n\t" \
name"_end:\n\t" \
".global "name"_size\n\t" \
DEMO_ASM_OBJECT_TYPE(name"_size") \
".balign 8\n\t" \
name"_size:\n\t" \
".int "name"_end - "name"\n\t" \
DEMO_ASM_POPSECTION
#define DEMO_EMBED(name, file) \
extern const unsigned int name##_size; \
extern const uint8_t name[]; \
__asm__(DEMO_EMBED_ASM(DEMO_ASM_NAME(name), file))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
#define DEMO_KEY_UNKNOWN 0x0000
@@ -142,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

@@ -48,7 +48,7 @@
#include <math.h>
#include "demo.h"
#include "gears_hlsl.h"
DEMO_EMBED(gears_hlsl, "gears.hlsl");
struct cxg_fence
{
@@ -681,11 +681,14 @@ static void cxg_load_assets(struct cx_gears *cxg)
hr = demo_create_root_signature(cxg->device, &root_signature_desc, &cxg->root_signature);
assert(SUCCEEDED(hr));
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
hr = D3DCompile(gears_hlsl, gears_hlsl_size, "gears.hlsl",
NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
assert(SUCCEEDED(hr));
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, NULL, NULL, "ps_main_flat", "ps_5_0", 0, 0, &ps_flat, NULL);
hr = D3DCompile(gears_hlsl, gears_hlsl_size, "gears.hlsl",
NULL, NULL, "ps_main_flat", "ps_5_0", 0, 0, &ps_flat, NULL);
assert(SUCCEEDED(hr));
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, NULL, NULL, "ps_main_smooth", "ps_5_0", 0, 0, &ps_smooth, NULL);
hr = D3DCompile(gears_hlsl, gears_hlsl_size, "gears.hlsl",
NULL, NULL, "ps_main_smooth", "ps_5_0", 0, 0, &ps_smooth, NULL);
assert(SUCCEEDED(hr));
memset(&pso_desc, 0, sizeof(pso_desc));
@@ -846,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);

73
demos/gears.hlsl Normal file
View File

@@ -0,0 +1,73 @@
/*
* 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;
float3x3 normal_matrix;
};
struct vs_in
{
float4 position : POSITION;
float3 normal : NORMAL;
float3 diffuse : DIFFUSE;
float4 transform : TRANSFORM;
};
struct vs_out
{
float4 position : SV_POSITION;
float4 colour : COLOR;
};
struct vs_out vs_main(struct vs_in i)
{
const float3 l_pos = float3(5.0, 5.0, 10.0);
float3 dir, normal;
float4 position;
struct vs_out o;
float att;
position.x = i.transform.x * i.position.x - i.transform.y * i.position.y + i.transform.z;
position.y = i.transform.x * i.position.y + i.transform.y * i.position.x + i.transform.w;
position.zw = i.position.zw;
o.position = mul(mvp_matrix, position);
dir = normalize(l_pos - o.position.xyz / o.position.w);
normal.x = i.transform.x * i.normal.x - i.transform.y * i.normal.y;
normal.y = i.transform.x * i.normal.y + i.transform.y * i.normal.x;
normal.z = i.normal.z;
att = 0.2 + dot(dir, normalize(mul(normal_matrix, normal)));
o.colour.xyz = i.diffuse.xyz * att;
o.colour.w = 1.0;
return o;
}
float4 ps_main_smooth(float4 position : SV_POSITION, float4 colour : COLOR) : SV_TARGET
{
return colour;
}
float4 ps_main_flat(float4 position : SV_POSITION, nointerpolation float4 colour : COLOR) : SV_TARGET
{
return colour;
}

View File

@@ -1,56 +0,0 @@
static const char gears_hlsl[] =
"cbuffer gear_block : register(b0)\n"
"{\n"
" float4x4 mvp_matrix;\n"
" float3x3 normal_matrix;\n"
"};\n"
"\n"
"struct vs_in\n"
"{\n"
" float4 position : POSITION;\n"
" float3 normal : NORMAL;\n"
" float3 diffuse : DIFFUSE;\n"
" float4 transform : TRANSFORM;\n"
"};\n"
"\n"
"struct vs_out\n"
"{\n"
" float4 position : SV_POSITION;\n"
" float4 colour : COLOR;\n"
"};\n"
"\n"
"struct vs_out vs_main(struct vs_in i)\n"
"{\n"
" const float3 l_pos = float3(5.0, 5.0, 10.0);\n"
" float3 dir, normal;\n"
" float4 position;\n"
" struct vs_out o;\n"
" float att;\n"
"\n"
" position.x = i.transform.x * i.position.x - i.transform.y * i.position.y + i.transform.z;\n"
" position.y = i.transform.x * i.position.y + i.transform.y * i.position.x + i.transform.w;\n"
" position.zw = i.position.zw;\n"
"\n"
" o.position = mul(mvp_matrix, position);\n"
" dir = normalize(l_pos - o.position.xyz / o.position.w);\n"
"\n"
" normal.x = i.transform.x * i.normal.x - i.transform.y * i.normal.y;\n"
" normal.y = i.transform.x * i.normal.y + i.transform.y * i.normal.x;\n"
" normal.z = i.normal.z;\n"
" att = 0.2 + dot(dir, normalize(mul(normal_matrix, normal)));\n"
"\n"
" o.colour.xyz = i.diffuse.xyz * att;\n"
" o.colour.w = 1.0;\n"
"\n"
" return o;\n"
"}\n"
"\n"
"float4 ps_main_smooth(float4 position : SV_POSITION, float4 colour : COLOR) : SV_TARGET\n"
"{\n"
" return colour;\n"
"}\n"
"\n"
"float4 ps_main_flat(float4 position : SV_POSITION, nointerpolation float4 colour : COLOR) : SV_TARGET\n"
"{\n"
" return colour;\n"
"}\n";

View File

@@ -45,7 +45,7 @@
#include <assert.h>
#include "demo.h"
#include "triangle_hlsl.h"
DEMO_EMBED(triangle_hlsl, "triangle.hlsl");
struct cxt_fence
{
@@ -285,9 +285,11 @@ static void cxt_load_assets(struct cx_triangle *cxt)
hr = demo_create_root_signature(cxt->device, &root_signature_desc, &cxt->root_signature);
assert(SUCCEEDED(hr));
hr = D3DCompile(triangle_hlsl, strlen(triangle_hlsl), NULL, NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
hr = D3DCompile(triangle_hlsl, triangle_hlsl_size, "triangle.hlsl",
NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
assert(SUCCEEDED(hr));
hr = D3DCompile(triangle_hlsl, strlen(triangle_hlsl), NULL, NULL, NULL, "ps_main", "ps_5_0", 0, 0, &ps, NULL);
hr = D3DCompile(triangle_hlsl, triangle_hlsl_size, "triangle.hlsl",
NULL, NULL, "ps_main", "ps_5_0", 0, 0, &ps, NULL);
assert(SUCCEEDED(hr));
memset(&pso_desc, 0, sizeof(pso_desc));
@@ -366,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);

63
demos/triangle.hlsl Normal file
View File

@@ -0,0 +1,63 @@
/*
* 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;
float4 colour : COLOR;
};
struct ps_in vs_main(float4 position : POSITION, float4 colour : COLOR)
{
struct ps_in o;
o.position = position;
o.colour = colour;
return o;
}
float4 ps_main(struct ps_in i) : SV_TARGET
{
return i.colour;
}

View File

@@ -1,21 +0,0 @@
static const char triangle_hlsl[] =
"struct ps_in\n"
"{\n"
" float4 position : SV_POSITION;\n"
" float4 colour : COLOR;\n"
"};\n"
"\n"
"struct ps_in vs_main(float4 position : POSITION, float4 colour : COLOR)\n"
"{\n"
" struct ps_in o;\n"
"\n"
" o.position = position;\n"
" o.colour = colour;\n"
"\n"
" return o;\n"
"}\n"
"\n"
"float4 ps_main(struct ps_in i) : SV_TARGET\n"
"{\n"
" return i.colour;\n"
"}\n";

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
@@ -144,7 +148,7 @@ build-mac:
tags:
- mac
script:
- brew install vulkan-tools libtool spirv-headers vulkan-loader mingw-w64
- brew install vulkan-tools libtool spirv-headers vulkan-loader mingw-w64 spirv-tools
- git config --global --add safe.directory $CI_PROJECT_DIR
- git clean -fdx
- git reset --hard
@@ -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"

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