Commit Graph

4335 Commits

Author SHA1 Message Date
Nikolay Sivov
4b8a4809d1 tests: Add a test for interpolation modifiers specified on structure fields.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:24 +02:00
Nikolay Sivov
c5414fa92f vkd3d-shader/tpf: Write 'continue' instruction.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:17 +02:00
Nikolay Sivov
e4b423d6b5 vkd3d-shader/hlsl: Handle 'continue' statements.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:14 +02:00
Nikolay Sivov
0e5749e78e vkd3d-shader/hlsl: Allow 'break' instructions in loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:12 +02:00
Nikolay Sivov
89f493b900 tests: Add some tests for 'break'/'continue' in loops.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:12 +02:00
Nikolay Sivov
6ba75fd92f vkd3d: Add partial implementation for CreateHeap1().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-09 21:58:07 +02:00
Conor McCarthy
75c2af3640 vkd3d-shader/spirv: When declaring a CBV initialise the register with the register index range.
The declaration instruction register contains id, range first, and range
last. The backend includes range first in the variable name. After commit
e8b3561252 it was always zero, and since commit 67f0196c33 it is
UINT_MAX, so constant buffers are named, e.g., "%cb0_4294967295".
2023-10-09 21:58:01 +02:00
Zebediah Figura
a4c5f3a798 vkd3d-shader/spirv: Add a debug name for the push constant buffer. 2023-10-09 21:57:53 +02:00
Henri Verbeet
98d158d004 vkd3d-shader/tpf: Get rid of the output map.
Map output registers in the backend instead, as needed.
2023-10-09 21:57:46 +02:00
Henri Verbeet
31ce7c3a38 vkd3d-shader/hlsl: Get rid of the vkd3d_sm4_* forward declarations in hlsl.h.
These are no longer needed outside of tpf.c.
2023-10-09 21:57:38 +02:00
Francisco Casas
014960b64b vkd3d-shader/tpf: Use lookup table for opcode_info_from_sm4().
Makes get_opcode_info() and thus, tpf reading a little faster.
2023-10-05 16:16:27 +02:00
Francisco Casas
88b644a11d vkd3d-shader/tpf: Don't store sm4 instruction extra bits in the opcode.
Adding extra bits to instr->opcode doesn't seem correct, given that it
is an enum.

For instance, get_opcode_info() would return NULL if additional bits are
added to instr->opcode. This is not a problem now because that function
is called when reading and not writing.
2023-10-05 16:16:24 +02:00
Francisco Casas
0a5fa80f02 vkd3d-shader/tpf: Apply mask to swizzle when swizzle type is scalar.
In native's output, for scalar swizzles only the first component of the
swizzle is written, the others are left as zero.
2023-10-05 16:16:21 +02:00
Francisco Casas
f06169afc5 vkd3d-shader/tpf: Don't calculate instruction size in advance.
Co-authored-by: Henri Verbeet <hverbeet@codeweavers.com>
2023-10-05 16:16:19 +02:00
Nikolay Sivov
7c378cc6f9 vkd3d-shader/hlsl: Remove conditional branching when condition is a compile time constant.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:16:09 +02:00
Nikolay Sivov
f3389789b2 vkd3d-shader: Add constant folding for 'rsq'.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:16:03 +02:00
Nikolay Sivov
a58c659b10 vkd3d-shader/hlsl: Add constant folding for binary complement operator.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:56 +02:00
Nikolay Sivov
8ebccad3c9 vkd3d-shader/hlsl: Add constant folding for rshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:54 +02:00
Nikolay Sivov
6e74819eb7 vkd3d-shader/hlsl: Add constant folding for lshift.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:52 +02:00
Nikolay Sivov
8c9d65d6b3 vkd3d-shader/hlsl: Add constant folding for logical 'not', for bools.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:50 +02:00
Francisco Casas
4ab6572be7 vkd3d-shader/hlsl: Replace hlsl_type_get_regset() uses with hlsl_deref_get_regset(). 2023-10-05 16:15:37 +02:00
Francisco Casas
a214b7374b vkd3d-shader/hlsl: Avoid hlsl_type_get_regset() in allocate_register_reservations(). 2023-10-05 16:15:34 +02:00
Francisco Casas
e64e08b2b7 tests: Test register reservations on structs for SM5. 2023-10-05 16:15:30 +02:00
Francisco Casas
cd0e3786c3 vkd3d-shader/hlsl: Avoid hlsl_type_get_regset() in sm4_get_extern_resources(). 2023-10-05 16:15:28 +02:00
Francisco Casas
dfce1e7f4a vkd3d-shader/hlsl: Make regset an output argument in hlsl_type_get_component_offset().
Components only span across a single regset, so instead of expecting the
regset as input for the offset, hlsl_type_get_component_offset() can
actually retrieve it.
2023-10-05 16:15:26 +02:00
Nikolay Sivov
b5c0c9c22f vkd3d-shader/hlsl: Add fwidth() function.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-05 16:15:10 +02:00
Andrey Gusev
8087cc01f7 vkd3d: Add ID3D12GraphicsCommandList5 interface stub. 2023-10-05 16:15:02 +02:00
Alistair Leslie-Hughes
71715cc434 vkd3d-shader: Fix compiler warning.
vkd3d-shader/tpf.c:3810:39: warning: passing argument 2 of ‘sm4_register_from_node’ from incompatible pointer type [-Wincompatible-pointer-types]
vkd3d-shader/tpf.c:4750:59: warning: passing argument 3 of ‘sm4_register_from_deref’ from incompatible pointer type [-Wincompatible-pointer-types]

