1#!amber 2# Copyright 2019 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 450 18 19layout(push_constant) uniform PushConstants { 20 vec2 in_val[4]; 21} u_pushConstants; 22 23void main() { 24 gl_Position = vec4(u_pushConstants.in_val[gl_VertexIndex], 0.0, 1.0); 25} 26END 27 28SHADER fragment frag_shader GLSL 29#version 430 30layout(location = 0) out vec4 outColor; 31 32void main() { 33 outColor = vec4(0.5, 0.5, 0.5, 1.0); 34} 35END 36 37BUFFER push_constants DATA_TYPE vec2<float> DATA 38-1.0 -1.0 39 1.0 -1.0 40-1.0 0.0 41 1.0 0.0 42END 43 44BUFFER framebuffer FORMAT B8G8R8A8_UNORM 45 46PIPELINE graphics pipeline 47 ATTACH vtex_shader 48 ATTACH frag_shader 49 50 BIND BUFFER push_constants AS push_constant 51 BIND BUFFER framebuffer AS color LOCATION 0 52 FRAMEBUFFER_SIZE 250 250 53END 54 55CLEAR pipeline 56RUN pipeline DRAW_RECT POS 0 0 SIZE 250 250 57 58EXPECT framebuffer IDX 0 0 SIZE 250 125 EQ_RGBA 127 127 127 255 TOLERANCE 1 1 1 0 59EXPECT framebuffer IDX 0 125 SIZE 250 125 EQ_RGBA 0 0 0 0 60