Commit Graph

460 Commits

Author SHA1 Message Date
5c285adc6b vkd3d-shader/hlsl: Use hlsl_ir_index for array and record access.
From this point on, it is no longer true that only hlsl_ir_loads can
return objects, because an object can also come from chain of
hlsl_ir_indexes that ends in an hlsl_ir_load.

The lower_index_loads pass takes care of lowering all hlsl_ir_indexes
into hlsl_ir_loads.

For this reason, hlsl_resource_load_params now expects both the resource
as the sampler to be just an hlsl_ir_node pointer instead of a pointer
to a more specific hlsl_ir_load.
2023-04-13 23:05:32 +02:00
741c9e5893 vkd3d-shader/hlsl: Introduce hlsl_ir_index.
This node type is intended for use during parse-time.

While we parse an indexing expression such as "a[3]", we don't know if
it will end up as part of an expression (in which case it must be folded
into a load) or it is for the lhs of a store (in which case it must be
folded into the store's deref).
2023-04-13 23:05:25 +02:00
725d408974 vkd3d-shader/hlsl: Introduce an hlsl_block_init() helper. 2023-04-06 17:51:40 +02:00
1da5a9a490 vkd3d-shader/hlsl: Introduce an hlsl_block_add_block() helper. 2023-04-06 17:51:38 +02:00
ceac81b816 vkd3d-shader/hlsl: Introduce an hlsl_block_add_instr() helper. 2023-04-06 17:51:36 +02:00
60237cb773 vkd3d-shader/hlsl: Don't allow manual and automatic cbuffer offset packing. 2023-04-04 21:59:45 +02:00
4aca335f42 vkd3d-shader/hlsl: Parse packoffset(). 2023-04-04 21:59:40 +02:00
9b70971696 vkd3d-shader/hlsl: Rename struct hlsl_reg_reservation fields. 2023-04-04 21:59:39 +02:00
7a9e393ea0 vkd3d-shader/hlsl: Rename the "type" field of struct hlsl_type to "class".
To be consistent with enum hlsl_type_class and HLSL_CLASS_*.
2023-04-03 17:59:24 +02:00
4110f1e547 vkd3d-shader: Fix a few typos in the comments. 2023-03-15 20:13:27 +01:00
ae2f777a4d vkd3d-shader/hlsl: Parse multisample texture type names. 2023-03-08 20:15:09 +01:00
75ab9d31ef vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask. 2023-02-28 22:06:58 +01:00
891217664a vkd3d-shader/hlsl: Support case-insensitive lookup for builtin 'dword' type. 2023-02-23 21:46:38 +01:00
e0031d2a1f vkd3d-shader/hlsl: Keep an hlsl_reg for each register set in hlsl_ir_var. 2023-02-22 18:28:19 +01:00
d07247249a vkd3d-shader/hlsl: Store the type's register size for each register set. 2023-02-22 18:28:19 +01:00
d86db8bcbe vkd3d-shader/hlsl: Support lit() intrinsic. 2023-02-21 21:09:52 +01:00
7c3dadce6b vkd3d-shader/hlsl: Write SM4 break instructions. 2023-02-15 21:53:21 +01:00
4b944517b7 vkd3d-shader/hlsl: Inline function calls. 2023-02-13 22:16:53 +01:00
8bdee6681b vkd3d-shader/hlsl: Lower return statements. 2023-02-13 22:16:51 +01:00
bb41c3b5fe vkd3d-shader/hlsl: Skip functions that don't have a body when looking for the entry point. 2023-02-13 22:16:48 +01:00
25d49b518d vkd3d-shader/hlsl: Put synthetic variables into a dummy scope.
Prevent them from being ever looked up.

Our naming scheme for synthetic variables already effectively prevents this, but
this is better for clarity. We also will need to be able to move some named
variables into a dummy scope to account for complexities around function
definition and declarations.
2023-02-07 22:15:06 +01:00
8755a92196 vkd3d-shader/hlsl: Add a hlsl_cleanup_semantic() helper. 2023-02-07 22:15:06 +01:00
cb2c89a589 vkd3d-shader/hlsl: Store function parameters in an array. 2023-02-07 22:15:06 +01:00
06f300ec59 vkd3d-shader/hlsl: Support dot() for SM1. 2023-02-02 20:51:12 +01:00
404a2d6a3d vkd3d-shader/hlsl: Reinterpret minimum precision types as their regular counterparts.
Reinterpret min16float, min10float, min16int, min12int, and min16uint
as their regular counterparts: float, float, int, int, uint,
respectively.

A proper implementation would require adding minimum precision
indicators to all the dxbc-tpf instructions that use these types.
Consider the output of fxc 10.1 with the following shader:

    uniform int i;

    float4 main() : sv_target
    {
        min16float4 a = {0, 1, 2, i};
        min16int2 b = {4, i};
        min10float3 c = {6.4, 7, i};
        min12int d = 9.4;
        min16uint4x2 e = {14.4, 15, 16, 17, 18, 19, 20, i};

        return mul(e, b) + a + c.xyzx + d;
    }

However, if the graphics driver doesn't have minimum precision support,
it ignores the minimum precision indicators and runs at 32-bit
precision, which is equivalent as working with regular types.
2023-01-25 22:10:23 +01:00