yes
This commit is contained in:
@@ -0,0 +1,224 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 The Khronos Group Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Red rect. fragDepth: 0.17
|
||||
# Green rect. fragDepth: 0.18
|
||||
# Depth color format: D16_UNORM
|
||||
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
|
||||
# Draw method: Patch List
|
||||
# Polygon Mode: Fill
|
||||
# TES primitive ordering: trianges, cw
|
||||
# Result: Green rectangle should be on top.
|
||||
|
||||
DEVICE_FEATURE tessellationShader
|
||||
|
||||
SHADER vertex vert GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = vec4(inPosition, 1.0);
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER tessellation_control tesc GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor[];
|
||||
layout (location = 0) patch out vec4 tcColor;
|
||||
layout (vertices = 3) out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float tessLevel = 2.0;
|
||||
|
||||
gl_TessLevelInner[0] = tessLevel;
|
||||
gl_TessLevelInner[1] = tessLevel;
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
tcColor = inColor[gl_InvocationID];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER tessellation_evaluation tese GLSL
|
||||
#version 450
|
||||
|
||||
layout (triangles, equal_spacing, cw) in;
|
||||
layout (location = 0) patch in vec4 patch_color;
|
||||
layout (location = 0) out vec4 tes_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) +
|
||||
(gl_TessCoord.y * gl_in[1].gl_Position) +
|
||||
(gl_TessCoord.z * gl_in[2].gl_Position);
|
||||
|
||||
tes_color = patch_color;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.17
|
||||
0.50 -0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
-0.50 0.50 0.17
|
||||
-0.50 -0.50 0.17
|
||||
END
|
||||
|
||||
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.18
|
||||
0.50 -0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
-0.50 0.50 0.18
|
||||
-0.50 -0.50 0.18
|
||||
END
|
||||
|
||||
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
|
||||
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics pipeline1
|
||||
ATTACH vert
|
||||
ATTACH tesc
|
||||
ATTACH tese
|
||||
ATTACH frag
|
||||
|
||||
POLYGON_MODE fill
|
||||
PATCH_CONTROL_POINTS 3
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VERTEX_DATA vertexPositionA LOCATION 0
|
||||
VERTEX_DATA vertexColorA LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline2
|
||||
ATTACH vert
|
||||
ATTACH tesc
|
||||
ATTACH tese
|
||||
ATTACH frag
|
||||
|
||||
POLYGON_MODE fill
|
||||
PATCH_CONTROL_POINTS 3
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant -700.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VERTEX_DATA vertexPositionB LOCATION 0
|
||||
VERTEX_DATA vertexColorB LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline1 0 0 0 255
|
||||
CLEAR_DEPTH pipeline1 0.3
|
||||
CLEAR pipeline1
|
||||
|
||||
CLEAR_COLOR pipeline2 0 0 0 255
|
||||
|
||||
RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
|
||||
RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the frame buffer contents.
|
||||
# The compute shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(local_size_x=10,local_size_y=10) in;
|
||||
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
|
||||
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 color = imageLoad(resultImage, uv);
|
||||
|
||||
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
|
||||
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
|
||||
}
|
||||
END
|
||||
|
||||
PIPELINE compute verify_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN verify_pipeline 10 10 1
|
||||
|
||||
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,225 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 The Khronos Group Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Red rect. fragDepth: 0.17
|
||||
# Green rect. fragDepth: 0.18
|
||||
# Depth color format: D16_UNORM
|
||||
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
|
||||
# Draw method: Patch List
|
||||
# Polygon Mode: Line
|
||||
# TES primitive ordering: trianges, cw
|
||||
# Result: Green rectangle should be on top.
|
||||
|
||||
DEVICE_FEATURE tessellationShader
|
||||
DEVICE_FEATURE fillModeNonSolid
|
||||
|
||||
SHADER vertex vert GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = vec4(inPosition, 1.0);
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER tessellation_control tesc GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor[];
|
||||
layout (location = 0) patch out vec4 tcColor;
|
||||
layout (vertices = 3) out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float tessLevel = 2.0;
|
||||
|
||||
gl_TessLevelInner[0] = tessLevel;
|
||||
gl_TessLevelInner[1] = tessLevel;
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
tcColor = inColor[gl_InvocationID];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER tessellation_evaluation tese GLSL
|
||||
#version 450
|
||||
|
||||
layout (triangles, equal_spacing, cw) in;
|
||||
layout (location = 0) patch in vec4 patch_color;
|
||||
layout (location = 0) out vec4 tes_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) +
|
||||
(gl_TessCoord.y * gl_in[1].gl_Position) +
|
||||
(gl_TessCoord.z * gl_in[2].gl_Position);
|
||||
|
||||
tes_color = patch_color;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.17
|
||||
0.50 -0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
-0.50 0.50 0.17
|
||||
-0.50 -0.50 0.17
|
||||
END
|
||||
|
||||
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.18
|
||||
0.50 -0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
-0.50 0.50 0.18
|
||||
-0.50 -0.50 0.18
|
||||
END
|
||||
|
||||
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
|
||||
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics pipeline1
|
||||
ATTACH vert
|
||||
ATTACH tesc
|
||||
ATTACH tese
|
||||
ATTACH frag
|
||||
|
||||
POLYGON_MODE line
|
||||
PATCH_CONTROL_POINTS 3
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VERTEX_DATA vertexPositionA LOCATION 0
|
||||
VERTEX_DATA vertexColorA LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline2
|
||||
ATTACH vert
|
||||
ATTACH tesc
|
||||
ATTACH tese
|
||||
ATTACH frag
|
||||
|
||||
POLYGON_MODE line
|
||||
PATCH_CONTROL_POINTS 3
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant -700.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VERTEX_DATA vertexPositionB LOCATION 0
|
||||
VERTEX_DATA vertexColorB LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline1 0 0 0 255
|
||||
CLEAR_DEPTH pipeline1 0.3
|
||||
CLEAR pipeline1
|
||||
|
||||
CLEAR_COLOR pipeline2 0 0 0 255
|
||||
|
||||
RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
|
||||
RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the frame buffer contents.
|
||||
# The compute shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(local_size_x=10,local_size_y=10) in;
|
||||
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
|
||||
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 color = imageLoad(resultImage, uv);
|
||||
|
||||
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
|
||||
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
|
||||
}
|
||||
END
|
||||
|
||||
PIPELINE compute verify_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN verify_pipeline 10 10 1
|
||||
|
||||
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,225 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 The Khronos Group Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Red rect. fragDepth: 0.17
|
||||
# Green rect. fragDepth: 0.18
|
||||
# Depth color format: D16_UNORM
|
||||
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
|
||||
# Draw method: Patch List
|
||||
# Polygon Mode: Point
|
||||
# TES primitive ordering: trianges, cw
|
||||
# Result: Green rectangle should be on top.
|
||||
|
||||
DEVICE_FEATURE tessellationShader
|
||||
DEVICE_FEATURE fillModeNonSolid
|
||||
|
||||
SHADER vertex vert GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = vec4(inPosition, 1.0);
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER tessellation_control tesc GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor[];
|
||||
layout (location = 0) patch out vec4 tcColor;
|
||||
layout (vertices = 3) out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
float tessLevel = 2.0;
|
||||
|
||||
gl_TessLevelInner[0] = tessLevel;
|
||||
gl_TessLevelInner[1] = tessLevel;
|
||||
gl_TessLevelOuter[0] = 1.0;
|
||||
gl_TessLevelOuter[1] = 1.0;
|
||||
gl_TessLevelOuter[2] = 1.0;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
tcColor = inColor[gl_InvocationID];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER tessellation_evaluation tese GLSL
|
||||
#version 450
|
||||
|
||||
layout (triangles, equal_spacing, cw) in;
|
||||
layout (location = 0) patch in vec4 patch_color;
|
||||
layout (location = 0) out vec4 tes_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position) +
|
||||
(gl_TessCoord.y * gl_in[1].gl_Position) +
|
||||
(gl_TessCoord.z * gl_in[2].gl_Position);
|
||||
|
||||
tes_color = patch_color;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.17
|
||||
0.50 -0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
-0.50 0.50 0.17
|
||||
-0.50 -0.50 0.17
|
||||
END
|
||||
|
||||
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.18
|
||||
0.50 -0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
-0.50 0.50 0.18
|
||||
-0.50 -0.50 0.18
|
||||
END
|
||||
|
||||
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
|
||||
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
PIPELINE graphics pipeline1
|
||||
ATTACH vert
|
||||
ATTACH tesc
|
||||
ATTACH tese
|
||||
ATTACH frag
|
||||
|
||||
POLYGON_MODE point
|
||||
PATCH_CONTROL_POINTS 3
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VERTEX_DATA vertexPositionA LOCATION 0
|
||||
VERTEX_DATA vertexColorA LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline2
|
||||
ATTACH vert
|
||||
ATTACH tesc
|
||||
ATTACH tese
|
||||
ATTACH frag
|
||||
|
||||
POLYGON_MODE point
|
||||
PATCH_CONTROL_POINTS 3
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant -700.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VERTEX_DATA vertexPositionB LOCATION 0
|
||||
VERTEX_DATA vertexColorB LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline1 0 0 0 255
|
||||
CLEAR_DEPTH pipeline1 0.3
|
||||
CLEAR pipeline1
|
||||
|
||||
CLEAR_COLOR pipeline2 0 0 0 255
|
||||
|
||||
RUN pipeline1 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
|
||||
RUN pipeline2 DRAW_ARRAY AS PATCH_LIST START_IDX 0 COUNT 6
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the frame buffer contents.
|
||||
# The compute shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(local_size_x=10,local_size_y=10) in;
|
||||
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
|
||||
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 color = imageLoad(resultImage, uv);
|
||||
|
||||
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
|
||||
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
|
||||
}
|
||||
END
|
||||
|
||||
PIPELINE compute verify_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN verify_pipeline 10 10 1
|
||||
|
||||
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,179 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 The Khronos Group Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Red rect. fragDepth: 0.17
|
||||
# Green rect. fragDepth: 0.18
|
||||
# Depth color format: D16_UNORM
|
||||
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
|
||||
# Draw method: Triangle List
|
||||
# Polygon Mode: Fill
|
||||
# Result: Green rectangle should be on top.
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec4 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(inPosition, 1.0);
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
|
||||
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.17
|
||||
0.50 -0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
-0.50 0.50 0.17
|
||||
-0.50 -0.50 0.17
|
||||
END
|
||||
|
||||
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.18
|
||||
0.50 -0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
-0.50 0.50 0.18
|
||||
-0.50 -0.50 0.18
|
||||
END
|
||||
|
||||
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline1
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
POLYGON_MODE fill
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
|
||||
VERTEX_DATA vertexPositionA LOCATION 0
|
||||
VERTEX_DATA vertexColorA LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline2
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
POLYGON_MODE fill
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant -700.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
|
||||
VERTEX_DATA vertexPositionB LOCATION 0
|
||||
VERTEX_DATA vertexColorB LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline1 0 0 0 255
|
||||
CLEAR_DEPTH pipeline1 0.3
|
||||
CLEAR pipeline1
|
||||
|
||||
CLEAR_COLOR pipeline2 0 0 0 255
|
||||
|
||||
RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the frame buffer contents.
|
||||
# The compute shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(local_size_x=10,local_size_y=10) in;
|
||||
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
|
||||
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 color = imageLoad(resultImage, uv);
|
||||
|
||||
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
|
||||
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
|
||||
}
|
||||
END
|
||||
|
||||
PIPELINE compute verify_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN verify_pipeline 10 10 1
|
||||
|
||||
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,181 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 The Khronos Group Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Red rect. fragDepth: 0.17
|
||||
# Green rect. fragDepth: 0.18
|
||||
# Depth color format: D16_UNORM
|
||||
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
|
||||
# Draw method: Triangle List
|
||||
# Polygon Mode: Line
|
||||
# Result: Green rectangle should be on top.
|
||||
|
||||
DEVICE_FEATURE fillModeNonSolid
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec4 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(inPosition, 1.0);
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
|
||||
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.17
|
||||
0.50 -0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
-0.50 0.50 0.17
|
||||
-0.50 -0.50 0.17
|
||||
END
|
||||
|
||||
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.18
|
||||
0.50 -0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
-0.50 0.50 0.18
|
||||
-0.50 -0.50 0.18
|
||||
END
|
||||
|
||||
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline1
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
POLYGON_MODE line
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
|
||||
VERTEX_DATA vertexPositionA LOCATION 0
|
||||
VERTEX_DATA vertexColorA LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline2
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
POLYGON_MODE line
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant -700.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
|
||||
VERTEX_DATA vertexPositionB LOCATION 0
|
||||
VERTEX_DATA vertexColorB LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline1 0 0 0 255
|
||||
CLEAR_DEPTH pipeline1 0.3
|
||||
CLEAR pipeline1
|
||||
|
||||
CLEAR_COLOR pipeline2 0 0 0 255
|
||||
|
||||
RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the frame buffer contents.
|
||||
# The compute shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(local_size_x=10,local_size_y=10) in;
|
||||
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
|
||||
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 color = imageLoad(resultImage, uv);
|
||||
|
||||
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
|
||||
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
|
||||
}
|
||||
END
|
||||
|
||||
PIPELINE compute verify_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN verify_pipeline 10 10 1
|
||||
|
||||
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,182 @@
|
||||
#!amber
|
||||
# Copyright 2021 Google LLC.
|
||||
# Copyright 2021 The Khronos Group Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Red rect. fragDepth: 0.17
|
||||
# Green rect. fragDepth: 0.18
|
||||
# Depth color format: D16_UNORM
|
||||
# Depth bias: -0.01068115234375 (-700.0 / 2^16)
|
||||
# Draw method: Triangle List
|
||||
# Polygon Mode: Point
|
||||
# Result: Green rectangle should be on top.
|
||||
|
||||
DEVICE_FEATURE fillModeNonSolid
|
||||
|
||||
SHADER vertex vert_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPosition;
|
||||
layout (location = 1) in vec4 inColor;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(inPosition, 1.0);
|
||||
gl_PointSize = 1.0;
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inColor;
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = inColor;
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT R8G8B8A8_UNORM
|
||||
IMAGE verifyImage FORMAT R8G8B8A8_UNORM DIM_2D WIDTH 100 HEIGHT 100 FILL 0
|
||||
BUFFER depth_buf FORMAT D16_UNORM
|
||||
|
||||
BUFFER vertexPositionA DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.17
|
||||
0.50 -0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
0.50 0.50 0.17
|
||||
-0.50 0.50 0.17
|
||||
-0.50 -0.50 0.17
|
||||
END
|
||||
|
||||
BUFFER vertexPositionB DATA_TYPE vec3<float> DATA
|
||||
-0.50 -0.50 0.18
|
||||
0.50 -0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
0.50 0.50 0.18
|
||||
-0.50 0.50 0.18
|
||||
-0.50 -0.50 0.18
|
||||
END
|
||||
|
||||
BUFFER vertexColorA DATA_TYPE vec4<float> DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER vertexColorB DATA_TYPE vec4<float> DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline1
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
POLYGON_MODE point
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant 0.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
|
||||
VERTEX_DATA vertexPositionA LOCATION 0
|
||||
VERTEX_DATA vertexColorA LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline2
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
POLYGON_MODE point
|
||||
|
||||
DEPTH
|
||||
TEST on
|
||||
WRITE on
|
||||
COMPARE_OP less
|
||||
CLAMP off
|
||||
BOUNDS min 0.0 max 1.0
|
||||
BIAS constant -700.0 clamp 0.0 slope 0.0
|
||||
END
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
VIEWPORT 0.0 0.0 SIZE 100.0 100.0
|
||||
VERTEX_DATA vertexPositionB LOCATION 0
|
||||
VERTEX_DATA vertexColorB LOCATION 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER depth_buf AS depth_stencil
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline1 0 0 0 255
|
||||
CLEAR_DEPTH pipeline1 0.3
|
||||
CLEAR pipeline1
|
||||
|
||||
CLEAR_COLOR pipeline2 0 0 0 255
|
||||
|
||||
RUN pipeline1 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
RUN pipeline2 DRAW_ARRAY AS TRIANGLE_LIST START_IDX 0 COUNT 6
|
||||
|
||||
# ---------------- VERIFY PIPELINE ------------------
|
||||
# This pipeline verifies the frame buffer contents.
|
||||
# The compute shader writes color green if the value is expected,
|
||||
# otherwise red.
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 450
|
||||
|
||||
layout(local_size_x=10,local_size_y=10) in;
|
||||
uniform layout(set=0, binding=0, rgba8) image2D resultImage;
|
||||
uniform layout(set=0, binding=1, rgba8) image2D verifyImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 uv = ivec2(gl_GlobalInvocationID.xy);
|
||||
vec4 color = imageLoad(resultImage, uv);
|
||||
|
||||
if(color.r == 0.0 && color.a == 1.0) imageStore(verifyImage, uv, vec4(0.0, 1.0, 0.0, 1.0));
|
||||
else imageStore(verifyImage, uv, vec4(1.0, 0.0, 0.0, 1.0));
|
||||
}
|
||||
END
|
||||
|
||||
PIPELINE compute verify_pipeline
|
||||
ATTACH comp_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 100 100
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER verifyImage AS storage_image DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
RUN verify_pipeline 10 10 1
|
||||
|
||||
EXPECT verifyImage IDX 0 0 SIZE 100 100 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,51 @@
|
||||
#!amber
|
||||
# Reproducer for https://gitlab.freedesktop.org/mesa/mesa/-/issues/10999
|
||||
|
||||
SHADER vertex vtex_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 data_in;
|
||||
layout(location = 0) out flat float data_out;
|
||||
void main() {
|
||||
const float count = 5.0;
|
||||
gl_PointSize = 1.0;
|
||||
gl_Position = vec4((((data_in.x + 0.5) / count) * 2.0) - 1.0, 0.0, 0.0, 1.0);
|
||||
data_out = data_in.y;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) in flat float data_in;
|
||||
layout(location = 0) out vec4 final_color;
|
||||
void main() {
|
||||
const float epsilon = 0.0009765625; // Makes sure 0.5 is rounded up to 128.
|
||||
final_color = vec4(max(0.0, min(max(data_in, 0.0), 1.0) - 0.5) + epsilon, 0.0, 0.0, 1.0);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER position_buf DATA_TYPE vec2<float> DATA
|
||||
0 0.0
|
||||
1 0.5
|
||||
2 1.0
|
||||
3 1.5
|
||||
4 2.0
|
||||
END
|
||||
|
||||
BUFFER framebuffer FORMAT B8G8R8A8_UNORM
|
||||
|
||||
PIPELINE graphics pipeline
|
||||
ATTACH vtex_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
VERTEX_DATA position_buf LOCATION 0
|
||||
FRAMEBUFFER_SIZE 5 1
|
||||
VIEWPORT 0 0 SIZE 5 1
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
END
|
||||
|
||||
RUN pipeline DRAW_ARRAY AS POINT_LIST START_IDX 0
|
||||
EXPECT framebuffer IDX 0 0 SIZE 1 1 EQ_RGBA 0 0 0 255
|
||||
EXPECT framebuffer IDX 1 0 SIZE 1 1 EQ_RGBA 0 0 0 255
|
||||
EXPECT framebuffer IDX 2 0 SIZE 1 1 EQ_RGBA 128 0 0 255
|
||||
EXPECT framebuffer IDX 3 0 SIZE 1 1 EQ_RGBA 128 0 0 255
|
||||
EXPECT framebuffer IDX 4 0 SIZE 1 1 EQ_RGBA 128 0 0 255
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#!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 vec3 color_in[3];
|
||||
layout(location = 0) smooth out vec3 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in[3];
|
||||
layout(location = 0) out highp float frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in;
|
||||
layout(location = 0) out highp float frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#!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 vec3 color_in[3];
|
||||
layout(location = 0) smooth out vec3 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in[3];
|
||||
layout(location = 0) out highp vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in;
|
||||
layout(location = 0) out highp vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 vec3 color_in[3];
|
||||
layout(location = 0) smooth out vec3 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in[3];
|
||||
layout(location = 0) out highp vec3 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in;
|
||||
layout(location = 0) out highp vec3 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec3 result = texture(result_sampler, texcoord_in).xyz;
|
||||
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#!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 vec3 color_in[3];
|
||||
layout(location = 0) smooth out vec3 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in[3];
|
||||
layout(location = 0) out mediump float frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in;
|
||||
layout(location = 0) out mediump float frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#!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 vec3 color_in[3];
|
||||
layout(location = 0) smooth out vec3 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in[3];
|
||||
layout(location = 0) out mediump vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in;
|
||||
layout(location = 0) out mediump vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 vec3 color_in[3];
|
||||
layout(location = 0) smooth out vec3 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec3 color_in[3];
|
||||
layout(location = 0) out mediump vec3 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref 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_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec3 result = texture(result_sampler, texcoord_in).xyz;
|
||||
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER framebuffer2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER ref0 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref1 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
BUFFER ref2 FORMAT B10G11R11_UFLOAT_PACK32
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out highp vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out highp vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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 B8G8R8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
0 255 0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out highp vec3 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out highp vec3 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec3 result = texture(result_sampler, texcoord_in).xyz;
|
||||
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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 B8G8R8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
0 255 0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out highp vec4 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref 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
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec4 result = texture(result_sampler, texcoord_in);
|
||||
vec4 ref = texture(ref_sampler, texcoord_in);
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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 B8G8R8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
0 255 0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out mediump vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out mediump vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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 B8G8R8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
0 255 0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out mediump vec3 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out mediump vec3 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec3 result = texture(result_sampler, texcoord_in).xyz;
|
||||
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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 B8G8R8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
0 255 0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out mediump vec4 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out mediump vec4 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec4 result = texture(result_sampler, texcoord_in);
|
||||
vec4 ref = texture(ref_sampler, texcoord_in);
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref2 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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 B8G8R8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE B8G8R8A8_UNORM DATA
|
||||
0 0 255 255
|
||||
255 255 0 255
|
||||
255 0 0 255
|
||||
0 255 0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 vec2 color_in[3];
|
||||
layout(location = 0) smooth out vec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in[3];
|
||||
layout(location = 0) out highp float frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 color_in;
|
||||
layout(location = 0) smooth out vec2 color_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in;
|
||||
layout(location = 0) out highp float frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref1 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 vec2 color_in[3];
|
||||
layout(location = 0) smooth out vec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in[3];
|
||||
layout(location = 0) out highp vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 color_in;
|
||||
layout(location = 0) smooth out vec2 color_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in;
|
||||
layout(location = 0) out highp vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref1 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 vec2 color_in[3];
|
||||
layout(location = 0) smooth out vec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in[3];
|
||||
layout(location = 0) out mediump float frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 color_in;
|
||||
layout(location = 0) smooth out vec2 color_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in;
|
||||
layout(location = 0) out mediump float frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref1 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 vec2 color_in[3];
|
||||
layout(location = 0) smooth out vec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in[3];
|
||||
layout(location = 0) out mediump vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 color_in;
|
||||
layout(location = 0) smooth out vec2 color_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec2 color_in;
|
||||
layout(location = 0) out mediump vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R16G16_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref1 FORMAT R16G16_SFLOAT
|
||||
BUFFER ref2 FORMAT R16G16_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R16G16_SFLOAT DATA
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 1.0
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R16G16_SFLOAT DATA
|
||||
0.0 0.0
|
||||
1.0 1.0
|
||||
1.0 0.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 float color_in[3];
|
||||
layout(location = 0) smooth out float color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in float color_in[3];
|
||||
layout(location = 0) out highp float frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in float color_in;
|
||||
layout(location = 0) smooth out float color_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in float color_in;
|
||||
layout(location = 0) out highp float frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32_SFLOAT DATA
|
||||
1.0
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32_SFLOAT DATA
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32_SFLOAT DATA
|
||||
0.0
|
||||
1.0
|
||||
1.0
|
||||
0.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 float color_in[3];
|
||||
layout(location = 0) smooth out float color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in float color_in[3];
|
||||
layout(location = 0) out mediump float frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in float color_in;
|
||||
layout(location = 0) smooth out float color_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in float color_in;
|
||||
layout(location = 0) out mediump float frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32_SFLOAT DATA
|
||||
1.0
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32_SFLOAT DATA
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32_SFLOAT DATA
|
||||
0.0
|
||||
1.0
|
||||
1.0
|
||||
0.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out highp vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out highp vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out highp vec3 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out highp vec3 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec3 result = texture(result_sampler, texcoord_in).xyz;
|
||||
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out highp vec4 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref 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
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec4 result = texture(result_sampler, texcoord_in);
|
||||
vec4 ref = texture(ref_sampler, texcoord_in);
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out mediump vec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out mediump vec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xy;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
vec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
+241
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out mediump vec3 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out mediump vec3 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.xyz;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec3 result = texture(result_sampler, texcoord_in).xyz;
|
||||
vec3 ref = texture(ref_sampler, texcoord_in).xyz;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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_in[3];
|
||||
layout(location = 0) smooth out vec4 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in[3];
|
||||
layout(location = 0) out mediump vec4 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) smooth in vec4 color_in;
|
||||
layout(location = 0) out mediump vec4 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec4 result = texture(result_sampler, texcoord_in);
|
||||
vec4 ref = texture(ref_sampler, texcoord_in);
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER framebuffer2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER ref0 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref1 FORMAT R32G32B32A32_SFLOAT
|
||||
BUFFER ref2 FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 1.0 0.0 1.0
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R32G32B32A32_SFLOAT DATA
|
||||
0.0 0.0 1.0 1.0
|
||||
1.0 1.0 0.0 1.0
|
||||
1.0 0.0 0.0 1.0
|
||||
0.0 1.0 0.0 1.0
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 uvec2 color_in[3];
|
||||
layout(location = 0) flat out uvec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in[3];
|
||||
layout(location = 0) out highp uint frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in;
|
||||
layout(location = 0) out highp uint frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) usampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) usampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
uint result = texture(result_sampler, texcoord_in).x;
|
||||
uint ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer1 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER ref0 FORMAT R8G8_UINT
|
||||
BUFFER ref1 FORMAT R8G8_UINT
|
||||
BUFFER ref2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R8G8_UINT DATA
|
||||
255 0
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R8G8_UINT DATA
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R8G8_UINT DATA
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 uvec2 color_in[3];
|
||||
layout(location = 0) flat out uvec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in[3];
|
||||
layout(location = 0) out highp uvec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in;
|
||||
layout(location = 0) out highp uvec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) usampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) usampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
uvec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
uvec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer1 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER ref0 FORMAT R8G8_UINT
|
||||
BUFFER ref1 FORMAT R8G8_UINT
|
||||
BUFFER ref2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R8G8_UINT DATA
|
||||
255 0
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R8G8_UINT DATA
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R8G8_UINT DATA
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 uvec2 color_in[3];
|
||||
layout(location = 0) flat out uvec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in[3];
|
||||
layout(location = 0) out mediump uint frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i].x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in;
|
||||
layout(location = 0) out mediump uint frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in.x;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) usampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) usampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
uint result = texture(result_sampler, texcoord_in).x;
|
||||
uint ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (distance(result, ref) > 5)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer1 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER ref0 FORMAT R8G8_UINT
|
||||
BUFFER ref1 FORMAT R8G8_UINT
|
||||
BUFFER ref2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R8G8_UINT DATA
|
||||
255 0
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R8G8_UINT DATA
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R8G8_UINT DATA
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,241 @@
|
||||
#!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 uvec2 color_in[3];
|
||||
layout(location = 0) flat out uvec2 color_out[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
for (int i = 0; i < 3; i++)
|
||||
color_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in[3];
|
||||
layout(location = 0) out mediump uvec2 frag_out[3];
|
||||
void main()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
frag_out[i] = color_in[i];
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref 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_ref GLSL
|
||||
#version 430
|
||||
layout(location = 0) flat in uvec2 color_in;
|
||||
layout(location = 0) out mediump uvec2 frag_out;
|
||||
void main()
|
||||
{
|
||||
frag_out = color_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) usampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) usampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
uvec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
uvec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (distance(result, ref) > 5)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER framebuffer0 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer1 FORMAT R8G8_UINT
|
||||
BUFFER framebuffer2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER ref0 FORMAT R8G8_UINT
|
||||
BUFFER ref1 FORMAT R8G8_UINT
|
||||
BUFFER ref2 FORMAT R8G8_UINT
|
||||
|
||||
BUFFER result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.0 1.0
|
||||
END
|
||||
|
||||
BUFFER color0 DATA_TYPE R8G8_UINT DATA
|
||||
255 0
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R8G8_UINT DATA
|
||||
0 255
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
END
|
||||
|
||||
BUFFER color2 DATA_TYPE R8G8_UINT DATA
|
||||
0 0
|
||||
255 255
|
||||
255 0
|
||||
0 255
|
||||
END
|
||||
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color0 LOCATION 1
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref
|
||||
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_ref
|
||||
ATTACH frag_shader_ref
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA color2 LOCATION 1
|
||||
BIND BUFFER ref2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
CLEAR_COLOR pipeline 0 0 0 0
|
||||
CLEAR pipeline
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref0 0 0 0 0
|
||||
CLEAR pipeline_ref0
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref1 0 0 0 0
|
||||
CLEAR pipeline_ref1
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_ref2 0 0 0 0
|
||||
CLEAR pipeline_ref2
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify0 0 0 0 0
|
||||
CLEAR pipeline_verify0
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify1 0 0 0 0
|
||||
CLEAR pipeline_verify1
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
CLEAR_COLOR pipeline_verify2 0 0 0 0
|
||||
CLEAR pipeline_verify2
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,317 @@
|
||||
#!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
|
||||
|
||||
SHADER vertex vert_shader_verify GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 position_in;
|
||||
layout(location = 1) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec2 texcoord_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
texcoord_out = texcoord_in;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify_vec4 GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
vec4 result = texture(result_sampler, texcoord_in);
|
||||
vec4 ref = texture(ref_sampler, texcoord_in);
|
||||
if (result != ref)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify_float GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) sampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) sampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
float result = texture(result_sampler, texcoord_in).x;
|
||||
float ref = texture(ref_sampler, texcoord_in).x;
|
||||
if (distance(result, ref) > 0.1)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_verify_uvec2 GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec2 texcoord_in;
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
uniform layout(set=0, binding=0) usampler2D result_sampler;
|
||||
uniform layout(set=0, binding=1) usampler2D ref_sampler;
|
||||
void main()
|
||||
{
|
||||
uvec2 result = texture(result_sampler, texcoord_in).xy;
|
||||
uvec2 ref = texture(ref_sampler, texcoord_in).xy;
|
||||
if (distance(result, ref) > 5)
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
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 result0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result1 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER result2 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 texcoord DATA_TYPE vec2<float> DATA
|
||||
0.0 0.0
|
||||
1.0 0.0
|
||||
1.0 1.0
|
||||
0.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
|
||||
|
||||
SAMPLER sampler
|
||||
|
||||
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
|
||||
|
||||
PIPELINE graphics pipeline_verify0
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify_float
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref0 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify1
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify_uvec2
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref1 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_verify2
|
||||
ATTACH vert_shader_verify
|
||||
ATTACH frag_shader_verify_vec4
|
||||
VERTEX_DATA position LOCATION 0
|
||||
VERTEX_DATA texcoord LOCATION 1
|
||||
BIND BUFFER framebuffer2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER ref2 AS combined_image_sampler SAMPLER sampler DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER result2 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_ref0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_ref1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_ref2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_verify0 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_verify1 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_verify2 DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
|
||||
EXPECT result0 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result1 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
EXPECT result2 IDX 0 0 SIZE 60 60 EQ_RGBA 0 255 0 255
|
||||
@@ -0,0 +1,136 @@
|
||||
#!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 vec4 color_in1;
|
||||
layout(location = 0) out vec4 color_out0;
|
||||
layout(location = 1) out vec4 color_out1;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_in, 0, 1);
|
||||
color_out0 = color_in0;
|
||||
color_out1 = color_in1;
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader GLSL
|
||||
#version 430
|
||||
layout(location = 0) in vec4 color_in0;
|
||||
layout(location = 1) in vec4 color_in1;
|
||||
layout(location = 0) out vec4 frag_out0;
|
||||
layout(location = 1) out vec4 frag_out1;
|
||||
void main()
|
||||
{
|
||||
if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2))
|
||||
{
|
||||
frag_out0 = color_in0;
|
||||
frag_out1 = color_in1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frag_out0 = color_in1;
|
||||
frag_out1 = color_in0;
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
SHADER vertex vert_shader_ref PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader_ref0 GLSL
|
||||
#version 430
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
void main()
|
||||
{
|
||||
if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2))
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
else
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER fragment frag_shader_ref1 GLSL
|
||||
#version 430
|
||||
layout(location = 0) out vec4 frag_out;
|
||||
void main()
|
||||
{
|
||||
if (((int(gl_FragCoord.x) / 5) % 2) == ((int(gl_FragCoord.y) / 5) % 2))
|
||||
frag_out = vec4(0, 1, 0, 1);
|
||||
else
|
||||
frag_out = vec4(1, 0, 0, 1);
|
||||
}
|
||||
END
|
||||
|
||||
|
||||
BUFFER framebuffer0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER framebuffer1 FORMAT B8G8R8A8_UNORM
|
||||
|
||||
BUFFER ref0 FORMAT B8G8R8A8_UNORM
|
||||
BUFFER ref1 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 R8G8B8A8_UNORM DATA
|
||||
255 0 0 255
|
||||
255 0 0 255
|
||||
255 0 0 255
|
||||
255 0 0 255
|
||||
END
|
||||
|
||||
BUFFER color1 DATA_TYPE R8G8B8A8_UNORM DATA
|
||||
0 255 0 255
|
||||
0 255 0 255
|
||||
0 255 0 255
|
||||
0 255 0 255
|
||||
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
|
||||
BIND BUFFER framebuffer0 AS color LOCATION 0
|
||||
BIND BUFFER framebuffer1 AS color LOCATION 1
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref0
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref0
|
||||
BIND BUFFER ref0 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
PIPELINE graphics pipeline_ref1
|
||||
ATTACH vert_shader_ref
|
||||
ATTACH frag_shader_ref1
|
||||
BIND BUFFER ref1 AS color LOCATION 0
|
||||
FRAMEBUFFER_SIZE 60 60
|
||||
END
|
||||
|
||||
RUN pipeline DRAW_ARRAY AS TRIANGLE_STRIP START_IDX 0 COUNT 4
|
||||
RUN pipeline_ref0 DRAW_RECT POS 0 0 SIZE 60 60
|
||||
RUN pipeline_ref1 DRAW_RECT POS 0 0 SIZE 60 60
|
||||
EXPECT framebuffer0 EQ_BUFFER ref0
|
||||
EXPECT framebuffer1 EQ_BUFFER ref1
|
||||
@@ -0,0 +1,193 @@
|
||||
#!amber
|
||||
# Copyright 2022 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 PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader GLSL TARGET_ENV spv1.3
|
||||
#version 460
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
#extension GL_KHR_shader_subgroup_quad : require
|
||||
|
||||
layout(binding = 0) readonly buffer Block0
|
||||
{
|
||||
float alpha[];
|
||||
};
|
||||
|
||||
layout(binding = 1) buffer Block1
|
||||
{
|
||||
uint atomics[];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
float build_alpha_shuffle(float v)
|
||||
{
|
||||
v = (helperInvocationEXT() ? 8.0 : roundEven(v));
|
||||
vec4 helpers;
|
||||
helpers.x = subgroupQuadBroadcast(v, 0u);
|
||||
helpers.y = subgroupQuadBroadcast(v, 1u);
|
||||
helpers.z = subgroupQuadBroadcast(v, 2u);
|
||||
helpers.w = subgroupQuadBroadcast(v, 3u);
|
||||
|
||||
return dot(helpers, vec4(1, 10, 100, 1000));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||
int linear_coord = coord.y * 2 + coord.x;
|
||||
|
||||
float alpha_value = alpha[linear_coord];
|
||||
float mask0 = build_alpha_shuffle(alpha_value);
|
||||
|
||||
// Lane 1 and 2 should be nuked by this.
|
||||
if (fract(alpha_value) < 0.5)
|
||||
{
|
||||
demote;
|
||||
}
|
||||
|
||||
float mask1 = build_alpha_shuffle(alpha_value);
|
||||
uint last_value = 0u;
|
||||
|
||||
last_value = atomicAdd(atomics[linear_coord], 101u);
|
||||
|
||||
if (linear_coord == 3 || last_value > 1000)
|
||||
{
|
||||
demote;
|
||||
}
|
||||
|
||||
float mask2 = build_alpha_shuffle(alpha_value);
|
||||
|
||||
color = vec4(1.0, mask0, mask1, mask2);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 460
|
||||
layout(local_size_x=1,local_size_y=1) in;
|
||||
uniform layout(set=0, binding=0, rgba32f) image2D resultImage;
|
||||
|
||||
layout(set = 0, binding = 1) buffer block0
|
||||
{
|
||||
vec4 results[];
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 2) readonly buffer Block1
|
||||
{
|
||||
uvec4 atomics;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 colorValues = imageLoad(resultImage, ivec2(0, 0));
|
||||
|
||||
results[0] = vec4(0.0, .0, 0.0, 0.0);
|
||||
results[1] = imageLoad(resultImage, ivec2(1, 0));
|
||||
results[2] = imageLoad(resultImage, ivec2(0, 1));
|
||||
results[3] = imageLoad(resultImage, ivec2(1, 1));
|
||||
|
||||
// We don't know if the invocations are helpers or not at the start
|
||||
// and therefore all the possible outcomes are allowed.
|
||||
for (int x = 0; x < 2; x++)
|
||||
{
|
||||
for (int y = 0; y < 2; y++)
|
||||
{
|
||||
for (int z = 0; z < 2; z++)
|
||||
{
|
||||
for (int w = 0; w < 2; w++)
|
||||
{
|
||||
vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0);
|
||||
uvec4 atomicVec = uvec4(0, 0, 0, 0);
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (testVec[j] > 0.0)
|
||||
{
|
||||
testVec[j] = 8.0;
|
||||
atomicVec[j] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
testVec[j] = j + 1.0;
|
||||
atomicVec[j] = 101;
|
||||
}
|
||||
}
|
||||
|
||||
float mask0 = dot(testVec, vec4(1, 10, 100, 1000));
|
||||
float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000));
|
||||
float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000));
|
||||
|
||||
atomicVec[1] = 0;
|
||||
atomicVec[2] = 0;
|
||||
|
||||
if (colorValues.x == 1.0 && atomics.x == atomicVec.x
|
||||
&& colorValues.y == mask0 && atomics.y == atomicVec.y
|
||||
&& colorValues.z == mask1 && atomics.z == atomicVec.z
|
||||
&& colorValues.w == mask2 && atomics.w == atomicVec.w)
|
||||
{
|
||||
results[0] = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER alpha_keys DATA_TYPE float DATA
|
||||
0.75
|
||||
2.25
|
||||
3.25
|
||||
3.75
|
||||
END
|
||||
|
||||
BUFFER atomics DATA_TYPE uint32 DATA
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
END
|
||||
|
||||
BUFFER results DATA_TYPE float SIZE 16 FILL 0.0
|
||||
BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0
|
||||
|
||||
BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics myPipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 2 2
|
||||
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
PIPELINE compute verifyPipeline
|
||||
ATTACH comp_shader
|
||||
FRAMEBUFFER_SIZE 2 2
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
CLEAR_COLOR myPipeline 255 255 255 255
|
||||
CLEAR myPipeline
|
||||
|
||||
RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2
|
||||
RUN verifyPipeline 1 1 1
|
||||
|
||||
EXPECT results EQ_BUFFER ref_buffer
|
||||
@@ -0,0 +1,193 @@
|
||||
#!amber
|
||||
# Copyright 2022 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 PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader GLSL TARGET_ENV spv1.6
|
||||
#version 460
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
#extension GL_KHR_shader_subgroup_quad : require
|
||||
|
||||
layout(binding = 0) readonly buffer Block0
|
||||
{
|
||||
float alpha[];
|
||||
};
|
||||
|
||||
layout(binding = 1) buffer Block1
|
||||
{
|
||||
uint atomics[];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
float build_alpha_shuffle(float v)
|
||||
{
|
||||
v = (gl_HelperInvocation ? 8.0 : roundEven(v));
|
||||
vec4 helpers;
|
||||
helpers.x = subgroupQuadBroadcast(v, 0u);
|
||||
helpers.y = subgroupQuadBroadcast(v, 1u);
|
||||
helpers.z = subgroupQuadBroadcast(v, 2u);
|
||||
helpers.w = subgroupQuadBroadcast(v, 3u);
|
||||
|
||||
return dot(helpers, vec4(1, 10, 100, 1000));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||
int linear_coord = coord.y * 2 + coord.x;
|
||||
|
||||
float alpha_value = alpha[linear_coord];
|
||||
float mask0 = build_alpha_shuffle(alpha_value);
|
||||
|
||||
// Lane 1 and 2 should be nuked by this.
|
||||
if (fract(alpha_value) < 0.5)
|
||||
{
|
||||
demote;
|
||||
}
|
||||
|
||||
float mask1 = build_alpha_shuffle(alpha_value);
|
||||
uint last_value = 0u;
|
||||
|
||||
last_value = atomicAdd(atomics[linear_coord], 101u);
|
||||
|
||||
if (linear_coord == 3 || last_value > 1000)
|
||||
{
|
||||
demote;
|
||||
}
|
||||
|
||||
float mask2 = build_alpha_shuffle(alpha_value);
|
||||
|
||||
color = vec4(1.0, mask0, mask1, mask2);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 460
|
||||
layout(local_size_x=1,local_size_y=1) in;
|
||||
uniform layout(set=0, binding=0, rgba32f) image2D resultImage;
|
||||
|
||||
layout(set = 0, binding = 1) buffer block0
|
||||
{
|
||||
vec4 results[];
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 2) readonly buffer Block1
|
||||
{
|
||||
uvec4 atomics;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 colorValues = imageLoad(resultImage, ivec2(0, 0));
|
||||
|
||||
results[0] = vec4(0.0, .0, 0.0, 0.0);
|
||||
results[1] = imageLoad(resultImage, ivec2(1, 0));
|
||||
results[2] = imageLoad(resultImage, ivec2(0, 1));
|
||||
results[3] = imageLoad(resultImage, ivec2(1, 1));
|
||||
|
||||
// We don't know if the invocations are helpers or not at the start
|
||||
// and therefore all the possible outcomes are allowed.
|
||||
for (int x = 0; x < 2; x++)
|
||||
{
|
||||
for (int y = 0; y < 2; y++)
|
||||
{
|
||||
for (int z = 0; z < 2; z++)
|
||||
{
|
||||
for (int w = 0; w < 2; w++)
|
||||
{
|
||||
vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0);
|
||||
uvec4 atomicVec = uvec4(0, 0, 0, 0);
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (testVec[j] > 0.0)
|
||||
{
|
||||
testVec[j] = 8.0;
|
||||
atomicVec[j] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
testVec[j] = j + 1.0;
|
||||
atomicVec[j] = 101;
|
||||
}
|
||||
}
|
||||
|
||||
float mask0 = dot(testVec, vec4(1, 10, 100, 1000));
|
||||
float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000));
|
||||
float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000));
|
||||
|
||||
atomicVec[1] = 0;
|
||||
atomicVec[2] = 0;
|
||||
|
||||
if (colorValues.x == 1.0 && atomics.x == atomicVec.x
|
||||
&& colorValues.y == mask0 && atomics.y == atomicVec.y
|
||||
&& colorValues.z == mask1 && atomics.z == atomicVec.z
|
||||
&& colorValues.w == mask2 && atomics.w == atomicVec.w)
|
||||
{
|
||||
results[0] = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER alpha_keys DATA_TYPE float DATA
|
||||
0.75
|
||||
2.25
|
||||
3.25
|
||||
3.75
|
||||
END
|
||||
|
||||
BUFFER atomics DATA_TYPE uint32 DATA
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
END
|
||||
|
||||
BUFFER results DATA_TYPE float SIZE 16 FILL 0.0
|
||||
BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0
|
||||
|
||||
BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics myPipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 2 2
|
||||
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
PIPELINE compute verifyPipeline
|
||||
ATTACH comp_shader
|
||||
FRAMEBUFFER_SIZE 2 2
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
CLEAR_COLOR myPipeline 255 255 255 255
|
||||
CLEAR myPipeline
|
||||
|
||||
RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2
|
||||
RUN verifyPipeline 1 1 1
|
||||
|
||||
EXPECT results EQ_BUFFER ref_buffer
|
||||
@@ -0,0 +1,194 @@
|
||||
#!amber
|
||||
# Copyright 2022 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 PASSTHROUGH
|
||||
|
||||
SHADER fragment frag_shader GLSL TARGET_ENV spv1.6
|
||||
#version 460
|
||||
#pragma use_vulkan_memory_model
|
||||
#extension GL_EXT_demote_to_helper_invocation : require
|
||||
#extension GL_KHR_shader_subgroup_quad : require
|
||||
|
||||
layout(binding = 0) readonly buffer Block0
|
||||
{
|
||||
float alpha[];
|
||||
};
|
||||
|
||||
layout(binding = 1) buffer Block1
|
||||
{
|
||||
uint atomics[];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
float build_alpha_shuffle(float v)
|
||||
{
|
||||
v = (gl_HelperInvocation ? 8.0 : roundEven(v));
|
||||
vec4 helpers;
|
||||
helpers.x = subgroupQuadBroadcast(v, 0u);
|
||||
helpers.y = subgroupQuadBroadcast(v, 1u);
|
||||
helpers.z = subgroupQuadBroadcast(v, 2u);
|
||||
helpers.w = subgroupQuadBroadcast(v, 3u);
|
||||
|
||||
return dot(helpers, vec4(1, 10, 100, 1000));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||
int linear_coord = coord.y * 2 + coord.x;
|
||||
|
||||
float alpha_value = alpha[linear_coord];
|
||||
float mask0 = build_alpha_shuffle(alpha_value);
|
||||
|
||||
// Lane 1 and 2 should be nuked by this.
|
||||
if (fract(alpha_value) < 0.5)
|
||||
{
|
||||
demote;
|
||||
}
|
||||
|
||||
float mask1 = build_alpha_shuffle(alpha_value);
|
||||
uint last_value = 0u;
|
||||
|
||||
last_value = atomicAdd(atomics[linear_coord], 101u);
|
||||
|
||||
if (linear_coord == 3 || last_value > 1000)
|
||||
{
|
||||
demote;
|
||||
}
|
||||
|
||||
float mask2 = build_alpha_shuffle(alpha_value);
|
||||
|
||||
color = vec4(1.0, mask0, mask1, mask2);
|
||||
}
|
||||
END
|
||||
|
||||
SHADER compute comp_shader GLSL
|
||||
#version 460
|
||||
layout(local_size_x=1,local_size_y=1) in;
|
||||
uniform layout(set=0, binding=0, rgba32f) image2D resultImage;
|
||||
|
||||
layout(set = 0, binding = 1) buffer block0
|
||||
{
|
||||
vec4 results[];
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 2) readonly buffer Block1
|
||||
{
|
||||
uvec4 atomics;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 colorValues = imageLoad(resultImage, ivec2(0, 0));
|
||||
|
||||
results[0] = vec4(0.0, .0, 0.0, 0.0);
|
||||
results[1] = imageLoad(resultImage, ivec2(1, 0));
|
||||
results[2] = imageLoad(resultImage, ivec2(0, 1));
|
||||
results[3] = imageLoad(resultImage, ivec2(1, 1));
|
||||
|
||||
// We don't know if the invocations are helpers or not at the start
|
||||
// and therefore all the possible outcomes are allowed.
|
||||
for (int x = 0; x < 2; x++)
|
||||
{
|
||||
for (int y = 0; y < 2; y++)
|
||||
{
|
||||
for (int z = 0; z < 2; z++)
|
||||
{
|
||||
for (int w = 0; w < 2; w++)
|
||||
{
|
||||
vec4 testVec = vec4(x * 1.0, y * 2.0, z * 3.0, w * 4.0);
|
||||
uvec4 atomicVec = uvec4(0, 0, 0, 0);
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (testVec[j] > 0.0)
|
||||
{
|
||||
testVec[j] = 8.0;
|
||||
atomicVec[j] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
testVec[j] = j + 1.0;
|
||||
atomicVec[j] = 101;
|
||||
}
|
||||
}
|
||||
|
||||
float mask0 = dot(testVec, vec4(1, 10, 100, 1000));
|
||||
float mask1 = dot(vec4(testVec.x, 8.0, 8.0, testVec.w), vec4(1, 10, 100, 1000));
|
||||
float mask2 = dot(vec4(testVec.x, 8.0, 8.0, 8.0), vec4(1, 10, 100, 1000));
|
||||
|
||||
atomicVec[1] = 0;
|
||||
atomicVec[2] = 0;
|
||||
|
||||
if (colorValues.x == 1.0 && atomics.x == atomicVec.x
|
||||
&& colorValues.y == mask0 && atomics.y == atomicVec.y
|
||||
&& colorValues.z == mask1 && atomics.z == atomicVec.z
|
||||
&& colorValues.w == mask2 && atomics.w == atomicVec.w)
|
||||
{
|
||||
results[0] = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END
|
||||
|
||||
BUFFER alpha_keys DATA_TYPE float DATA
|
||||
0.75
|
||||
2.25
|
||||
3.25
|
||||
3.75
|
||||
END
|
||||
|
||||
BUFFER atomics DATA_TYPE uint32 DATA
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
END
|
||||
|
||||
BUFFER results DATA_TYPE float SIZE 16 FILL 0.0
|
||||
BUFFER ref_buffer DATA_TYPE float SIZE 16 FILL 1.0
|
||||
|
||||
BUFFER framebuffer FORMAT R32G32B32A32_SFLOAT
|
||||
|
||||
PIPELINE graphics myPipeline
|
||||
ATTACH vert_shader
|
||||
ATTACH frag_shader
|
||||
|
||||
FRAMEBUFFER_SIZE 2 2
|
||||
|
||||
BIND BUFFER framebuffer AS color LOCATION 0
|
||||
BIND BUFFER alpha_keys AS storage DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
END
|
||||
|
||||
PIPELINE compute verifyPipeline
|
||||
ATTACH comp_shader
|
||||
FRAMEBUFFER_SIZE 2 2
|
||||
BIND BUFFER framebuffer AS storage_image DESCRIPTOR_SET 0 BINDING 0
|
||||
BIND BUFFER results AS storage DESCRIPTOR_SET 0 BINDING 1
|
||||
BIND BUFFER atomics AS storage DESCRIPTOR_SET 0 BINDING 2
|
||||
END
|
||||
|
||||
CLEAR_COLOR myPipeline 255 255 255 255
|
||||
CLEAR myPipeline
|
||||
|
||||
RUN myPipeline DRAW_RECT POS 0 0 SIZE 2 2
|
||||
RUN verifyPipeline 1 1 1
|
||||
|
||||
EXPECT results EQ_BUFFER ref_buffer
|
||||
Reference in New Issue
Block a user