Commit Graph

153 Commits

Author SHA1 Message Date
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 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 56be9dde92 d3dcompiler: Rename make_simple_assignment() to new_simple_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-29 09:23:17 +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 6083b1dd39 d3dcompiler: Create the expression in append_binop().
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:12 +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
Zebediah Figura 95ef2fa578 d3dcompiler: Append the instruction to its list in new_return().
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:11 +02:00
Zebediah Figura 548f763f99 d3dcompiler: Pass an instruction list to the load creation functions.
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:10:27 +02:00
Zebediah Figura 142be50629 d3dcompiler: Prepend static initializers to the function body.
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:10:21 +02:00
Zebediah Figura a9e720e54f d3dcompiler: Factor out hlsl_ir_var allocation.
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-17 17:32:08 +02:00
Zebediah Figura 24c84947c8 d3dcompiler: Return an HRESULT from parse_hlsl().
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:07:47 +02:00
Zebediah Figura fdb3db5275 d3dcompiler: Check for missing return value semantics on the entry point.
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:05 +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 3b66245922 d3dcompiler: Use hlsl_report_message() 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-05 16:54:35 +02:00
Zebediah Figura f114a0a8e6 d3dcompiler: Fix matrix dimension declaration for matrix<...> syntax.
Addendum to 4952bcfa4c.

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 2b77cfb7be d3dcompiler: Also check the type class when checking for void.
As of 867fe22346, non-void types may have a base_type of HLSL_TYPE_VOID.

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:49 +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 5900f00148 d3dcompiler: Create assignment instructions more directly in struct_var_initializer().
In particular so that we can remove the need for creating a load instruction,
which besides being unnecessary was also never added to any instruction lists.

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:31 +02:00
Zebediah Figura 7fc0b9a6bd d3dcompiler: Don't add a record deref to the instruction list twice.
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:27 +02:00
Zebediah Figura 2449ff4b8f d3dcompiler: Store some builtin types in the hlsl_ctx 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-06-03 22:55:18 +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 d46065d1f3 d3dcompiler: Do not store matrix and vector indexes as deref instructions.
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-19 21:32:46 +02:00
Zebediah Figura 0d9ddc4372 d3dcompiler: Synthesize a variable when indexing a non-deref node.
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-19 21:32:43 +02:00
Zebediah Figura 749e6be4d6 d3dcompiler: Synthesize a variable when subscripting a non-deref node.
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-19 21:32:41 +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 d9db4beb3b d3dcompiler: Set the x-dimension for struct 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:11 +02:00
Zebediah Figura aa333c63fc d3dcompiler: Respect arrays in struct fields.
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:07 +02:00
Zebediah Figura 867fe22346 d3dcompiler: Set the struct base type to HLSL_TYPE_VOID.
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:05 +02:00
Zebediah Figura 4952bcfa4c d3dcompiler: Fix matrix dimension declaration and access.
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:02 +02:00
Zebediah Figura 53e6b328f6 d3dcompiler: Avoid using the lookahead token for location.
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:31 +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 d05ee3674e d3dcompiler: Check for multiple matrix majority keywords on typedefs.
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:15 +02:00
Zebediah Figura 0340b0b044 d3dcompiler: Compute liveness ranges for anonymous nodes.
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:38 +02:00
Zebediah Figura 2738e5d2b8 d3dcompiler: Compute liveness ranges for variables.
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:36 +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 e0948524f2 d3dcompiler: Fix the location for a warning.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-24 19:43:38 +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 f9ce3c7c7a d3dcompiler: Move modifer processing up out of the struct_spec rules.
So that storage classes will be stored in the relevant hlsl_ir_var instead of in
the type.

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 756ed811c7 d3dcompiler: Apply type modifiers to the hlsl_type.
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-13 20:09:30 +01:00
Zebediah Figura afd3a1e388 d3dcompiler: Fail if modifiers are applied to a function.
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-13 20:09:30 +01:00
Zebediah Figura eb4fc30463 d3dcompiler: Don't add the default matrix majority attribute to variables.
This is a type modifier, and thus does not make a lot of sense on 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-13 20:09:30 +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