1#!amber 2# Copyright 2020 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 19layout(location = 0) out vec4 color_out; 20uniform layout(set=0, binding=0) samplerBuffer texels; 21 22void main() 23{ 24 color_out = texelFetch(texels, int(gl_FragCoord.x) % 4); 25} 26END 27 28BUFFER texel_buffer DATA_TYPE R8G8B8A8_UNORM DATA 29255 0 0 255 30 0 255 0 255 31 0 0 255 255 32 0 255 255 255 33END 34 35BUFFER framebuffer FORMAT B8G8R8A8_UNORM 36 37PIPELINE graphics pipeline 38 ATTACH vert_shader 39 ATTACH frag_shader 40 BIND BUFFER texel_buffer AS uniform_texel_buffer DESCRIPTOR_SET 0 BINDING 0 41 FRAMEBUFFER_SIZE 256 256 42 BIND BUFFER framebuffer AS color LOCATION 0 43END 44 45CLEAR_COLOR pipeline 0 0 255 255 46CLEAR pipeline 47RUN pipeline DRAW_RECT POS 50 50 SIZE 100 100 48 49EXPECT framebuffer IDX 50 50 SIZE 1 100 EQ_RGBA 0 0 255 255 50EXPECT framebuffer IDX 51 50 SIZE 1 100 EQ_RGBA 0 255 255 255 51EXPECT framebuffer IDX 52 50 SIZE 1 100 EQ_RGBA 255 0 0 255 52EXPECT framebuffer IDX 53 50 SIZE 1 100 EQ_RGBA 0 255 0 255 53EXPECT framebuffer IDX 54 50 SIZE 1 100 EQ_RGBA 0 0 255 255 54EXPECT framebuffer IDX 55 50 SIZE 1 100 EQ_RGBA 0 255 255 255 55EXPECT framebuffer IDX 56 50 SIZE 1 100 EQ_RGBA 255 0 0 255 56EXPECT framebuffer IDX 57 50 SIZE 1 100 EQ_RGBA 0 255 0 255 57