1e5c31af7Sopenharmony_ci#!amber 2e5c31af7Sopenharmony_ci# Copyright 2020 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_ciSHADER vertex vert_shader GLSL 17e5c31af7Sopenharmony_ci#version 430 18e5c31af7Sopenharmony_ci 19e5c31af7Sopenharmony_cilayout(location = 0) in vec4 position; 20e5c31af7Sopenharmony_cilayout(location = 1) flat out vec4 frag_color; 21e5c31af7Sopenharmony_ci 22e5c31af7Sopenharmony_civoid main() { 23e5c31af7Sopenharmony_ci gl_Position = position; 24e5c31af7Sopenharmony_ci frag_color = position; 25e5c31af7Sopenharmony_ci} 26e5c31af7Sopenharmony_ciEND 27e5c31af7Sopenharmony_ci 28e5c31af7Sopenharmony_ciSHADER fragment frag_shader GLSL 29e5c31af7Sopenharmony_ci#version 430 30e5c31af7Sopenharmony_cilayout(location = 0) out vec4 color_out; 31e5c31af7Sopenharmony_cilayout(location = 1) flat in vec4 frag_color; 32e5c31af7Sopenharmony_civoid main() { 33e5c31af7Sopenharmony_ci ivec2 iv = ivec2(frag_color.xy * 256); 34e5c31af7Sopenharmony_ci if ((iv.x & 64) + ((iv.y / 2) & 64) == 64) 35e5c31af7Sopenharmony_ci color_out = vec4(1, 0, 0, 1); 36e5c31af7Sopenharmony_ci else 37e5c31af7Sopenharmony_ci color_out = vec4(0, 1, 1, 1); 38e5c31af7Sopenharmony_ci} 39e5c31af7Sopenharmony_ciEND 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_ciBUFFER framebuffer FORMAT B8G8R8A8_UNORM 42e5c31af7Sopenharmony_ci 43e5c31af7Sopenharmony_ciPIPELINE graphics my_pipeline 44e5c31af7Sopenharmony_ci ATTACH vert_shader 45e5c31af7Sopenharmony_ci ATTACH frag_shader 46e5c31af7Sopenharmony_ci BIND BUFFER framebuffer AS color LOCATION 0 47e5c31af7Sopenharmony_ciEND 48e5c31af7Sopenharmony_ci 49e5c31af7Sopenharmony_ciRUN my_pipeline DRAW_GRID POS 0 0 SIZE 250 250 CELLS 8 4 50e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 0 0 SIZE 30 60 EQ_RGBA 0 255 255 255 51e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 32 64 SIZE 30 60 EQ_RGBA 0 255 255 255 52e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 32 0 SIZE 30 60 EQ_RGBA 255 0 0 255 53e5c31af7Sopenharmony_ciEXPECT framebuffer IDX 0 64 SIZE 30 60 EQ_RGBA 255 0 0 255 54e5c31af7Sopenharmony_ci 55