Commit Graph

6400 Commits

Author SHA1 Message Date
Henri Verbeet
eb10f0897e vkd3d-shader/glsl: Implement VKD3DSIH_LD. 2024-10-03 19:14:43 +02:00
Giovanni Mascellani
0e50825b83 vkd3d-shader/ir: Validate indices for UAV registers. 2024-10-03 19:08:33 +02:00
Giovanni Mascellani
3ab68c1e46 vkd3d-shader/ir: Validate indices for RESOURCE registers. 2024-10-03 19:08:33 +02:00
Giovanni Mascellani
ab23038367 vkd3d-shader/ir: Validate indices for SAMPLER registers. 2024-10-03 19:08:33 +02:00
Giovanni Mascellani
da7c9694f1 vkd3d-shader/dxil: Emit SAMPLER, UAV and RESOURCE registers with only 2 indices.
DXIL handles are used to represent descriptors. Currently they are
translated to registers of the appropriate type (depending on the
descriptor type) and three indices. The first two indices are used
to represent the descriptor itself (through its signature and array
index), and are filled when the handle itself is created. The last
index is used with constant buffers to address the data inside the
buffer itself, and it goes unused with other descriptor types.

As currently implemented, however, registers for descriptors other
than constant buffers are still created with three indices, even if
the last one is useless and set to -1. In the interest of creating
more sensible VSIR code, this is now removed: DXIL handles are
created with just two indices; a third one is added when accessing
constant buffers, and nothing is changed for other descriptor types.
2024-10-03 19:08:33 +02:00
Elizabeth Figura
cebe0a8b95 vkd3d-shader/hlsl: Handle error expressions in method calls. 2024-10-03 17:47:26 +02:00
Elizabeth Figura
600f90e8b0 vkd3d-shader/hlsl: Handle error expressions in assignments. 2024-10-03 17:47:26 +02:00
Elizabeth Figura
c94aa5e03c vkd3d-shader/hlsl: Handle error expressions in binary expressions. 2024-10-03 17:47:26 +02:00
Elizabeth Figura
d6052bc31b vkd3d-shader/hlsl: Handle error expressions in function calls. 2024-10-03 17:47:26 +02:00
Elizabeth Figura
5d52bef19d vkd3d-shader/hlsl: Return an "error" expression when using an undeclared variable. 2024-10-03 17:47:26 +02:00
Elizabeth Figura
67093c5833 vkd3d-shader/hlsl: Free static initializers after functions.
We need users of a value to be freed before the value itself is.
Due to copy propagation or use of the pre-allocated error instruction,
static_initializers can contain values that will be used in function blocks.
2024-10-03 17:47:26 +02:00
Giovanni Mascellani
ae27fded1a vkd3d-shader/spirv: Handle all possible destination modifiers.
Historically the SPIR-V backend was only fed by the TPF parser,
which only generates _sat destination modifiers. Now it is fed
by the D3DBC parser too (among others), so it mustn't assert on
other modifiers.

