mirror of
https://gitee.com/openharmony/third_party_vulkan-loader
synced 2024-12-19 21:38:07 +00:00
Add ClipDistance and TextureTriangleCD tests.
This commit is contained in:
parent
fbf8e47883
commit
221cc847c5
@ -1855,6 +1855,49 @@ TEST_F(XglRenderTest, TexturedTriangle)
|
||||
DrawTexturedTriangle(vertShaderText, fragShaderText);
|
||||
}
|
||||
|
||||
TEST_F(XglRenderTest, TexturedTriangleCD)
|
||||
{
|
||||
// The expected result from this test is a red and green checkered triangle
|
||||
static const char *vertShaderText =
|
||||
"#version 140\n"
|
||||
"#extension GL_ARB_separate_shader_objects : enable\n"
|
||||
"#extension GL_ARB_shading_language_420pack : enable\n"
|
||||
"layout (location = 0) out vec2 samplePos;\n"
|
||||
//"out gl_PerVertex {\n"
|
||||
//" vec4 gl_Position;\n"
|
||||
//" float gl_ClipDistance[1];\n"
|
||||
//"};\n"
|
||||
"void main() {\n"
|
||||
" vec2 vertices[3];"
|
||||
" vertices[0] = vec2(-0.5, -0.5);\n"
|
||||
" vertices[1] = vec2( 0.5, -0.5);\n"
|
||||
" vertices[2] = vec2( 0.5, 0.5);\n"
|
||||
" vec2 positions[3];"
|
||||
" positions[0] = vec2( 0.0, 0.0);\n"
|
||||
" positions[1] = vec2( 1.0, 0.0);\n"
|
||||
" positions[2] = vec2( 1.0, 1.0);\n"
|
||||
//" gl_ClipDistance[0] = 0.0;\n"
|
||||
" samplePos = positions[gl_VertexID % 3];\n"
|
||||
" gl_Position = vec4(vertices[gl_VertexID % 3], 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static const char *fragShaderText =
|
||||
"#version 140\n"
|
||||
"#extension GL_ARB_separate_shader_objects : enable\n"
|
||||
"#extension GL_ARB_shading_language_420pack : enable\n"
|
||||
"layout (location = 0) in vec2 samplePos;\n"
|
||||
"layout (binding = 0) uniform sampler2D surface;\n"
|
||||
"layout (location=0) out vec4 outColor;\n"
|
||||
"void main() {\n"
|
||||
//" vec4 texColor = textureLod(surface, samplePos, 0.0 + gl_ClipDistance[0]);\n"
|
||||
" vec4 texColor = textureLod(surface, samplePos, 0.0);\n"
|
||||
" outColor = texColor;\n"
|
||||
"}\n";
|
||||
|
||||
XglTestFramework::m_use_bil = true;
|
||||
DrawTexturedTriangle(vertShaderText, fragShaderText);
|
||||
}
|
||||
|
||||
TEST_F(XglRenderTest, VSTexture)
|
||||
{
|
||||
// The expected result from this test is a green and red triangle;
|
||||
@ -2050,6 +2093,45 @@ TEST_F(XglRenderTest, TriangleFSAnonymousUniformBlockBinding)
|
||||
DrawTriangleFSUniformBlockBinding(vertShaderText, fragShaderText);
|
||||
}
|
||||
|
||||
TEST_F(XglRenderTest, ClipDistance)
|
||||
{
|
||||
// This should render a green triange. It doesn't do anything with user clip planes yet.
|
||||
static const char *vertShaderText =
|
||||
"#version 330 core\n"
|
||||
"#extension GL_ARB_separate_shader_objects : enable\n"
|
||||
"#extension GL_ARB_shading_language_420pack : enable\n"
|
||||
"out gl_PerVertex {\n"
|
||||
" vec4 gl_Position;\n"
|
||||
" float gl_ClipDistance[1];\n"
|
||||
"};\n"
|
||||
"void main() {\n"
|
||||
" vec2 vertices[3];"
|
||||
" vertices[0] = vec2(-0.5, -0.5);\n"
|
||||
" vertices[1] = vec2( 0.5, -0.5);\n"
|
||||
" vertices[2] = vec2( 0.5, 0.5);\n"
|
||||
" gl_ClipDistance[0] = 1.0;\n"
|
||||
" //gl_ClipDistance[1] = 0.0;\n"
|
||||
" //gl_ClipDistance[2] = 0.0;\n"
|
||||
" //gl_ClipDistance[3] = 0.0;\n"
|
||||
" //gl_ClipDistance[4] = 0.0;\n"
|
||||
" //gl_ClipDistance[5] = 0.0;\n"
|
||||
" //gl_ClipDistance[6] = 0.0;\n"
|
||||
" //gl_ClipDistance[7] = 0.0;\n"
|
||||
" gl_Position = vec4(vertices[gl_VertexID % 3], 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static const char *fragShaderText =
|
||||
"#version 140\n"
|
||||
"#extension GL_ARB_separate_shader_objects : enable\n"
|
||||
"#extension GL_ARB_shading_language_420pack : enable\n"
|
||||
"void main() {\n"
|
||||
" gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
XglTestFramework::m_use_bil = false;
|
||||
DrawTriangleTest(vertShaderText, fragShaderText);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int result;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user