1#!amber
2
3# Copyright 2020 The Amber Authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     https://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# AmberScript generated by GraphicsFuzz
18
19SHADER vertex gfz_vert PASSTHROUGH
20
21# Derived from the following GLSL.
22
23# Fragment shader GLSL:
24# #version 310 es
25# precision highp float;
26#
27# layout(location = 0) out vec4 _GLF_color;
28#
29# layout(set = 0, binding = 0) uniform buf0 {
30#  mat2x3 m;
31# };
32# void main() {
33#  _GLF_color = vec4(m[1][2], 0.0, 0.0, 1.0);
34# }
35SHADER fragment gfz_frag SPIRV-ASM
36; SPIR-V
37; Version: 1.0
38; Generator: Khronos Glslang Reference Front End; 7
39; Bound: 26
40; Schema: 0
41               OpCapability Shader
42          %1 = OpExtInstImport "GLSL.std.450"
43               OpMemoryModel Logical GLSL450
44               OpEntryPoint Fragment %4 "main" %9
45               OpExecutionMode %4 OriginUpperLeft
46               OpSource ESSL 310
47               OpName %4 "main"
48               OpName %9 "_GLF_color"
49               OpName %12 "buf0"
50               OpMemberName %12 0 "m"
51               OpName %14 ""
52               OpDecorate %9 Location 0
53               OpMemberDecorate %12 0 ColMajor
54               OpMemberDecorate %12 0 Offset 0
55               OpMemberDecorate %12 0 MatrixStride 16
56               OpDecorate %12 Block
57               OpDecorate %14 DescriptorSet 0
58               OpDecorate %14 Binding 0
59          %2 = OpTypeVoid
60          %3 = OpTypeFunction %2
61          %6 = OpTypeFloat 32
62          %7 = OpTypeVector %6 4
63          %8 = OpTypePointer Output %7
64          %9 = OpVariable %8 Output
65         %10 = OpTypeVector %6 3
66         %11 = OpTypeMatrix %10 2
67         %12 = OpTypeStruct %11
68         %13 = OpTypePointer Uniform %12
69         %14 = OpVariable %13 Uniform
70         %15 = OpTypeInt 32 1
71         %16 = OpConstant %15 0
72         %17 = OpConstant %15 1
73         %18 = OpTypeInt 32 0
74         %19 = OpConstant %18 2
75         %20 = OpTypePointer Uniform %6
76         %23 = OpConstant %6 0
77         %24 = OpConstant %6 1
78          %4 = OpFunction %2 None %3
79          %5 = OpLabel
80         %21 = OpAccessChain %20 %14 %16 %17 %19
81         %22 = OpLoad %6 %21
82         %25 = OpCompositeConstruct %7 %22 %23 %23 %24
83               OpStore %9 %25
84               OpReturn
85               OpFunctionEnd
86END
87
88BUFFER framebuffer FORMAT B8G8R8A8_UNORM
89BUFFER matrix DATA_TYPE mat2x3<float> DATA
90    1.0  64.0 128.0
91  200.0 220.0 255.0
92END
93
94PIPELINE graphics gfz_pipeline
95  ATTACH gfz_vert
96  ATTACH gfz_frag
97
98  FRAMEBUFFER_SIZE 256 256
99  BIND BUFFER framebuffer AS color LOCATION 0
100  BIND BUFFER matrix AS uniform DESCRIPTOR_SET 0 BINDING 0
101END
102
103CLEAR_COLOR gfz_pipeline 0 0 0 255
104CLEAR gfz_pipeline
105
106RUN gfz_pipeline DRAW_RECT POS 0 0 SIZE 256 256
107EXPECT framebuffer IDX 0 0 SIZE 256 256 EQ_RGBA 255 0 0 255
108
109