Francisco Casas (@fcasas) commented about libs/vkd3d-shader/hlsl.y:
- if (!(store = hlsl_new_store_index(ctx, &hlsl_ir_load(lhs)->src, NULL, rhs, writemask, &rhs->loc))) - return NULL; - list_add_tail(instrs, &store->node.entry); + if (lhs->type == HLSL_IR_RESOURCE_LOAD) + { + struct hlsl_ir_resource_load *load = hlsl_ir_resource_load(lhs); + struct hlsl_ir_resource_store *store; + struct hlsl_type *resource_type; + struct hlsl_ir_swizzle *coords; + unsigned int dim_count; + + /* Such an lvalue was produced by an index expression. */ + assert(load->load_type == HLSL_RESOURCE_LOAD); + resource_type = load->resource.var->data_type; + assert(resource_type->type == HLSL_CLASS_OBJECT); + assert(resource_type->base_type == HLSL_TYPE_TEXTURE || resource_type->base_type == HLSL_TYPE_UAV); These assertions fail when the object loaded is a member of a struct or array, for instance, with the following test:
``` [uav 2] size (1, 1) 0.1 0.2 0.3 0.4 [uav 3] size (1, 1) 0.5 0.6 0.7 0.8 [pixel shader] RWTexture2D<float4> u[2] : register(u3); float4 main() : sv_target1 { u[0][uint2(0, 0)] = float4(1.1, 1.2, 1.3, 1.4); u[1][uint2(0, 0)] = float4(2.1, 2.2, 2.3, 2.4); return 0; } [test] draw quad probe uav 2 (0, 0) rgba (1.1, 1.2, 1.3, 1.4) probe uav 3 (0, 0) rgba (2.1, 2.2, 2.3, 2.4) ``` It may be good to replace them with an hlsl_fixme for now, similar to the one we have in write_sm4_resource_load(): ``` if (resource_type->type != HLSL_CLASS_OBJECT) { assert(resource_type->type == HLSL_CLASS_ARRAY || resource_type->type == HLSL_CLASS_STRUCT); hlsl_fixme(ctx, &load->node.loc, "Resource being a component of another variable."); return; } ``` Or outright supporting those cases if it proves to be simple enough. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/36#note_11720