Commit Graph

3536 Commits

Author SHA1 Message Date
Giovanni Mascellani
8d7159b4be tests: Initialize shader_runner fields after having zeroed the struct. 2023-03-10 21:12:44 +01:00
Zebediah Figura
da2435707b vkd3d-shader/hlsl: Fix some memory leaks in the function call rule. 2023-03-09 22:11:06 +01:00
Henri Verbeet
d405295bc7 build: Fix the order of some .shader_test files. 2023-03-09 22:10:53 +01:00
Henri Verbeet
0c833056f6 build: Actually run asuint.shader_test. 2023-03-09 22:10:53 +01:00
Nikolay Sivov
193692bbcb vkd3d-shader/hlsl: Use array element type for array's regset.
Currently this affects SM1 compilation only, with a minimal example like this:

float4 var[3];
float4 main() : sv_target
{
    return var[1];
}
2023-03-09 22:10:39 +01:00
Nikolay Sivov
2880be647e vkd3d-shader/sm4: Write sample count field for multisampled texture declaration.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-03-08 20:15:11 +01:00
Nikolay Sivov
ae2f777a4d vkd3d-shader/hlsl: Parse multisample texture type names. 2023-03-08 20:15:09 +01:00
Nikolay Sivov
ee52ad8106 vkd3d-shader/trace: Output sample count for multisampled resources. 2023-03-08 20:15:06 +01:00
Conor McCarthy
9f6e6d3fcd vkd3d-shader/dxbc: Validate and skip the signature section header size.
Silences a very common warning.
2023-03-08 20:14:59 +01:00
Conor McCarthy
3b5316be82 vkd3d-shader/dxbc: Emit a shader error for an invalid signature data size. 2023-03-08 20:14:57 +01:00
Conor McCarthy
83e39e2650 vkd3d-shader/dxbc: Pass a message context to for_each_dxbc_section(). 2023-03-08 20:14:55 +01:00
Zebediah Figura
98624f2e8f include: Document that vkd3d_shader_signature may contain pointers into the input shader blob. 2023-03-08 20:14:49 +01:00
Giovanni Mascellani
bb2fa97c33 vkd3d: Do not keep the CS queue locked while processing it.
d3d12_command_queue_flush_ops() can renter itself while processing signal
events. Since we don't use recursive mutexes, we currently have to check
some of the queue variables without holding the mutex, which is not safe.

This is solved by allowing the queue to release its mutex while it is
processing entries: when flushing, the queue is briefly locked, the
is_flushing flag is set, the queue content is copied away and the
queue is unlocked again. After having processed the entries, the
queue is locked again to check is something else was added in the
meantime. This is repeated until the queue is empty (or a wait operation
is blocking it).

This should also remove some latency when a thread pushes to the queue
while another one is processing it, but I didn't try to measure any
impact. While it is expected that with this patch the queue mutex
will be locked and unlocked more frequently, it should also remain
locked for less time, hopefully creating little contention.
2023-03-08 20:14:39 +01:00
Giovanni Mascellani
09d2c8d190 vkd3d: Always enqueue wait operations, even when they can be executed right away. 2023-03-08 20:14:39 +01:00
Giovanni Mascellani
9eba44396a vkd3d: Always enqueue signal operations, even when they can be executed right away. 2023-03-08 20:14:39 +01:00
Giovanni Mascellani
0d329ba168 vkd3d: Always enqueue execute operations, even when they can be executed right away.
The goal is to simplify the CS queue handling: with this and the following
changes operations are always started by d3d12_command_queue_flush_ops(),
in order to make further refactoring easier.

Notice that while with this change executing an operation on an empty CS
queue is a bit less efficient, it doesn't require more locking. On the other
hand, this change paves the road for executing CS operations without holding
the queue lock.
2023-03-08 20:14:35 +01:00
Giovanni Mascellani
0c6df49560 vkd3d: Hold the queue mutex when adding the queue to a blocked list.
Otherwise it could be added more than once.

Note that the deleted comment is wrong: between when d3d12_command_queue_flush_ops()
returns and when the queue is added back to the blocked list, the queue
might have been pushed to and flushed an arbitrary number of times.
2023-03-08 20:14:31 +01:00
Giovanni Mascellani
ef8d272507 vkd3d: Mention the correct mutex in a comment. 2023-03-08 20:14:31 +01:00
Nikolay Sivov
a18f3d4dd5 vkd3d-shader/hlsl: Support distance() intrinsic. 2023-03-08 20:14:22 +01:00
Nikolay Sivov
d6b656641c vkd3d-shader/hlsl: Support rsqrt() intrinsic. 2023-03-08 20:14:20 +01:00
Giovanni Mascellani
6ccde9e82c vkd3d-shader: Make documentation for "messages" parameters self contained.
Otherwise it's not clear which clauses in vkd3d_shader_compile() really
apply to other functions. For example, many of the functions currently
refering to vkd3d_shader_compile() don't even take a vkd3d_shader_compile_info
parameter.
2023-02-28 22:07:12 +01:00
Zebediah Figura
a28ecaa135 vkd3d-shader/hlsl: Get rid of the check_invalid_matrix_modifiers() helper. 2023-02-28 22:07:01 +01:00
Zebediah Figura
5838364886 vkd3d-shader/hlsl: Apply latent majority modifiers to typedefs as well. 2023-02-28 22:07:00 +01:00
Zebediah Figura
322963add8 vkd3d-shader/hlsl: Do not set an initial latent matrix majority.
This change does nothing by itself.
2023-02-28 22:06:59 +01:00
Zebediah Figura
75ab9d31ef vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask. 2023-02-28 22:06:58 +01:00
Zebediah Figura
b3c620954b vkd3d-shader/hlsl: Apply latent type modifiers to matrix array typedefs. 2023-02-28 22:06:56 +01:00
Zebediah Figura
2a412670ee tests: Add more tests for pack_matrix pragmas. 2023-02-28 22:06:54 +01:00
Francisco Casas
af25d5bf96 vkd3d-shader/hlsl: Don't map src swizzles for SM1 dp3 and dp4 ops.
Without this patch, dp3 and dp4 map src swizzles to the dst writemask,
which is not correct.

