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[require] 16vertexPipelineStoresAndAtomics 17 18[vertex shader] 19#version 430 20 21layout(location = 0) in vec4 position; 22layout(location = 1) in vec4 vert_color; 23layout(location = 0) out vec4 frag_color; 24 25layout(set = 0, binding = 0) buffer block0 { 26 vec4 addon0; 27 vec4 addon1; 28}; 29 30layout(set = 1, binding = 0) buffer block1 { 31 float data_set1_binding0[11]; 32 float data_set1_binding0_result[11]; 33}; 34 35layout(set = 1, binding = 2) buffer block2 { 36 float data_set1_binding2[11]; 37 float data_set1_binding2_result[11]; 38}; 39 40layout(set = 2, binding = 1) buffer block3 { 41 float data_set2_binding1[11]; 42 float data_set2_binding1_result[11]; 43}; 44 45layout(set = 2, binding = 3) buffer block4 { 46 float data_set2_binding3[11]; 47 float data_set2_binding3_result[11]; 48}; 49 50void main() { 51 gl_Position = position; 52 frag_color = vert_color + (addon0 + addon1) / 2.0f; 53 54 for (int i = 0; i < 11; ++i) { 55 data_set1_binding0_result[i] = data_set1_binding2[i]; 56 data_set1_binding2_result[i] = data_set2_binding1[i]; 57 data_set2_binding1_result[i] = data_set2_binding3[i]; 58 data_set2_binding3_result[i] = data_set1_binding0[i]; 59 } 60} 61 62[fragment shader] 63#version 430 64 65layout(location = 0) in vec4 frag_color; 66layout(location = 0) out vec4 final_color; 67 68void main() { 69 final_color = frag_color; 70} 71 72[vertex data] 73# position vert_color 740/R32G32_SFLOAT 1/R32G32B32A32_SFLOAT 75 76# R32 G32 R32 G32 B32 B32 77 -1.0 -1.0 0.5 0.25 0.125 0 78 1.0 1.0 0.5 0.25 0.125 0 79 -1.0 1.0 0.5 0.25 0.125 0 80 81 -1.0 -1.0 0.5 0.25 0.125 0 82 1.0 1.0 0.5 0.25 0.125 0 83 1.0 -1.0 0.5 0.25 0.125 0 84 85[test] 86clear 87 88# Allocate enough space for the uniform buffers including 16-byte alignment. 89ssbo 1:0 96 90ssbo 1:2 96 91ssbo 2:1 96 92ssbo 2:3 96 93 94ssbo 0 subdata float 0 0.1 0.2 0.3 0.4 95ssbo 0 subdata float 16 0.9 0.8 0.7 0.6 96 97ssbo 1:0 subdata float 0 0.1 0.2 0.3 0.4 98ssbo 1:2 subdata float 0 0.1 0.2 0.3 0.4 99ssbo 2:1 subdata float 0 0.1 0.2 0.3 0.4 100ssbo 2:3 subdata float 0 0.1 0.2 0.3 0.4 101 102draw arrays TRIANGLE_LIST 0 6 103relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0.75, 0.625, 0.5) 104 105 106 107ssbo 0 subdata float 0 0.5 0.5 0.25 1.0 \ 108 0.3 0.2 0.1 0.4 \ 109 0 0 0 0 110 111ssbo 1:0 subdata float 0 0.1 0.2 0.3 0.4 \ 112 0.5 0.6 0.7 0.8 \ 113 0.9 0.10 0.11 \ 114 0.1 0.2 0.3 0.4 \ 115 0.5 0.6 0.7 0.8 \ 116 0.9 0.10 0.11 117 118ssbo 1:2 subdata float 0 0.57 0.56 0.55 0.54 \ 119 0.53 0.52 0.51 0.50 \ 120 0.49 0.48 0.47 \ 121 0.57 0.56 0.55 0.54 \ 122 0.53 0.52 0.51 0.50 \ 123 0.49 0.48 0.47 124 125ssbo 2:1 subdata float 0 0.21 0.22 0.23 0.24 \ 126 0.25 0.26 0.27 0.28 \ 127 0.29 0.30 0.31 \ 128 0.21 0.22 0.23 0.24 \ 129 0.25 0.26 0.27 0.28 \ 130 0.29 0.30 0.31 131 132ssbo 2:3 subdata float 0 0.23 0.229 0.228 0.227 \ 133 0.226 0.225 0.224 0.223 \ 134 0.222 0.221 0.22 \ 135 0.23 0.229 0.228 0.227 \ 136 0.226 0.225 0.224 0.223 \ 137 0.222 0.221 0.22 138 139draw arrays TRIANGLE_LIST 0 6 140relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.9, 0.6, 0.3, 0.7) 141 142probe ssbo float 1:0 0 ~= 0.1 0.2 0.3 0.4 \ 143 0.5 0.6 0.7 0.8 \ 144 0.9 0.10 0.11 145probe ssbo float 1:0 44 ~= 0.57 0.56 0.55 0.54 \ 146 0.53 0.52 0.51 0.50 \ 147 0.49 0.48 0.47 148 149probe ssbo float 1:2 0 ~= 0.57 0.56 0.55 0.54 \ 150 0.53 0.52 0.51 0.50 \ 151 0.49 0.48 0.47 152probe ssbo float 1:2 44 ~= 0.21 0.22 0.23 0.24 \ 153 0.25 0.26 0.27 0.28 \ 154 0.29 0.30 0.31 155 156probe ssbo float 2:1 0 ~= 0.21 0.22 0.23 0.24 \ 157 0.25 0.26 0.27 0.28 \ 158 0.29 0.30 0.31 159probe ssbo float 2:1 44 ~= 0.23 0.229 0.228 0.227 \ 160 0.226 0.225 0.224 0.223 \ 161 0.222 0.221 0.22 162 163probe ssbo float 2:3 0 ~= 0.23 0.229 0.228 0.227 \ 164 0.226 0.225 0.224 0.223 \ 165 0.222 0.221 0.22 166probe ssbo float 2:3 44 ~= 0.1 0.2 0.3 0.4 \ 167 0.5 0.6 0.7 0.8 \ 168 0.9 0.10 0.11 169 170 171 172ssbo 0 subdata float 8 \ 1730.35 0.6 \ 1740.1 0.4 175draw arrays TRIANGLE_LIST 0 6 176relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.8, 0.7, 0.35, 0.5) 177