1#!amber 2# Copyright 2019 The Amber Authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# https://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16SHADER vertex vert_shader PASSTHROUGH 17SHADER fragment frag_shader GLSL 18#version 430 19 20struct s { 21 float space4; 22 float space5; 23 int d; 24 float space6; 25 int e; 26}; 27 28layout(location = 0) out vec4 color_out; 29layout(std430, binding = 0) readonly buffer Data { 30 float space1; 31 float space2; 32 float a; 33 float space3; 34 int b; 35 s c; 36} data; 37 38void main() { 39 color_out = vec4(float(data.a)/255, float(data.b)/255, 40 float(data.c.d)/255, float(data.c.e)/255); 41} 42END 43 44STRUCT s 45 int32 d OFFSET 8 46 int32 e OFFSET 16 47END 48 49STRUCT my_data 50 float a OFFSET 8 51 int32 b OFFSET 16 52 s c 53END 54 55BUFFER data DATA_TYPE my_data STD430 DATA 56 1 # a 57 64 # b 58128 # c.d 59220 # c.e 60END 61 62BUFFER framebuffer FORMAT B8G8R8A8_UNORM 63 64PIPELINE graphics my_pipeline 65 ATTACH vert_shader 66 ATTACH frag_shader 67 68 BIND BUFFER framebuffer AS color LOCATION 0 69 BIND BUFFER data AS storage DESCRIPTOR_SET 0 BINDING 0 70END 71 72RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 73EXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 1 64 128 220 74