| #!amber |
| # Copyright 2019 The Amber Authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| SHADER compute my_shader SPIRV-ASM |
| OpCapability Shader |
| OpExtension "SPV_KHR_storage_buffer_storage_class" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %18 "foo" |
| OpSource OpenCL_C 120 |
| OpDecorate %11 SpecId 0 |
| OpDecorate %12 SpecId 1 |
| OpDecorate %13 SpecId 2 |
| OpDecorate %_runtimearr_uint ArrayStride 4 |
| OpMemberDecorate %_struct_3 0 Offset 0 |
| OpDecorate %_struct_3 Block |
| OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize |
| OpDecorate %16 DescriptorSet 0 |
| OpDecorate %16 Binding 0 |
| OpDecorate %17 DescriptorSet 0 |
| OpDecorate %17 Binding 1 |
| %uint = OpTypeInt 32 0 |
| %_runtimearr_uint = OpTypeRuntimeArray %uint |
| %_struct_3 = OpTypeStruct %_runtimearr_uint |
| %_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3 |
| %void = OpTypeVoid |
| %6 = OpTypeFunction %void |
| %_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint |
| %v3uint = OpTypeVector %uint 3 |
| %_ptr_Private_v3uint = OpTypePointer Private %v3uint |
| %uint_0 = OpConstant %uint 0 |
| %11 = OpSpecConstant %uint 1 |
| %12 = OpSpecConstant %uint 1 |
| %13 = OpSpecConstant %uint 1 |
| %gl_WorkGroupSize = OpSpecConstantComposite %v3uint %11 %12 %13 |
| %15 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize |
| %16 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer |
| %17 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer |
| %18 = OpFunction %void None %6 |
| %19 = OpLabel |
| %20 = OpAccessChain %_ptr_StorageBuffer_uint %16 %uint_0 %uint_0 |
| %21 = OpAccessChain %_ptr_StorageBuffer_uint %17 %uint_0 %uint_0 |
| %22 = OpLoad %uint %20 |
| OpStore %21 %22 |
| OpReturn |
| OpFunctionEnd |
| |
| END |
| |
| BUFFER in_buf DATA_TYPE uint32 DATA |
| 9 |
| END |
| BUFFER out_buf DATA_TYPE uint32 SIZE 1 FILL 0 |
| |
| PIPELINE compute my_pipeline |
| ATTACH my_shader ENTRY_POINT foo |
| BIND BUFFER in_buf AS storage DESCRIPTOR_SET 0 BINDING 0 |
| BIND BUFFER out_buf AS storage DESCRIPTOR_SET 0 BINDING 1 |
| END |
| |
| RUN my_pipeline 1 1 1 |
| |
| EXPECT out_buf EQ_BUFFER in_buf |
| |