# Copyright 2019 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. [compute shader] #version 430 layout(set = 0, binding = 0) buffer block0 { uint data_set0_binding0[]; }; // push_constant compiled as std430 by glslang layout(push_constant) uniform block1 { uint constant0[3]; // Offset: 0, array stride: 4 uint constant1; // 12 uvec3 constant2[3]; // 16, array stride: 16 uint constant3; // 64 }; void main() { int offset = 0; for (int i = 0; i < 3; ++i) data_set0_binding0[offset++] = constant0[i]; data_set0_binding0[offset++] = constant1; for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) data_set0_binding0[offset++] = constant2[i][j]; data_set0_binding0[offset++] = constant3; } [test] ssbo 0:0 56 uniform uint 0 1 2 3 uniform uint 12 4 uniform uint 16 5 6 7 0 \ 8 9 10 0 \ 11 12 13 uniform uint 64 14 compute 3 1 1 probe ssbo uint 0:0 0 == 1 2 3 probe ssbo uint 0:0 12 == 4 probe ssbo uint 0:0 16 == 5 6 7 \ 8 9 10 \ 11 12 13 probe ssbo uint 0:0 52 == 14