1#!amber 2# Copyright 2021 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_color0; 21layout(location = 2) in vec4 vert_color1; 22layout(location = 0) out vec4 frag_color; 23 24void main() 25{ 26 gl_Position = position; 27 frag_color = vert_color0 + vert_color1; 28} 29END 30 31SHADER fragment frag_shader GLSL 32#version 430 33 34layout(location = 0) in vec4 frag_color; 35layout(location = 0) out vec4 final_color; 36 37void main() 38{ 39 final_color = frag_color; 40} 41END 42 43BUFFER position_buf DATA_TYPE R8G8_SNORM DATA 44-128 -128 45 127 127 46-128 127 47-128 -128 48 127 127 49 127 -128 50END 51 52BUFFER vert_color DATA_TYPE R8G8B8A8_UNORM DATA 53255 0 0 255 54255 0 0 255 55255 0 0 255 56255 0 0 255 57255 0 0 255 58255 0 0 255 59 60 0 255 0 255 61 0 255 0 255 62 0 255 0 255 63 0 255 0 255 64 0 255 0 255 65 0 255 0 255 66END 67 68BUFFER framebuffer FORMAT B8G8R8A8_UNORM 69 70PIPELINE graphics pipeline 71 ATTACH vtex_shader 72 ATTACH frag_shader 73 74 VERTEX_DATA position_buf LOCATION 0 75 VERTEX_DATA vert_color LOCATION 1 76 VERTEX_DATA vert_color LOCATION 2 OFFSET 24 77 78 BIND BUFFER framebuffer AS color LOCATION 0 79END 80 81CLEAR pipeline 82 83RUN pipeline DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6 84EXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 255 255 0 255 85