• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2#
3# Copyright 2021 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
17SHADER vertex vert_shader GLSL
18#version 430
19
20layout(location = 0) in vec4 position;
21
22void main() {
23  gl_Position = vec4(position.xy, 0.5, 1.0);
24}
25END
26
27SHADER fragment frag_shader GLSL
28#version 430
29
30layout(location = 0) out vec4 final_color;
31
32void main() {
33  final_color = vec4(0, 1, 0, 1);
34}
35END
36
37BUFFER framebuffer FORMAT B8G8R8A8_UNORM
38
39PIPELINE graphics pipeline1
40  ATTACH vert_shader
41  ATTACH frag_shader
42
43  FRAMEBUFFER_SIZE 256 256
44  VIEWPORT 10.0 10.0 SIZE 100.0 100.0
45
46  BIND BUFFER framebuffer AS color LOCATION 0
47END
48
49CLEAR_COLOR pipeline1 255 255 255 255
50CLEAR pipeline1
51RUN pipeline1 DRAW_RECT POS 0 0 SIZE 256 256
52
53# Check within the viewport
54EXPECT framebuffer IDX 10 10 SIZE 100 100 EQ_RGBA   0 255   0 255
55# Check the borders were untouched
56EXPECT framebuffer IDX   0   0 SIZE  10 256 EQ_RGBA 255 255 255 255
57EXPECT framebuffer IDX 110   0 SIZE 146 256 EQ_RGBA 255 255 255 255
58EXPECT framebuffer IDX  10   0 SIZE 100  10 EQ_RGBA 255 255 255 255
59EXPECT framebuffer IDX  10 110 SIZE 100 146 EQ_RGBA 255 255 255 255
60