blob: 7a9c6d7a28357343da5d1cd1839dac5f6d0b3651 [file] [log] [blame]
#!amber
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SHADER vertex vert_shader GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in0;
layout(location = 2) in uvec2 color_in1;
layout(location = 3) in float color_in2;
layout(location = 0) smooth out vec4 color_out0;
layout(location = 1) flat out uvec2 color_out1;
layout(location = 2) smooth out float color_out2;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out0 = color_in0;
color_out1 = color_in1;
color_out2 = color_in2;
}
END
SHADER fragment frag_shader GLSL
#version 430
layout(location = 0) smooth in vec4 color_in0;
layout(location = 1) flat in uvec2 color_in1;
layout(location = 2) smooth in float color_in2;
layout(location = 0) out mediump float frag_out0;
layout(location = 1) out lowp uvec2 frag_out1;
layout(location = 2) out highp vec4 frag_out2;
void main()
{
frag_out0 = color_in2;
frag_out1 = color_in1;
frag_out2 = color_in0;
}
END
SHADER vertex vert_shader_ref0 GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec3 color_in;
layout(location = 0) smooth out vec3 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref0 GLSL
#version 430
layout(location = 0) smooth in vec3 color_in;
layout(location = 0) out mediump vec3 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_ref1 GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in uvec2 color_in;
layout(location = 0) flat out uvec2 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref1 GLSL
#version 430
layout(location = 0) flat in uvec2 color_in;
layout(location = 0) out lowp uvec2 frag_out;
void main()
{
frag_out = color_in;
}
END
SHADER vertex vert_shader_ref2 GLSL
#version 430
layout(location = 0) in vec2 position_in;
layout(location = 1) in vec4 color_in;
layout(location = 0) smooth out vec4 color_out;
void main()
{
gl_Position = vec4(position_in, 0, 1);
color_out = color_in;
}
END
SHADER fragment frag_shader_ref2 GLSL
#version 430
layout(location = 0) smooth in vec4 color_in;
layout(location = 0) out highp vec4 frag_out;
void main()
{
frag_out = color_in;
}
END
BUFFER framebuffer0 FORMAT R16_SFLOAT
BUFFER framebuffer1 FORMAT R8G8_UINT
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
BUFFER ref0 FORMAT R16_SFLOAT
BUFFER ref1 FORMAT R8G8_UINT
BUFFER ref2 FORMAT B8G8R8A8_UNORM
BUFFER position DATA_TYPE vec2<float> DATA
-1.0 -1.0
1.0 -1.0
1.0 1.0
-1.0 1.0
END
BUFFER color0 DATA_TYPE B8G8R8A8_UNORM DATA
255 0 0 255
0 255 0 255
0 0 255 255
255 255 0 255
END
BUFFER color1 DATA_TYPE R8G8_UINT DATA
0 255
0 0
255 255
255 0
END
BUFFER color2 DATA_TYPE R16_SFLOAT DATA
0.5
1.0
0.3
0.2
END
PIPELINE graphics pipeline
ATTACH vert_shader
ATTACH frag_shader
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
VERTEX_DATA color1 LOCATION 2
VERTEX_DATA color2 LOCATION 3
BIND BUFFER framebuffer0 AS color LOCATION 0
BIND BUFFER framebuffer1 AS color LOCATION 1
BIND BUFFER framebuffer2 AS color LOCATION 2
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref0
ATTACH vert_shader_ref0
ATTACH frag_shader_ref0
VERTEX_DATA position LOCATION 0
VERTEX_DATA color2 LOCATION 1
BIND BUFFER ref0 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref1
ATTACH vert_shader_ref1
ATTACH frag_shader_ref1
VERTEX_DATA position LOCATION 0
VERTEX_DATA color1 LOCATION 1
BIND BUFFER ref1 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
PIPELINE graphics pipeline_ref2
ATTACH vert_shader_ref2
ATTACH frag_shader_ref2
VERTEX_DATA position LOCATION 0
VERTEX_DATA color0 LOCATION 1
BIND BUFFER ref2 AS color LOCATION 0
FRAMEBUFFER_SIZE 60 60
END
RUN pipeline DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_FAN START_IDX 0 COUNT 4
EXPECT framebuffer0 EQ_BUFFER ref0
EXPECT framebuffer1 EQ_BUFFER ref1
EXPECT framebuffer2 EQ_BUFFER ref2