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 16[vertex shader] 17#version 430 18 19layout(location = 0) in vec4 position; 20layout(location = 1) in vec4 vert_color; 21layout(location = 0) out vec4 frag_color; 22 23layout(set = 0, binding = 0) readonly buffer block1 { 24 vec4 add_on; 25}; 26 27void main() { 28 gl_Position = position; 29 frag_color = vert_color + add_on; 30} 31 32[fragment shader] 33#version 430 34 35layout(location = 0) in vec4 frag_color; 36layout(location = 0) out vec4 final_color; 37 38void main() { 39 final_color = frag_color; 40} 41 42[vertex data] 43# position vert_color 440/R32G32_SFLOAT 1/R32G32B32A32_SFLOAT 45 46# R32 G32 R32 G32 B32 B32 47 -1.0 -1.0 0.5 0.25 0.125 0 48 1.0 1.0 0.5 0.25 0.125 0 49 -1.0 1.0 0.5 0.25 0.125 0 50 51 -1.0 -1.0 0.5 0.25 0.125 0 52 1.0 1.0 0.5 0.25 0.125 0 53 1.0 -1.0 0.5 0.25 0.125 0 54 55[test] 56ssbo 0 subdata vec4 0 0.1 0.2 0.3 0.4 57clear 58draw arrays TRIANGLE_LIST 0 6 59relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.6, 0.45, 0.425, 0.4) 60