// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s // CHECK: spv.globalVariable @var0 bind(1, 0) : !spv.ptr // CHECK-NEXT: spv.globalVariable @var1 bind(0, 1) : !spv.ptr // CHECK-NEXT: spv.globalVariable @var2 built_in("GlobalInvocationId") : !spv.ptr, Input> // CHECK-NEXT: spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr, Input> spv.module Logical GLSL450 requires #spv.vce { spv.globalVariable @var0 bind(1, 0) : !spv.ptr spv.globalVariable @var1 bind(0, 1) : !spv.ptr spv.globalVariable @var2 {built_in = "GlobalInvocationId"} : !spv.ptr, Input> spv.globalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr, Input> } // ----- spv.module Logical GLSL450 requires #spv.vce { // CHECK: spv.globalVariable @var1 : !spv.ptr // CHECK-NEXT: spv.globalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr spv.globalVariable @var1 : !spv.ptr spv.globalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr } // ----- spv.module Logical GLSL450 requires #spv.vce { spv.globalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr, Input> spv.func @foo() "None" { // CHECK: %[[ADDR:.*]] = spv.mlir.addressof @globalInvocationID : !spv.ptr, Input> %0 = spv.mlir.addressof @globalInvocationID : !spv.ptr, Input> %1 = spv.constant 0: i32 // CHECK: spv.AccessChain %[[ADDR]] %2 = spv.AccessChain %0[%1] : !spv.ptr, Input>, i32 spv.Return } }