1# Copyright 2018 The Amber Authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15[vertex shader] 16#version 430 17 18layout(location = 0) in vec4 position; 19layout(location = 1) in vec4 vert_color; 20layout(location = 0) out vec4 frag_color; 21 22void main() { 23 gl_Position = position; 24 frag_color = vert_color; 25} 26 27[fragment shader] 28#version 430 29 30layout(location = 0) in vec4 frag_color; 31layout(location = 0) out vec4 final_color; 32 33void main() { 34 final_color = frag_color; 35} 36 37[vertex data] 38# position vert_color 39 0/R8G8_SNORM 1/R8G8B8A8_UNORM 40 41# Red for entire frame 42# R8 G8 R8 G8 B8 A8 43 -128 -128 255 0 0 0 44 127 127 255 0 0 0 45 -128 127 255 0 0 0 46 47 -128 -128 255 0 0 0 48 127 127 255 0 0 0 49 127 -128 255 0 0 0 50 51# Green for half frame 52# R8 G8 R8 G8 B8 A8 53 0 -128 0 255 0 0 54 127 127 0 255 0 0 55 0 127 0 255 0 0 56 57 0 -128 0 255 0 0 58 127 127 0 255 0 0 59 127 -128 0 255 0 0 60 61# Blue for quarter frame 62# R8 G8 R8 G8 B8 A8 63 -128 0 0 0 255 0 64 0 127 0 0 255 0 65 -128 127 0 0 255 0 66 67 -128 0 0 0 255 0 68 0 127 0 0 255 0 69 0 0 0 0 255 0 70 71# Mixed color for quarter frame 72# R8 G8 R8 G8 B8 A8 73 0 0 127 127 127 0 74 127 127 127 127 127 0 75 0 127 127 127 127 0 76 77 0 0 127 127 127 0 78 127 127 127 127 127 0 79 127 0 127 127 127 0 80 81[test] 82clear 83 84draw arrays TRIANGLE_LIST 0 6 85relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0, 0) 86 87draw arrays TRIANGLE_LIST 6 6 88relative probe rect rgba (0.0, 0.0, 0.5, 1.0) (1.0, 0, 0, 0) 89relative probe rect rgba (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0, 0) 90 91draw arrays TRIANGLE_LIST 12 6 92relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0, 0) 93relative probe rect rgba (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0, 0) 94relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0, 0) 95 96draw arrays TRIANGLE_LIST 18 6 97relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0, 0) 98relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0, 0) 99relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0, 0) 100relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5, 0) 101