1#!amber 2# 3# Copyright 2019 The Amber Authors. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# https://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17SHADER vertex vtex_shader GLSL 18#version 430 19 20layout(location = 0) in vec4 position; 21layout(location = 0) out vec4 frag_color; 22 23layout(set = 0, binding = 0) readonly buffer block1 { 24 vec4 in_color; 25}; 26 27void main() { 28 gl_Position = position; 29 frag_color = vec4(0.25, 0.5, 0.75, 1.0); 30} 31END 32 33SHADER fragment frag_shader GLSL 34#version 430 35 36layout(location = 0) in vec4 frag_color; 37layout(location = 0) out vec4 final_color; 38 39void main() { 40 final_color = frag_color; 41} 42END 43 44BUFFER frame1 FORMAT B8G8R8A8_UNORM 45BUFFER frame2 FORMAT B8G8R8A8_UNORM 46 47PIPELINE graphics pipeline1 48 ATTACH vtex_shader 49 ATTACH frag_shader 50 51 FRAMEBUFFER_SIZE 256 256 52 BIND BUFFER frame1 AS color LOCATION 0 53END 54 55PIPELINE graphics pipeline2 56 ATTACH vtex_shader 57 ATTACH frag_shader 58 59 FRAMEBUFFER_SIZE 256 256 60 BIND BUFFER frame2 AS color LOCATION 0 61END 62 63CLEAR pipeline1 64CLEAR pipeline2 65# Draw a rect to different parts of the frame buffers. 66# Histograms will still match. 67RUN pipeline1 DRAW_RECT POS 0 0 SIZE 128 128 68RUN pipeline2 DRAW_RECT POS 128 128 SIZE 128 128 69 70EXPECT frame1 EQ_HISTOGRAM_EMD_BUFFER frame2 TOLERANCE 0.1 71