# Copyright 2018 The Amber Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. [require] vertexPipelineStoresAndAtomics [vertex shader] #version 430 layout(location = 0) in vec4 position; layout(location = 1) in vec4 vert_color; layout(location = 0) out vec4 frag_color; layout(set = 0, binding = 0) uniform block0 { vec4 ubo_addon0; vec4 ubo_addon1; }; layout(set = 1, binding = 0) uniform block1 { float ubo_data_set1_binding0[11]; }; layout(set = 1, binding = 2) buffer block2 { float ssbo_data_set1_binding2[11]; }; layout(set = 2, binding = 1) uniform block3 { float ubo_data_set2_binding1[11]; }; layout(set = 2, binding = 3) buffer block4 { float ssbo_data_set2_binding3[11]; }; void main() { gl_Position = position; frag_color = vert_color + (ubo_addon0 + ubo_addon1) / 2.0f; for (int i = 0; i < 11; ++i) { ssbo_data_set1_binding2[i] = ubo_data_set2_binding1[i]; ssbo_data_set2_binding3[i] = ubo_data_set1_binding0[i]; } } [fragment shader] #version 430 layout(location = 0) in vec4 frag_color; layout(location = 0) out vec4 final_color; void main() { final_color = frag_color; } [vertex data] # position vert_color 0/R32G32_SFLOAT 1/R32G32B32A32_SFLOAT # R32 G32 R32 G32 B32 B32 -1.0 -1.0 0.5 0.25 0.125 0 1.0 1.0 0.5 0.25 0.125 0 -1.0 1.0 0.5 0.25 0.125 0 -1.0 -1.0 0.5 0.25 0.125 0 1.0 1.0 0.5 0.25 0.125 0 1.0 -1.0 0.5 0.25 0.125 0 [test] clear uniform ubo 0:0 vec4 0 0.1 0.2 0.3 0.4 uniform ubo 0:0 vec4 16 0.9 0.8 0.7 0.6 uniform ubo 1:0 float 0 0.1 0 0 0 \ 0.2 0 0 0 \ 0.3 0 0 0 \ 0.4 0 0 0 \ 0.5 0 0 0 \ 0.6 0 0 0 \ 0.7 0 0 0 \ 0.8 0 0 0 \ 0.9 0 0 0 \ 0.10 0 0 0 \ 0.11 0 0 0 ssbo 1:2 subdata float 0 0.1 0.2 0.3 0.4 \ 0.5 0.6 0.7 0.8 \ 0.9 0.10 0.11 uniform ubo 2:1 float 0 0.1 0 0 0 \ 0.2 0 0 0 \ 0.3 0 0 0 \ 0.4 0 0 0 \ 0.5 0 0 0 \ 0.6 0 0 0 \ 0.7 0 0 0 \ 0.8 0 0 0 \ 0.9 0 0 0 \ 0.10 0 0 0 \ 0.11 0 0 0 ssbo 2:3 subdata float 0 0.1 0.2 0.3 0.4 \ 0.5 0.6 0.7 0.8 \ 0.9 0.10 0.11 draw arrays TRIANGLE_LIST 0 6 relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0.75, 0.625, 0.5) uniform ubo 0:0 vec4 0 0.5 0.5 0.25 1.0 \ 0.3 0.2 0.1 0.4 ssbo 1:2 subdata float 0 0.57 0.56 0.55 0.54 \ 0.53 0.52 0.51 0.50 \ 0.49 0.48 0.47 uniform ubo 2:1 float 0 0.21 0 0 0 \ 0.22 0 0 0 \ 0.23 0 0 0 \ 0.24 0 0 0 \ 0.25 0 0 0 \ 0.26 0 0 0 \ 0.27 0 0 0 \ 0.28 0 0 0 \ 0.29 0 0 0 \ 0.30 0 0 0 \ 0.31 0 0 0 ssbo 2:3 subdata float 0 0.23 0.229 0.228 0.227 \ 0.226 0.225 0.224 0.223 \ 0.222 0.221 0.22 draw arrays TRIANGLE_LIST 0 6 relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.9, 0.6, 0.3, 0.7) probe ssbo float 1:2 0 ~= 0.21 0.22 0.23 0.24 \ 0.25 0.26 0.27 0.28 \ 0.29 0.30 0.31 probe ssbo float 2:3 0 ~= 0.1 0.2 0.3 0.4 \ 0.5 0.6 0.7 0.8 \ 0.9 0.10 0.11 uniform ubo 0:0 vec4 0 0.5 0.5 0.35 0.6 \ 0.1 0.4 0.1 0.4 draw arrays TRIANGLE_LIST 0 6 relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.8, 0.7, 0.35, 0.5)