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 20layout(location = 0) out vec4 color_out; 21layout(std140, binding = 0) readonly buffer Data { 22 float a; 23 float b; 24} data; 25 26void main() { 27 color_out = vec4(data.a/255, data.b/255, data.a/255, data.b/255); 28} 29END 30 31STRUCT my_data 32 float a 33 float b 34END 35 36BUFFER data DATA_TYPE my_data STD140 DATA 37 1 # a 38220 # b 39END 40 41BUFFER framebuffer FORMAT B8G8R8A8_UNORM 42 43PIPELINE graphics my_pipeline 44 ATTACH vert_shader 45 ATTACH frag_shader 46 47 BIND BUFFER framebuffer AS color LOCATION 0 48 BIND BUFFER data AS storage DESCRIPTOR_SET 0 BINDING 0 49END 50 51RUN my_pipeline DRAW_RECT POS 0 0 SIZE 250 250 52EXPECT framebuffer IDX 0 0 SIZE 250 250 EQ_RGBA 1 220 1 220 53