1e5c31af7Sopenharmony_ci#!amber
2e5c31af7Sopenharmony_ci# Copyright 2021 The Amber Authors.
3e5c31af7Sopenharmony_ci#
4e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
5e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
6e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
7e5c31af7Sopenharmony_ci#
8e5c31af7Sopenharmony_ci#     https://www.apache.org/licenses/LICENSE-2.0
9e5c31af7Sopenharmony_ci#
10e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
11e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
12e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
14e5c31af7Sopenharmony_ci# limitations under the License.
15e5c31af7Sopenharmony_ci
16e5c31af7Sopenharmony_ciDEVICE_FEATURE sampleRateShading
17e5c31af7Sopenharmony_ci
18e5c31af7Sopenharmony_ciSHADER vertex vert_shader PASSTHROUGH
19e5c31af7Sopenharmony_ci
20e5c31af7Sopenharmony_ciSHADER fragment frag_shader GLSL
21e5c31af7Sopenharmony_ci#version 440
22e5c31af7Sopenharmony_cilayout(location = 0) out vec4 color;
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_civoid main (void)
25e5c31af7Sopenharmony_ci{
26e5c31af7Sopenharmony_ci    if (gl_SampleID == 0)
27e5c31af7Sopenharmony_ci        color = vec4(1, 0, 0, 1);
28e5c31af7Sopenharmony_ci    else if (gl_SampleID == 1)
29e5c31af7Sopenharmony_ci        color = vec4(0, 1, 0, 1);
30e5c31af7Sopenharmony_ci    else if (gl_SampleID == 2)
31e5c31af7Sopenharmony_ci        color = vec4(0, 0, 1, 1);
32e5c31af7Sopenharmony_ci    else 
33e5c31af7Sopenharmony_ci        color = vec4(1, 1, 1, 1);
34e5c31af7Sopenharmony_ci}
35e5c31af7Sopenharmony_ciEND
36e5c31af7Sopenharmony_ci
37e5c31af7Sopenharmony_ciIMAGE framebuffer_ms FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64 SAMPLES 4
38e5c31af7Sopenharmony_ciIMAGE framebuffer FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 64 HEIGHT 64
39e5c31af7Sopenharmony_ci
40e5c31af7Sopenharmony_ciPIPELINE graphics pipeline
41e5c31af7Sopenharmony_ci  ATTACH vert_shader
42e5c31af7Sopenharmony_ci  ATTACH frag_shader
43e5c31af7Sopenharmony_ci  FRAMEBUFFER_SIZE 64 64
44e5c31af7Sopenharmony_ci  BIND BUFFER framebuffer_ms AS color LOCATION 0
45e5c31af7Sopenharmony_ci  BIND BUFFER framebuffer AS resolve
46e5c31af7Sopenharmony_ciEND
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_ciRUN pipeline DRAW_RECT POS 0 0 SIZE 64 64
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 0 0 SIZE 64 64 EQ_RGBA 128 128 128 255 TOLERANCE 5%
51