Commit Graph

2223 Commits

Author SHA1 Message Date
Zebediah Figura
e1a956f8f2 vkd3d-shader: Implement function-like macro expansion.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-14 21:12:17 +01:00
Zebediah Figura
0f80ac0975 vkd3d-shader: Parse function-like macro definitions.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-14 21:12:15 +01:00
Zebediah Figura
668820f069 vkd3d-shader: Implement macro body expansion.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-14 21:12:13 +01:00
Henri Verbeet
73a937edd0 vkd3d-shader: Decorate "precise" arithmetic instructions with SpvDecorationNoContraction.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-12 20:35:23 +01:00
Zebediah Figura
1fc8b85879 vkd3d-shader: Implement #undef.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-12 20:35:08 +01:00
Zebediah Figura
8c927c491c vkd3d-shader: Implement #include.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-12 20:35:02 +01:00
Zebediah Figura
568983596e vkd3d-shader: Implement #ifndef.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-12 20:35:00 +01:00
Zebediah Figura
b0dbb35ec7 vkd3d-shader: Implement #ifdef.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-12 20:34:58 +01:00
Zebediah Figura
9a1317ff0f vkd3d-shader: Partially implement #define.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-12 20:34:56 +01:00
Zebediah Figura
6b75fb7b9c vkd3d-shader: Implement #elif.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 21:01:11 +01:00
Zebediah Figura
78e31bff16 vkd3d-shader: Implement #else.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 21:01:09 +01:00
Zebediah Figura
86cb863bc2 vkd3d-shader: Implement basic support for #if and #endif.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 21:01:04 +01:00
Zebediah Figura
5304cabf46 vkd3d-shader: Handle preprocessor parsing errors.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 21:01:00 +01:00
Zebediah Figura
cdfca2fab7 vkd3d-shader: Move location tracking out of the vkd3d_shader_message_context structure.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-15 22:19:32 +01:00
Zebediah Figura
e34213d0d5 vkd3d-shader: Introduce a helper to report errors while scanning.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-15 22:00:39 +01:00
Zebediah Figura
4bee8dd89b build: Create object directories before running bison or flex.
Vkd3d-Bug: https://bugs.winehq.org/show_bug.cgi?id=50334
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-15 22:00:33 +01:00
Andrey Gusev
a9abb0d7eb vkd3d: Fix misplaced parenthesis.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-09 19:59:56 +01:00
Zebediah Figura
12180a8e30 vkd3d-shader: Preserve some tokens verbatim for HLSL.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-09 19:59:53 +01:00
Zebediah Figura
741c332658 vkd3d-shader: Parse comments in the preprocessor.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-09 19:59:51 +01:00
Zebediah Figura
f544cb38e5 vkd3d-shader: Implement an initial pass-through HLSL preprocessor.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-09 19:59:49 +01:00
Zebediah Figura
5065cb6c1f vkd3d-shader: Validate "compile_info" in vkd3d_shader_preprocess().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-02 18:43:47 +01:00
Zebediah Figura
f4bbbb2975 tests: Add a test for macro invocation split across multiple files.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-02 16:28:57 +01:00
Zebediah Figura
d2f6ddba49 vkd3d-utils: Initialize input parameters to ID3DInclude::Open().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-02 16:28:55 +01:00
Zebediah Figura
dc7fd3760d vkd3d-utils: Return an error from open_include() if a NULL ID3DInclude was passed to D3DPreprocess().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-02 16:28:53 +01:00
Zebediah Figura
e1aea0a3af tests: Use vkd3d_memmem() in shader_runner_d3d12 (Valgrind).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-02 16:28:51 +01:00
Zebediah Figura
6d5fd68f1d vkd3d-compiler: Default to HLSL as a source format when preprocessing.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 20:00:29 +01:00
Zebediah Figura
10ab0ff124 vkd3d-compiler: Check whether the source format is binary when checking if the output is a tty, when preprocessing.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 20:00:26 +01:00
Zebediah Figura
b40b191498 vkd3d-compiler: Do not validate the target type when preprocessing.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-01 20:00:24 +01:00
Zebediah Figura
9a4a5ba63e vkd3d-compiler: Add support for running the HLSL preprocessor.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-27 18:41:25 +01:00
Zebediah Figura
584f84737b vkd3d-compiler: Also pass the entry point as part of the SPIR-V target information.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-27 18:41:23 +01:00
Zebediah Figura
2164915450 vkd3d-compiler: Rename the 'spirv' local variable to 'output_code'.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-27 18:41:21 +01:00
Zebediah Figura
ffa7bd39f3 tests: Add some C HLSL preprocessor tests.
That is, tests in C, for features of the HLSL preprocessor which are difficult
to test using the shader_runner framework.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 22:28:11 +01:00
Zebediah Figura
e44f2fbf43 tests: Add some more miscellaneous preprocessor tests.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 22:28:05 +01:00
Zebediah Figura
3bf15d6345 tests: Add some tests for shaders which fail to preprocess.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 22:27:59 +01:00
Zebediah Figura
5642fbaae7 tests: Add some tests for macro expansion.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 22:27:53 +01:00
Zebediah Figura
34ff79b0f3 tests: Add some tests for #if expression evaluation.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 22:27:48 +01:00
Zebediah Figura
f8ad29aad0 tests: Add some tests for #ifdef and defined().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-23 22:07:47 +01:00
Zebediah Figura
ca28ac17fb tests: Add some basic tests for #if and related preprocessor directives.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-23 22:07:44 +01:00
Zebediah Figura
52f844d2dc vkd3d-shader: Initialize "messages" to NULL in vkd3d_shader_preprocess() (Valgrind).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-23 22:07:42 +01:00
Zebediah Figura
dc36245be2 vkd3d-utils: Initialize "messages_blob" to NULL in D3DPreprocess().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-23 22:07:39 +01:00
Zebediah Figura
6cd5205fa7 vkd3d-utils: Initialize "messages_blob" to NULL in D3DCompile2().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-23 22:07:37 +01:00
Vinson Lee
4f5ec93661 include: Add more D3D12_RESOURCE_STATES enum elements.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 20:22:17 +01:00
Biswapriyo Nath
f84c09cc66 include: Add DEFINE_ENUM_FLAG_OPERATORS macro for enumerations.
This prevents g++ error: invalid conversion from 'int' to 'XYZ' [-fpermissive]

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 20:22:07 +01:00
Zebediah Figura
1c2344818d vkd3d-shader: Adjust the API for struct vkd3d_shader_macro.
To more closely match the behaviour of D3D_SHADER_MACRO.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-16 22:07:18 +02:00
Zebediah Figura
5d9398e10c include: Clarify that struct vkd3d_shader_code is not null-terminated.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-16 22:07:16 +02:00
Zebediah Figura
dffff8bdbc vkd3d-shader: Avoid reading past the end of the buffer in vkd3d_string_buffer_trace() (Valgrind).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-16 22:07:14 +02:00
Zebediah Figura
86cf5145dc vkd3d-shader: Avoid reading past the end of the buffer in vkd3d_shader_trace() (Valgrind).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-16 22:07:12 +02:00
Zebediah Figura
5fb9bcdd14 vkd3d-shader: Don't allocate an initial buffer in vkd3d_string_buffer_init().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-09 16:15:12 +02:00
Zebediah Figura
05cf9a5404 vkd3d-shader: Return NULL from vkd3d_shader_message_context_copy_messages() if there are no messages to copy.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-09 16:15:10 +02:00
Zebediah Figura
0072fb213a vkd3d-shader: Pass the output pointer to vkd3d_shader_message_context_copy_messages().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-09 16:15:08 +02:00