Adds support for accessing individual resources from fixed-size global resource arrays. Design proposal: https://github.com/llvm/wg-hlsl/blob/main/proposals/0028-resource-arrays.md Enables indexing into globally scoped, fixed-size resource arrays to retrieve individual resources. The initialization logic is primarily handled during codegen. When a global resource array is indexed, the codegen translates the `ArraySubscriptExpr` AST node into a constructor call for the corresponding resource record type and binding. To support this behavior, Sema needs to ensure that: - The constructor for the specific resource type is instantiated. - An implicit binding attribute is added to resource arrays that lack explicit bindings (#152452). Closes #145424
23 lines
716 B
HLSL
23 lines
716 B
HLSL
// RUN: %clang_cc1 -finclude-default-header -triple spirv-unknown-vulkan-compute -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
|
|
|
|
// CHECK: define internal spir_func void @__cxx_global_var_init()
|
|
// CHECK: [[entry_token:%.*]] = call token @llvm.experimental.convergence.entry()
|
|
// CHECK: br label %[[loop_entry:.*]]
|
|
|
|
// CHECK: [[loop_entry]]:
|
|
// CHECK: [[loop_token:%.*]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[entry_token]]) ]
|
|
// CHECK: call spir_func void {{.*}} [ "convergencectrl"(token [[loop_token]]) ]
|
|
// CHECK: br i1 {{%.*}} label {{%.*}} label %[[loop_entry]]
|
|
|
|
struct S {
|
|
int i;
|
|
S() { i = 10; }
|
|
};
|
|
|
|
static S s[2];
|
|
|
|
[numthreads(4,1,1)]
|
|
void main() {
|
|
}
|
|
|