• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2# Copyright 2019 The Amber Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
17
18SHADER compute my_shader SPIRV-ASM
19               OpCapability Shader
20               OpExtension "SPV_KHR_storage_buffer_storage_class"
21               OpMemoryModel Logical GLSL450
22               OpEntryPoint GLCompute %18 "foo"
23               OpSource OpenCL_C 120
24               OpDecorate %11 SpecId 0
25               OpDecorate %12 SpecId 1
26               OpDecorate %13 SpecId 2
27               OpDecorate %_runtimearr_uint ArrayStride 4
28               OpMemberDecorate %_struct_3 0 Offset 0
29               OpDecorate %_struct_3 Block
30               OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
31               OpDecorate %16 DescriptorSet 0
32               OpDecorate %16 Binding 0
33               OpDecorate %17 DescriptorSet 0
34               OpDecorate %17 Binding 1
35       %uint = OpTypeInt 32 0
36%_runtimearr_uint = OpTypeRuntimeArray %uint
37  %_struct_3 = OpTypeStruct %_runtimearr_uint
38%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
39       %void = OpTypeVoid
40          %6 = OpTypeFunction %void
41%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
42     %v3uint = OpTypeVector %uint 3
43%_ptr_Private_v3uint = OpTypePointer Private %v3uint
44     %uint_0 = OpConstant %uint 0
45         %11 = OpSpecConstant %uint 1
46         %12 = OpSpecConstant %uint 1
47         %13 = OpSpecConstant %uint 1
48%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %11 %12 %13
49         %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize
50         %16 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
51         %17 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
52         %18 = OpFunction %void None %6
53         %19 = OpLabel
54         %20 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %uint_0
55         %21 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0
56         %22 = OpLoad %uint %20
57               OpStore %21 %22
58               OpReturn
59               OpFunctionEnd
60
61END
62
63BUFFER in_buf DATA_TYPE uint32 DATA
64 9
65END
66BUFFER out_buf DATA_TYPE uint32 SIZE 1 FILL 0
67
68PIPELINE compute my_pipeline
69  ATTACH my_shader ENTRY_POINT foo
70  BIND BUFFER in_buf AS storage DESCRIPTOR_SET 0 BINDING 0
71  BIND BUFFER out_buf AS storage DESCRIPTOR_SET 0 BINDING 1
72END
73
74RUN my_pipeline 1 1 1
75
76EXPECT out_buf EQ_BUFFER in_buf
77
78