aboutsummaryrefslogtreecommitdiff
path: root/tests/cases/non_default_entry_point.amber
blob: 36b21354e9ec79378de0fc7f8e47fdbc751f27f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!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