Commit Graph

131 Commits

Author SHA1 Message Date
Matteo Bruni c4273f0bbe d3dcompiler: Use more consistent integer data types.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-09 18:44:55 +01:00
Eric Pouech 576cdea0d7 d3dcompiler: Build without -DWINE_NO_LONG_TYPES.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 20:24:15 +01:00
Eric Pouech 96b08eaecb d3d10: Build without -DWINE_NO_LONG_TYPES.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 20:24:15 +01:00
Alexandre Julliard bb2d48627d d3dcompiler: Use the standard va_list instead of __ms_va_list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-22 11:11:28 +02:00
Zebediah Figura 85fa778f93 d3dcompiler: Rip out the HLSL compiler.
The compiler is completely non-functional as-is, and lives in libvkd3d-shader
now. When a vkd3d release is made d3dcompiler will access it via the
libvkd3d-shader public API. Accordingly there's no reason to keep it around in
wine's d3dcompiler.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 18:06:30 +02:00
Jacek Caban e6961f6e16 d3dcompiler: Use return value in read_dword.
Fixes warnings like on clang with MSVC target, where enums may be signed:
dlls/d3dcompiler_43/reflection.c:1160:22: warning: passing
'D3D_PRIMITIVE *' (aka 'enum D3D_PRIMITIVE *') to parameter of type
'DWORD *' (aka 'unsigned int *') converts between pointers to integer
types with different sign [-Wpointer-sign]

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 21:05:42 +02:00
Sven Baars 9f9fec1879 d3dcompiler: Fix a leak on error path (Coverity).
Signed-off-by: Sven Baars <sbaars@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-13 20:42:11 +02:00
Zebediah Figura 23cc300372 d3dcompiler: Iterate through the instruction list in reverse in free_instr_list() (Valgrind).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-10 21:27:41 +02:00
Zebediah Figura 644dbf0644 d3dcompiler: Store the loop body directly in the hlsr_ir_loop structure.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 07:50:03 +02:00
Zebediah Figura 0a9f2d8b0a d3dcompiler: Store the "then" and "else" instruction lists directly in the hlsl_ir_if structure.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 07:49:56 +02:00
Zebediah Figura 2ccf1db285 d3dcompiler: Allow hlsl_ir_constant to contain only scalar and vector constants.
We only emit scalar constants at parse time, and while there's certainly an
advantage to vectorizing constant instructions, there's not much point in
having hlsl_ir_constant hold matrices. Matrices should be lowered to vector
operations first.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 07:49:50 +02:00
Zebediah Figura 8bd5fe3001 d3dcompiler: Track def-use chains for anonymous nodes.
This is useful for replacing one instruction with another of a different type,
which is useful for some optimizations such as constant folding.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-02 18:12:57 +02:00
Zebediah Figura d60b126b24 d3dcompiler: Print the data type when dumping IR.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 09:23:20 +02:00
Zebediah Figura 7260f978f3 d3dcompiler: Add the node to the instruction list in new_expr().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 09:23:15 +02:00
Zebediah Figura 251c8546b5 d3dcompiler: Pass the instruction list to implicit_conversion().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 10:11:17 +02:00
Zebediah Figura 9b3e6b1971 d3dcompiler: Add the assignment node to the instruction list in make_assignment().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 10:11:14 +02:00
Matteo Bruni 2d79e04bfe d3dcompiler: Print float constants with more precision.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 17:16:26 +02:00
Zebediah Figura d5486b6bb5 d3dcompiler: Allow hlsl_ir_constant to contain only numeric types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 22:03:03 +02:00
Zebediah Figura d5a4364f44 d3dcompiler: Emit constructors as sequences of stores to a synthetic variable.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 22:03:01 +02:00
Zebediah Figura 10601d9ac5 d3dcompiler: Cache vector types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 22:02:57 +02:00
Zebediah Figura 9c985e703b d3dcompiler: Use the cached scalar type in expr_common_type() where possible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 22:01:06 +02:00
Zebediah Figura 1dcfb01b29 d3dcompiler: Coerce the RHS before unwrapping swizzles.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:54:35 +02:00
Zebediah Figura 24a4f52bbf d3dcompiler: Remove a redundant check for writemasks on non-numeric types.
This can only happen if a swizzle is emitted on a non-numeric type, but this is
checked when emitting swizzles.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:54:35 +02:00
Zebediah Figura 9ba2bb0f3b d3dcompiler: Fix up the swizzle data type when unwrapping it from the assignment LHS.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:54:35 +02:00
Zebediah Figura 513f0def41 d3dcompiler: Write to the function return value using a separate instruction.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 22:55:55 +02:00
Zebediah Figura c7b90bf348 d3dcompiler: Pass the semantic and location parameters to new_func_decl().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 22:55:40 +02:00
Zebediah Figura 09fcfe27ac d3dcompiler: Rename HLSL_IR_DEREF to HLSL_IR_LOAD.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Zebediah Figura 323be6c515 d3dcompiler: Store derefs as an offset to a variable.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Zebediah Figura 2dc666c9df d3dcompiler: Add a helper to initialize the hlsl_ir_node structure.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-01 22:03:16 +02:00
Zebediah Figura c6c0601396 d3dcompiler: Set the dimensions for array types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-30 21:01:09 +02:00
Zebediah Figura 2573e698ff d3dcompiler: Make printed IR a bit more readable.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-17 11:46:28 +02:00
Zebediah Figura 5f18f9f75a d3dcompiler: Calculate the register size of types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:18:23 +02:00
Zebediah Figura f82b44748a d3dcompiler: Always set the matrix majority for declaration types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:18:20 +02:00
Zebediah Figura 443b0e3efd d3dcompiler: Index instructions for liveness ranges.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 20:58:30 +02:00
Zebediah Figura aaa625217b d3dcompiler: Ensure that the lhs of an assignment is reducible to a variable.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-19 22:09:33 +01:00
Zebediah Figura 8ea8eb20a4 d3dcompiler: Rename HLSL_MODIFIERS_COMPARISON_MASK to HLSL_MODIFIERS_MAJORITY_MASK and use it in more places.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-19 22:09:32 +01:00
Zebediah Figura a82ec54862 d3dcompiler: Rename HLSL_MODIFIER_{IN, OUT} to HLSL_STORAGE_{IN, OUT}.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-19 22:09:32 +01:00
Zebediah Figura 54387427b0 d3dcompiler: Separate out an hlsl_deref structure and store it in hlsl_ir_assignment directly.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-12 21:18:19 +01:00
Zebediah Figura bdbf0b43b7 d3dcompiler: Unwrap swizzles from the left-hand side of an assignment.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-12 21:18:18 +01:00
Zebediah Figura 49f64d05f3 d3dcompiler: Don't pass a writemask to make_assignment().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-12 21:18:18 +01:00
Zebediah Figura 0e95c3faa2 d3dcompiler: Parse array types.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-12 21:18:18 +01:00
Zebediah Figura eef3e3dacd d3dcompiler: Pass a struct source_location to hlsl_report_message().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-06 22:47:25 +01:00
Zebediah Figura 09b2e42e92 d3dcompiler: Verify a returned value against the function's type and cast it if necessary.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-03 14:20:25 +01:00
Zebediah Figura 60f78a1476 d3dcompiler: Check for implicit type compatibility in implicit_conversion().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-03 14:20:25 +01:00
Zebediah Figura 81a7da48b9 d3dcompiler: Get rid of the unused "subexpressions" field of struct hlsl_ir_expr.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-16 20:48:33 +01:00
Zebediah Figura efec4f90aa d3dcompiler: Handle loops in free_instr().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-16 20:48:27 +01:00
Zebediah Figura c5aa0feec7 d3dcompiler: Return an instruction list instead of a single instruction from nodes representing expressions.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-16 20:48:22 +01:00
Zebediah Figura 1aa2beab73 d3dcompiler: Dump loops.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-11 19:46:24 +01:00
Zebediah Figura 05182695f2 d3dcompiler: Use wine_dbg_printf() to dump HLSL IR.
So that we don't print function names.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-11 19:46:21 +01:00
Zebediah Figura e6f89bcb04 d3dcompiler: Dump flattened IR more accurately.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-11 19:46:18 +01:00