Before b84f560bdf, these ops worked
despite this, because the dst register had, incorrectly, the full
writemask.

To solve this problem, write_sm1_binary_op_dot() is introduced,
similarly to write_sm4_binary_op_dot().
2023-02-27 22:12:38 +01:00
Giovanni Mascellani
a1c6bb85ad vkd3d-shader: Do not pass client-given strings as printf()-style format strings. 2023-02-27 22:12:26 +01:00
Henri Verbeet
b1e13d6e33 vkd3d-shader/dxbc: Introduce API for serialising DXBC blobs. 2023-02-23 21:47:27 +01:00
Henri Verbeet
c87492ed21 vkd3d-shader/dxbc: Introduce API for parsing DXBC blobs. 2023-02-23 21:47:26 +01:00
Henri Verbeet
d0d2130f74 vkd3d-shader/dxbc: Rename parse_dxbc() to for_each_dxbc_section(). 2023-02-23 21:47:23 +01:00
Henri Verbeet
a06320c1fc vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to parse_dxbc(). 2023-02-23 21:47:22 +01:00
Henri Verbeet
2f762465a6 vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to shader_extract_from_dxbc(). 2023-02-23 21:47:21 +01:00
Henri Verbeet
3a3acb5b7d vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to shader_parse_input_signature(). 2023-02-23 21:47:20 +01:00
Henri Verbeet
e2825f7658 vkd3d-shader/dxbc: Pass a vkd3d_shader_dxbc_section_desc structure to the parse_dxbc() section handler. 2023-02-23 21:47:19 +01:00
Henri Verbeet
5020781f76 vkd3d-shader/dxbc: Pass a vkd3d_shader_dxbc_section_desc structure to shader_parse_root_signature(). 2023-02-23 21:47:18 +01:00
Henri Verbeet
6c64f8a217 vkd3d-shader/dxbc: Pass a vkd3d_shader_dxbc_section_desc structure to shader_parse_signature(). 2023-02-23 21:47:16 +01:00
Henri Verbeet
bf3c012834 vkd3d-shader/dxbc: Rename the dxbc_writer_section structure to vkd3d_shader_dxbc_section_desc.
In preparation of exposing it in the public API.
2023-02-23 21:47:15 +01:00
Henri Verbeet
b59de4de5c vkd3d-shader/dxbc: Store DXBC section data as a vkd3d_shader_code structure. 2023-02-23 21:47:13 +01:00
Zebediah Figura
dea212688a vkd3d: Remove a double space in a trace message. 2023-02-23 21:46:49 +01:00
Nikolay Sivov
dd36215a00 vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'float' type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-02-23 21:46:42 +01:00
Nikolay Sivov
df2d6d35e2 vkd3d-shader/hlsl: Use unsigned type for the 'dword' alias.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-02-23 21:46:40 +01:00
Nikolay Sivov
891217664a vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'dword' type. 2023-02-23 21:46:38 +01:00
Giovanni Mascellani
5f904e5022 vkd3d-utils: Generate Doxygen documentation for vkd3d_utils.h. 2023-02-22 21:38:46 +01:00
Giovanni Mascellani
e5bbd05c98 vkd3d: Generate Doxygen documentation for vkd3d.h. 2023-02-22 21:38:46 +01:00
Giovanni Mascellani
6bdb0abf68 vkd3d-shader: Fix the Doxygen documentation for vkd3d_shader.h.
The \since field was too early, and prevented Doxygen from really
parsing the synopsis for vkd3d_shader.h.
2023-02-22 21:38:43 +01:00
Zebediah Figura
e10e12a10c vkd3d-shader: Avoid underflowing the indentation level.
Any shader that would underflow is invalid, but it is helpful to allow tracing even invalid shaders.
2023-02-22 18:28:19 +01:00
Francisco Casas
f8338ef089 vkd3d-shader/hlsl: Allocate register reservations in a separate pass.
This refactoring is required for improving the allocation strategy so it
works with multiple-register variables.
2023-02-22 18:28:19 +01:00
Francisco Casas
75359e6dbd vkd3d-shader/hlsl: Respect object reservations even if the object is unused. 2023-02-22 18:28:19 +01:00