1#!amber 2# Copyright 2021 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 16DEVICE_FEATURE sampleRateShading 17 18SHADER vertex vert_shader PASSTHROUGH 19 20SHADER fragment frag_shader GLSL 21#version 440 22layout(location = 0) out vec4 color; 23 24void main (void) 25{ 26 if (gl_SampleID == 0) 27 color = vec4(1, 0, 0, 1); 28 else if (gl_SampleID == 1) 29 color = vec4(0, 1, 0, 1); 30 else if (gl_SampleID == 2) 31 color = vec4(0, 0, 1, 1); 32 else 33 color = vec4(1, 1, 1, 1); 34} 35END 36 37IMAGE framebuffer_ms FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4 38IMAGE framebuffer FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 39 40PIPELINE graphics pipeline 41 ATTACH vert_shader 42 ATTACH frag_shader 43 FRAMEBUFFER_SIZE 64 64 44 BIND BUFFER framebuffer_ms AS color LOCATION 0 45 BIND BUFFER framebuffer AS resolve 46END 47 48RUN pipeline DRAW_RECT POS 0 0 SIZE 64 64 49 50EXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 128 128 128 255 TOLERANCE 5% 51