Skip to content

vkd3d-shader/hlsl: Introduce hlsl_ir_index, part 1/2.

Francisco Casas requested to merge fcasas/vkd3d:index_node_part into master

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). This node type is used to represent these accesses and no longer rely on building an hlsl_ir_load for each array index or struct record access.

hlsl_ir_index chains are lowered into derefs when (and if) they are used to specify the lhs of an assignment. All hlsl_ir_indexes are lowered into hlsl_ir_loads with a compilation pass.

The changes introduced in these series allow to solve the problem with the return variable of function calls presented in !93 (closed), and to properly support assignment to matrix indexes, which is something we are not doing correctly.

Further patches (in my index node branch) add support for indexing non-load expressions, such as (a + b)[1] and allowing to represent resource loads through hlsl_ir_index, so that hlsl_ir_resource_stores don't have to rely on hlsl_ir_resource_loads.

Merge request reports

Loading