Modifier _pp can be trivially ignored. Modifier _centroid would
probably require some handling, but I'm not immediately sure of
what should happen and it doesn't look like a very urgent thing
anyway, so I'm degrading the assertion to FIXME().
2024-10-02 22:31:50 +02:00
Henri Verbeet
fc4c9b7a95 vkd3d-shader/glsl: Implement VKD3DSIH_USHR. 2024-10-02 22:30:58 +02:00
Henri Verbeet
babbf11d52 vkd3d-shader/glsl: Implement VKD3DSIH_ISHR. 2024-10-02 22:30:58 +02:00
Henri Verbeet
7f1c78f8e2 vkd3d-shader/glsl: Implement VKD3DSIH_ISHL. 2024-10-02 22:30:58 +02:00
Henri Verbeet
f501b8c661 vkd3d-shader/glsl: Implement VKD3DSIH_MAD. 2024-10-02 22:30:58 +02:00
Henri Verbeet
4103e76245 vkd3d-shader/glsl: Implement support for VKD3DSPDM_SATURATE modifiers. 2024-10-02 22:30:58 +02:00
Giovanni Mascellani
49121937cf readme: Document some preprocessor definitions used by vkd3d. 2024-10-02 22:30:29 +02:00
Giovanni Mascellani
2129a7f09d readme: Move the "Developing vkd3d" section upwards.
The idea is to keep at the beginning of the files the sections that
contain general introduction to vkd3d and how it works, which are
likely the first things a reader needs. Then the sections going into
more specific and verbose topics, which are probably to be read only
when looking some specific piece of information.
2024-10-02 22:30:23 +02:00
Nikolay Sivov
79aa75e98f vkd3d-shader/fx: Implement writing fx_2_0 object initializer data sections.
Object data is used for strings, textures, and shaders. Samplers are handled separately.
The section is a contigious stream of <id><size><object-data>, size field is used
to advance to the next <id> position.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:17:41 +02:00
Giovanni Mascellani
7e9dc8da97 vkd3d-shader/ir: Validate index count for MISCTYPE registers. 2024-10-02 22:12:47 +02:00
Giovanni Mascellani
99aebb1b31 vkd3d-shader/ir: Validate index count for RASTOUT registers. 2024-10-02 22:12:47 +02:00
Giovanni Mascellani
19d35d89cd vkd3d-shader/ir: Validate index count for DEPTHOUTLE registers. 2024-10-02 22:12:47 +02:00
Giovanni Mascellani
6259832680 vkd3d-shader/ir: Validate index count for DEPTHOUTGE registers. 2024-10-02 22:12:47 +02:00
Giovanni Mascellani
c3757e6930 vkd3d-shader/ir: Validate index count for DEPTHOUT registers. 2024-10-02 22:12:47 +02:00
Giovanni Mascellani
53e35f2d76 vkd3d-shader/d3dbc: Do not emit indices for DEPTHOUT registers. 2024-10-02 22:11:48 +02:00
Francisco Casas
caa2a9d314 vkd3d-shader/hlsl: Parse sampler_state. 2024-10-02 22:07:34 +02:00
Francisco Casas
f47d523e0b vkd3d-shader/hlsl: Process 'texture' as a valid stateblock lhs. 2024-10-02 22:07:34 +02:00
Francisco Casas
125bf74ef3 tests: Test sampler_state keyword syntax. 2024-10-02 22:07:34 +02:00
Nikolay Sivov
994e994231 vkd3d-shader/fx: Handle assignments with array RHS indexed with a constant or a single variable.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:05:46 +02:00
Nikolay Sivov
2722346ffb vkd3d-shader/hlsl: Do not lower index expressions for effects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:05:24 +02:00
Nikolay Sivov
849d4b3b2b tests: Add some tests for state value assignments.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-02 22:04:44 +02:00
Elizabeth Figura
3b1760134f tests: Test clip planes. 2024-10-02 21:49:54 +02:00
Elizabeth Figura
4400315c4b vkd3d-shader: Allow controlling clip planes through vkd3d-shader parameters. 2024-10-02 21:49:54 +02:00
Elizabeth Figura
85b8503995 vkd3d-shader/ir: Remove newlines from some vkd3d_shader_error() calls. 2024-10-02 21:49:54 +02:00
Henri Verbeet
3452d126a8 vkd3d-shader/glsl: Implement VKD3DSIH_ELSE. 2024-10-01 17:29:48 +02:00
Henri Verbeet
01ba2ba6db vkd3d-shader/glsl: Implement VKD3DSIH_NOT. 2024-10-01 17:29:48 +02:00
Henri Verbeet
1812258f37 vkd3d-shader/glsl: Implement VKD3DSIH_RSQ. 2024-10-01 17:29:48 +02:00
Henri Verbeet
5cf8562124 vkd3d-shader/glsl: Implement VKD3DSIH_MIN. 2024-10-01 17:29:48 +02:00
Henri Verbeet
4f054aed48 vkd3d-shader/glsl: Implement VKD3DSIH_MAX. 2024-10-01 17:29:48 +02:00
Victor Chiletto
2ea5f187f9 vkd3d-shader/hlsl: Allow cbuffer reservations to overlap if only one of them is allocated. 2024-10-01 17:28:41 +02:00
Victor Chiletto
8010ef8771 tests: Add a test for unused overlapping cbuffer reservations. 2024-10-01 17:28:41 +02:00
Nikolay Sivov
5e52ccbf3d vkd3d-shader/hlsl: Move default values indexing fixup to the tpf writer stage.
The primary goal here is to move compilation profile type and version
check outside of a parsing stage. Default values for parameters were
never subjected to this fixup, and it does look tpf-specific, so moving
it where it belongs.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-01 17:27:12 +02:00
Andrey Gusev
f28d39b609 vkd3d-utils: Store the actual serialisation return value in D3DStripShader(). 2024-09-30 20:57:15 +02:00
Andrey Gusev
c94eac2d33 vkd3d-utils: Store the actual serialisation return value in get_blob_part(). 2024-09-30 20:52:24 +02:00
Giovanni Mascellani
6822f1fe6c vkd3d-shader/dxil: Trace the program when validation fails after parsing. 2024-09-30 20:48:43 +02:00
Giovanni Mascellani
5f20103518 vkd3d-shader/d3dbc: Trace the program when validation fails after parsing. 2024-09-30 20:48:43 +02:00
Giovanni Mascellani
8acaa3a62c vkd3d-shader/tpf: Propagate validation errors after parsing.
Also, trace the program when validation fails after parsing, mostly
to make debugging easier.
2024-09-30 20:48:43 +02:00
Giovanni Mascellani
0f91149260 vkd3d-shader/d3d-asm: Dump all indices when tracing VSIR code.
Our ASM dumper currently hides or interprets some register indices
in order to match users expectations. This can be inconvenient for
developers, though, because it makes it harder to understand what's
really going on in the VSIR code when reading logs. With this change
the whole index structure is dumped.
2024-09-30 20:22:53 +02:00
Henri Verbeet
10559fa17a vkd3d-shader/glsl: Implement VKD3DSIH_LOG. 2024-09-30 20:21:14 +02:00