Change to use uint32_t as requested.
2023-10-05 16:14:44 +02:00
Francisco Casas
c92772657f vkd3d-shader/tpf: Replace sm4_src_register with vkd3d_shader_src_param. 2023-10-03 21:27:48 +02:00
Francisco Casas
13f62e60e1 vkd3d-shader/tpf: Remove sm4_src_register.swizzle_type. 2023-10-03 21:27:47 +02:00
Francisco Casas
32f03468fc vkd3d-shader/tpf: Make sm4_src_register.mod a vkd3d_shader_src_modifier enum. 2023-10-03 21:27:45 +02:00
Andrey Gusev
679203f717 vkd3d: Add ID3D12GraphicsCommandList4 interface stub. 2023-10-03 21:27:34 +02:00
Giovanni Mascellani
d10e94d8d5 ci: Update the README with some recent changes. 2023-10-02 22:25:16 +02:00
Giovanni Mascellani
ede1ff6951 demos: Do not trigger -Wmissing-prototypes for wmain().
For some reason wmain() is not exempted from -Wmissing-prototypes
in the same way as main() is. So we just declare a prototype for it.
2023-10-02 22:25:14 +02:00
Giovanni Mascellani
627cf50320 vkd3d: Use CONST_VTABLE. 2023-10-02 22:25:14 +02:00
Giovanni Mascellani
ef77d78a39 ci: Store config.log as a build artifact. 2023-10-02 22:25:14 +02:00
Giovanni Mascellani
fd6c6895d6 ci: Compile with -Werror.
Manually disable some warnings that are currently emitted. Eventually
the warnings should be solved and -Werror should remain alone.
2023-10-02 22:25:13 +02:00
Conor McCarthy
39be40ce94 tests: Destroy the test context in test_readback_map_stability(). 2023-10-02 22:25:10 +02:00
Giovanni Mascellani
6743439e97 vkd3d-dxbc: Print section offsets. 2023-10-02 22:25:06 +02:00
Andrey Gusev
1006e8cbd4 vkd3d: Add ID3D12Device5 interface stub. 2023-09-28 23:13:29 +02:00
Francisco Casas
f50d0ae2cb vkd3d-shader/tpf: Store vkd3d-shader swizzles in sm4_src_register.swizzle. 2023-09-28 23:13:16 +02:00
Francisco Casas
ef9ec28eb0 vkd3d-shader/tpf: Replace sm4_dst_register with vkd3d_shader_dst_param. 2023-09-28 23:13:14 +02:00
Francisco Casas
d41d8f8771 vkd3d-shader/tpf: Rename sm4_dst_register.writemask to write_mask. 2023-09-28 23:13:12 +02:00
Henri Verbeet
5503a025d9 tests: Add some missing vkd3d_test_pop_context() calls to test_shader_instructions(). 2023-09-28 23:13:04 +02:00
Andrey Gusev
acd3ed97dc vkd3d: Add ID3D12Device4 interface stub. 2023-09-27 22:34:52 +02:00
Francisco Casas
123e399b89 vkd3d-shader/d3d-asm: Don't print offset for DEPTHOUT registers.
This register is unique and thus is not accompanied with an offset in
the native disassembler output.
2023-09-27 22:34:48 +02:00
Francisco Casas
ef1567c17b vkd3d-shader/d3d-asm: Use vkd3d_shader_register.dimension to know when to dump writemask.
This change ensures that we don't dump the writemask for registers that
have a scalar dimension.

For instance, for this shader:

    float r;

    float4 main(out float d : DEPTH) : sv_target
    {
        d = r;
        return 0;
    }

we now correctly dump

    dcl_output oDepth

instead of

    dcl_output oDepth.x
2023-09-27 22:34:47 +02:00
Francisco Casas
a358722f71 vkd3d-shader/d3d-asm: Use vkd3d_shader_register.dimension to know when to dump swizzle.
The assumption that sampler registers never have a swizzle is not
totally correct.

For instance, for the following shader:

    Texture2D tex;
    sampler sam;

    float4 main() : sv_target
    {
        return tex.GatherGreen(sam, float2(0, 0));
    }

the gather instruction is being disassembled as

  gather4_indexable(texture2d) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0

instead of

  gather4_indexable(texture2d)(float,float,float,float) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0.y

(notice the missing swizzle in the last parameter s0).

This is because the Gather instructions give the sampler register a vec4
dimension (and scalar swizzle type) to indicate the channel for the
gather operation.

The solution is using the new vkd3d_shader_register.dimension instead of
checking the swizzle type.
2023-09-27 22:34:46 +02:00
Martin Storsjö
e44a1927e5 include: Add an #include of d3d12sdklayers.h in vkd3d_d3d12.idl.
This matches what is done in the upstream headers; end users
including d3d12.h don't need to explicitly include d3d12sdklayers.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-09-27 22:34:34 +02:00
Francisco Casas
8e0fe29bfc vkd3d-shader/tpf: Replace sm4_register with vkd3d_shader_register. 2023-09-27 22:34:31 +02:00