1e5c31af7Sopenharmony_ci#!amber 2e5c31af7Sopenharmony_ci# 3e5c31af7Sopenharmony_ci# Copyright 2020 The Amber Authors. 4e5c31af7Sopenharmony_ci# 5e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 6e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License. 7e5c31af7Sopenharmony_ci# You may obtain a copy of the License at 8e5c31af7Sopenharmony_ci# 9e5c31af7Sopenharmony_ci# https://www.apache.org/licenses/LICENSE-2.0 10e5c31af7Sopenharmony_ci# 11e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 12e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 13e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and 15e5c31af7Sopenharmony_ci# limitations under the License. 16e5c31af7Sopenharmony_ci 17e5c31af7Sopenharmony_ciSHADER vertex vtex_shader GLSL 18e5c31af7Sopenharmony_ci#version 430 19e5c31af7Sopenharmony_ci 20e5c31af7Sopenharmony_cilayout(location = 0) in vec4 position; 21e5c31af7Sopenharmony_cilayout(location = 0) out vec4 frag_color; 22e5c31af7Sopenharmony_ci 23e5c31af7Sopenharmony_cilayout(set = 0, binding = 0) readonly buffer block1 { 24e5c31af7Sopenharmony_ci vec4 in_color; 25e5c31af7Sopenharmony_ci}; 26e5c31af7Sopenharmony_ci 27e5c31af7Sopenharmony_civoid main() { 28e5c31af7Sopenharmony_ci gl_Position = position; 29e5c31af7Sopenharmony_ci frag_color = in_color; 30e5c31af7Sopenharmony_ci} 31e5c31af7Sopenharmony_ciEND 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_ciSHADER fragment frag_shader GLSL 34e5c31af7Sopenharmony_ci#version 430 35e5c31af7Sopenharmony_ci 36e5c31af7Sopenharmony_cilayout(location = 0) in vec4 frag_color; 37e5c31af7Sopenharmony_cilayout(location = 0) out vec4 final_color; 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_civoid main() { 40e5c31af7Sopenharmony_ci final_color = frag_color; 41e5c31af7Sopenharmony_ci} 42e5c31af7Sopenharmony_ciEND 43e5c31af7Sopenharmony_ci 44e5c31af7Sopenharmony_ciBUFFER data_buf1 DATA_TYPE vec4<float> DATA 1 0 0 1 END 45e5c31af7Sopenharmony_ciBUFFER data_buf2 DATA_TYPE vec4<float> DATA 0 1 0 1 END 46e5c31af7Sopenharmony_ciBUFFER data_buf3 DATA_TYPE vec4<float> DATA 0 0 1 1 END 47e5c31af7Sopenharmony_ciBUFFER data_buf4 DATA_TYPE vec4<float> DATA .5 0 .5 1 END 48e5c31af7Sopenharmony_ci 49e5c31af7Sopenharmony_ciBUFFER frame FORMAT B8G8R8A8_UNORM 50e5c31af7Sopenharmony_ci 51e5c31af7Sopenharmony_ciPIPELINE graphics pipeline1 52e5c31af7Sopenharmony_ci ATTACH vtex_shader 53e5c31af7Sopenharmony_ci ATTACH frag_shader 54e5c31af7Sopenharmony_ci 55e5c31af7Sopenharmony_ci FRAMEBUFFER_SIZE 800 600 56e5c31af7Sopenharmony_ci BIND BUFFER frame AS color LOCATION 0 57e5c31af7Sopenharmony_ci BIND BUFFER data_buf1 AS storage DESCRIPTOR_SET 0 BINDING 0 58e5c31af7Sopenharmony_ciEND 59e5c31af7Sopenharmony_ciDERIVE_PIPELINE pipeline2 FROM pipeline1 60e5c31af7Sopenharmony_ci BIND BUFFER data_buf2 AS storage DESCRIPTOR_SET 0 BINDING 0 61e5c31af7Sopenharmony_ciEND 62e5c31af7Sopenharmony_ciDERIVE_PIPELINE pipeline3 FROM pipeline1 63e5c31af7Sopenharmony_ci BIND BUFFER data_buf3 AS storage DESCRIPTOR_SET 0 BINDING 0 64e5c31af7Sopenharmony_ciEND 65e5c31af7Sopenharmony_ciDERIVE_PIPELINE pipeline4 FROM pipeline1 66e5c31af7Sopenharmony_ci BIND BUFFER data_buf4 AS storage DESCRIPTOR_SET 0 BINDING 0 67e5c31af7Sopenharmony_ciEND 68e5c31af7Sopenharmony_ci 69e5c31af7Sopenharmony_ciCLEAR pipeline1 70e5c31af7Sopenharmony_ciRUN pipeline1 DRAW_GRID POS 0 0 SIZE 400 300 CELLS 2 3 71e5c31af7Sopenharmony_ciRUN pipeline2 DRAW_GRID POS 0 300 SIZE 400 300 CELLS 1 1 72e5c31af7Sopenharmony_ciRUN pipeline3 DRAW_GRID POS 400 0 SIZE 400 300 CELLS 100 100 73e5c31af7Sopenharmony_ciRUN pipeline4 DRAW_GRID POS 400 300 SIZE 400 300 CELLS 1 71 74e5c31af7Sopenharmony_ci 75e5c31af7Sopenharmony_ciEXPECT frame IDX 0 0 SIZE 400 300 EQ_RGBA 255 0 0 255 76e5c31af7Sopenharmony_ciEXPECT frame IDX 0 300 SIZE 400 300 EQ_RGBA 0 255 0 255 77e5c31af7Sopenharmony_ciEXPECT frame IDX 400 0 SIZE 400 300 EQ_RGBA 0 0 255 255 78e5c31af7Sopenharmony_ciEXPECT frame IDX 400 300 SIZE 400 300 EQ_RGBA 127 0 127 255 TOLERANCE 1 0 1 0 79