Commit Graph

2370 Commits

Author SHA1 Message Date
Zebediah Figura
12e3109e00 vkd3d-shader: Allocate constant registers for uniforms.
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-04-13 22:59:53 +02:00
Zebediah Figura
21b4052247 vkd3d-shader: Allocate constant registers for anonymous constants.
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-04-13 22:59:51 +02:00
Zebediah Figura
60ece9cd62 vkd3d-shader: Store the shader type and version in the hlsl_ctx structure.
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-04-13 22:59:49 +02:00
Zebediah Figura
e957d3a346 vkd3d-shader: Allocate temporary registers for anonymous expressions.
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-04-13 22:59:47 +02:00
Zebediah Figura
16163021b9 vkd3d-shader: Allocate temporary registers for variables.
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-04-13 22:59:44 +02:00
Zebediah Figura
027f994fe0 vkd3d-shader: Rename HLSL_IR_ASSIGNMENT to HLSL_IR_STORE.
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-04-13 22:59:41 +02:00
Zebediah Figura
3d22df25fe vkd3d-shader: Create a separate variable for output varyings.
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-03-30 20:38:41 +02:00
Zebediah Figura
5ad94644ec vkd3d-shader: Store the function return semantic in the return variable.
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-03-30 20:38:38 +02:00
Zebediah Figura
a6e47e1552 vkd3d-shader: Create a separate variable for input varyings.
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-03-30 20:38:36 +02:00
Zebediah Figura
9a70d57690 vkd3d-shader: Check for missing semantics on entry function parameters.
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-03-30 20:38:34 +02:00
Zebediah Figura
21fea55c2d vkd3d-shader: Create a separate variable for uniforms.
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-03-30 20:38:32 +02:00
Zebediah Figura
85892db65f vkd3d-shader: Treat global variables as written to only if they are uniform.
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-03-24 20:48:53 +01:00
Zebediah Figura
2d109b69f9 vkd3d-shader: Treat entry point parameters as written to if they are uniform.
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-03-24 20:48:51 +01:00
Zebediah Figura
154a73a5b1 vkd3d-shader: Do not mark objects as uniform or varying.
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-03-24 20:48:49 +01:00
Zebediah Figura
c16a07caff vkd3d-shader: Use separate flag fields to track whether a variable is a uniform or varying.
Mostly in order to make it clearer that these don't directly correspond to the
modifiers with which the variable was declared.

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-03-24 20:48:46 +01:00
Zebediah Figura
7d8491516a vkd3d-shader: Inline declare_variable() into its caller.
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-03-24 20:48:44 +01:00
Zebediah Figura
e285fc57d2 vkd3d-shader: Forbid storage modifiers on struct fields.
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-03-24 20:48:42 +01:00
Matteo Bruni
0e504e974a build: Move Vulkan library detection to m4/check-vulkan.m4.
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-03-22 16:59:18 +01:00
Matteo Bruni
8c01e98650 configure: Use VULKAN_LIBS when looking for the Vulkan library.
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-03-22 16:59:18 +01:00
Henri Verbeet
9007df1067 vkd3d-shader: Set correct dcl masks in vkd3d_dxbc_compiler_emit_hull_shader_inputs().
Avoiding some duplicate input declarations.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
f59e9dfeee vkd3d-shader: Avoid redeclaring inputs in vkd3d_dxbc_compiler_emit_default_control_point_phase().
We've already set these up in vkd3d_dxbc_compiler_emit_hull_shader_inputs().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
1f92c1dd53 vkd3d-shader: Export patch constants at the end of tessellation control shaders.
As opposed to at the end of each fork/join phase. This eliminates a
bunch of redundant SPIR-V, since it's not uncommon for fork/join phases
to only write to individual output components.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
851afc6229 vkd3d-shader: Support patch constant inputs in tessellation control shader join phases.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
6f12553731 tests: Add a test for patch constant inputs in tessellation control shader join phases.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
cad26f7f2c vkd3d-shader: Use the (potentially) modified write mask as dcl_mask in vkd3d_dxbc_compiler_emit_input().
Like outputs, when inputs are coalesced, the write mask is modified by
needs_private_io_variable().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
3b4b898cc5 vkd3d-shader: Use the (potentially) modified write mask as dcl_mask in vkd3d_dxbc_compiler_emit_output().
When outputs are coalesced, the write mask is modified by
needs_private_io_variable(). We want the "dcl_mask" field to reflect
that as well.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Henri Verbeet
b584668a81 vkd3d-shader: Properly handle coalesced outputs in vkd3d_dxbc_compiler_emit_store_shader_output().
Multiple patch constant or output signature elements may be coalesced
into a single output register by needs_private_io_variable() in
vkd3d_dxbc_compiler_emit_output(). When this happens, only the original
element will have a corresponding variable ID assigned in output_info[].

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Zebediah Figura
0c1c916ad7 vkd3d-shader: Allow static const variables to lack an initializer.
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-03-22 16:59:18 +01:00
Zebediah Figura
3377f2445a vkd3d-shader: Eliminate unused assignments.
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-03-22 16:59:18 +01:00
Matteo Bruni
f73b3385c7 vkd3d-shader: Consider previous last_read value when computing liveness.
Otherwise we end up overwriting UINT_MAX last_read for output variables.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-22 16:59:18 +01:00
Zebediah Figura
716753896e vkd3d-shader: Split struct copies.
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-03-22 15:36:56 +01:00
Zebediah Figura
6d10d887d0 vkd3d-shader: Factor out hlsl_new_load().
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-03-22 15:36:54 +01:00
Zebediah Figura
3ac20487f8 vkd3d-shader: Rename hlsl_type_compare() to hlsl_types_are_equal().
hlsl_type_compare() implies a stable comparison function, as if to be passed to
qsort().

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-03-22 15:36:52 +01:00
Matteo Bruni
588d3e5a57 vkd3d-shader: Get rid of a spurious '\n' in a HLSL compiler message.
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-03-17 22:10:06 +01:00
Zebediah Figura
1b7cc14365 vkd3d-shader: Fold redundant casts between scalars and 1-dimensional vectors.
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-03-17 22:10:02 +01:00
Zebediah Figura
79d4e62911 vkd3d-shader: Fold redundant casts.
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-03-17 22:09:59 +01:00
Zebediah Figura
7c2083d374 vkd3d-shader: Add a dead code elimination pass.
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-03-17 22:09:57 +01:00
Zebediah Figura
14993f34c9 vkd3d-shader: Fold addition and multiplication of uint constants.
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-03-17 22:09:54 +01:00
Zebediah Figura
8096e4ae7b vkd3d-shader: Factor out hlsl_new_copy().
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-03-17 22:09:51 +01:00
Zebediah Figura
80cac66b6f tests: Add some tests for fused assignment operations with writemasks.
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-03-15 20:39:13 +01:00
Zebediah Figura
1aca201651 vkd3d-shader: Build fused assignment operations before unwrapping swizzles from the LHS.
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-03-15 20:39:11 +01:00
Zebediah Figura
363a4334e9 vkd3d-shader: Lower postincrement and postdecrement to assignment operations at parse time.
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-03-15 20:39:09 +01:00
Zebediah Figura
1cd208fb32 vkd3d-shader: Lower preincrement and predecrement to assignment operations at parse time.
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-03-15 20:39:07 +01:00
Zebediah Figura
5f66257b8b vkd3d-shader: Don't use assignment instructions as sources.
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-03-15 20:39:04 +01:00
Zebediah Figura
ed44a2bcf0 build: Enable -Winit-self.
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-03-12 21:27:19 +01:00
Zebediah Figura
001328e084 vkd3d-shader: Use yy_scan_bytes() instead of yy_scan_string().
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-03-09 11:58:02 +01:00
Zebediah Figura
b35fd8628e vkd3d-shader: Watch for allocation failure from yyparse().
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-03-09 11:58:01 +01:00
Zebediah Figura
405f2db4d9 vkd3d-shader: Parse nested arrays.
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-03-05 18:00:59 +01:00
Zebediah Figura
2b38799e66 tests: Add some tests for nested arrays.
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-03-05 18:00:55 +01:00
Zebediah Figura
8ce33da2ab vkd3d-shader: Move the remainder of hlsl_parser_compile() to hlsl_compile_shader().
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-03-05 18:00:22 +01:00