• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2# Copyright 2020 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
16SHADER vertex vtex_shader GLSL
17#version 430
18
19layout(location = 0) in vec4 position;
20layout(location = 1) in vec4 vert_color;
21layout(location = 0) out vec4 frag_color;
22
23void main() {
24  gl_Position = position;
25  frag_color = vert_color;
26}
27END
28SHADER fragment frag_shader GLSL
29#version 430
30
31layout(location = 0) in vec4 frag_color;
32layout(location = 0) out vec4 final_color;
33
34void main() {
35  final_color = frag_color;
36}
37END
38
39BUFFER position_buf DATA_TYPE R8G8_SNORM DATA
40-128 -128
41   0  127
42-128  127
43-128 -128
44   0  127
45   0 -128
46
47   0 -128
48 127  127
49   0  127
50   0 -128
51 127  127
52 127 -128
53END
54
55BUFFER vert_color DATA_TYPE R8G8B8A8_UNORM DATA
56255   0   0 255
57  0 255   0 255
58255   0   0 255
59  0   0   0 255
60255   0   0 255
61  0 255   0 255
62255   0   0 255
63  0   0   0 255
64255   0   0 255
65  0 255   0 255
66255   0   0 255
67  0   0   0 255
68255   0   0 255
69  0 255   0 255
70255   0   0 255
71  0   0   0 255
72255   0   0 255
73  0 255   0 255
74255   0   0 255
75  0   0   0 255
76255   0   0 255
77  0 255   0 255
78END
79
80IMAGE framebuffer FORMAT B8G8R8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64
81
82PIPELINE graphics pipeline0
83  ATTACH vtex_shader
84  ATTACH frag_shader
85  VERTEX_DATA position_buf LOCATION 0
86  VERTEX_DATA vert_color LOCATION 1 STRIDE 8
87  BIND BUFFER framebuffer AS color LOCATION 0
88  FRAMEBUFFER_SIZE 64 64
89END
90
91PIPELINE graphics pipeline1
92  ATTACH vtex_shader
93  ATTACH frag_shader
94  VERTEX_DATA position_buf LOCATION 0 OFFSET 12
95  VERTEX_DATA vert_color LOCATION 1 OFFSET 4 STRIDE 16
96  BIND BUFFER framebuffer AS color LOCATION 0
97  FRAMEBUFFER_SIZE 64 64
98END
99
100CLEAR pipeline0
101
102RUN pipeline0 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
103RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
104
105EXPECT framebuffer IDX  0  0 SIZE 32 64 EQ_RGBA 255   0   0 255
106EXPECT framebuffer IDX 32  0 SIZE 32 64 EQ_RGBA   0 255   0 255
107