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
16DEVICE_FEATURE fillModeNonSolid
17
18SHADER vertex vert_shader PASSTHROUGH
19
20SHADER fragment frag_shader GLSL
21#version 430
22
23layout(location = 0) out vec4 color;
24
25void main()
26{
27    color = vec4(1);
28}
29END
30
31BUFFER position_large DATA_TYPE R8G8_SNORM DATA
32-120 -120
33   0  120
34 120 -120
35END
36
37BUFFER position_small DATA_TYPE R8G8_SNORM DATA
38-60 -60
39  0  60
40 60 -60
41END
42
43BUFFER framebuffer FORMAT B8G8R8A8_UNORM
44
45PIPELINE graphics pipeline_line
46  ATTACH vert_shader
47  ATTACH frag_shader
48
49  VERTEX_DATA position_large LOCATION 0
50  POLYGON_MODE line
51
52  BIND BUFFER framebuffer AS color LOCATION 0
53  FRAMEBUFFER_SIZE 256 256
54END
55
56PIPELINE graphics pipeline_point
57  ATTACH vert_shader
58  ATTACH frag_shader
59
60  VERTEX_DATA position_small LOCATION 0
61  POLYGON_MODE point
62
63  BIND BUFFER framebuffer AS color LOCATION 0
64  FRAMEBUFFER_SIZE 256 256
65END
66
67PIPELINE graphics pipeline_line_grid
68  ATTACH vert_shader
69  ATTACH frag_shader
70  POLYGON_MODE line
71
72  BIND BUFFER framebuffer AS color LOCATION 0
73  FRAMEBUFFER_SIZE 256 256
74END
75
76CLEAR_COLOR pipeline_line 0 0 0 255
77CLEAR pipeline_line
78# Draw a large triangle with lines
79RUN pipeline_line DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3
80# Draw a rect with points
81RUN pipeline_point DRAW_RECT POS 20 20 SIZE 216 216
82# Draw a small triangle with points
83RUN pipeline_point DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 3
84# Draw a line grid overlapping the small triangle
85RUN pipeline_line_grid DRAW_GRID POS 80 40 SIZE 96 96 CELLS 3 3
86
87# Make sure no solid triangle was drawn by checking the center
88# of the middle grid triangle. That location is covered by all
89# drawn primitives.
90EXPECT framebuffer IDX 134 82 SIZE 5 5 EQ_RGBA 0 0 0 255
91