2019-09-24 10:56:49 +08:00
|
|
|
// RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s
|
|
|
|
|
2021-03-05 05:17:12 +08:00
|
|
|
// CHECK: spv.GlobalVariable @var0 bind(1, 0) : !spv.ptr<f32, Input>
|
|
|
|
// CHECK-NEXT: spv.GlobalVariable @var1 bind(0, 1) : !spv.ptr<f32, Output>
|
|
|
|
// CHECK-NEXT: spv.GlobalVariable @var2 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
|
|
|
|
// CHECK-NEXT: spv.GlobalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
|
2019-09-24 10:56:49 +08:00
|
|
|
|
2020-03-12 04:04:25 +08:00
|
|
|
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
2021-03-05 05:17:12 +08:00
|
|
|
spv.GlobalVariable @var0 bind(1, 0) : !spv.ptr<f32, Input>
|
|
|
|
spv.GlobalVariable @var1 bind(0, 1) : !spv.ptr<f32, Output>
|
|
|
|
spv.GlobalVariable @var2 {built_in = "GlobalInvocationId"} : !spv.ptr<vector<3xi32>, Input>
|
|
|
|
spv.GlobalVariable @var3 built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
|
2019-09-24 10:56:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----
|
|
|
|
|
2020-03-12 04:04:25 +08:00
|
|
|
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
2021-03-05 05:17:12 +08:00
|
|
|
// CHECK: spv.GlobalVariable @var1 : !spv.ptr<f32, Input>
|
|
|
|
// CHECK-NEXT: spv.GlobalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr<f32, Input>
|
|
|
|
spv.GlobalVariable @var1 : !spv.ptr<f32, Input>
|
|
|
|
spv.GlobalVariable @var2 initializer(@var1) bind(1, 0) : !spv.ptr<f32, Input>
|
2019-09-24 10:56:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----
|
|
|
|
|
2020-03-12 04:04:25 +08:00
|
|
|
spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
|
2021-03-05 05:17:12 +08:00
|
|
|
spv.GlobalVariable @globalInvocationID built_in("GlobalInvocationId") : !spv.ptr<vector<3xi32>, Input>
|
2020-02-08 00:30:19 +08:00
|
|
|
spv.func @foo() "None" {
|
2020-11-18 00:45:32 +08:00
|
|
|
// CHECK: %[[ADDR:.*]] = spv.mlir.addressof @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
|
|
|
|
%0 = spv.mlir.addressof @globalInvocationID : !spv.ptr<vector<3xi32>, Input>
|
2021-03-05 05:15:46 +08:00
|
|
|
%1 = spv.Constant 0: i32
|
2019-09-24 10:56:49 +08:00
|
|
|
// CHECK: spv.AccessChain %[[ADDR]]
|
2020-06-22 22:04:53 +08:00
|
|
|
%2 = spv.AccessChain %0[%1] : !spv.ptr<vector<3xi32>, Input>, i32
|
2019-09-24 10:56:49 +08:00
|
|
|
spv.Return
|
|
|
|
}
|
|
|
|
}
|