Commit 3764b257 by Jamie Madill Committed by Commit Bot

Vulkan: Run simple triangle perf test.

The most basic perf test possible. BUG=angleproject:xxxx Change-Id: I71b28098c0a1f2174a0177b08bddf74d337438e9 Reviewed-on: https://chromium-review.googlesource.com/427270Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent feb8c686
...@@ -89,6 +89,8 @@ std::string RenderTestParams::suffix() const ...@@ -89,6 +89,8 @@ std::string RenderTestParams::suffix() const
return "_gles"; return "_gles";
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE: case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
return "_default"; return "_default";
case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
return "_vulkan";
default: default:
assert(0); assert(0);
return "_unk"; return "_unk";
......
...@@ -43,7 +43,7 @@ void DrawCallPerfBenchmark::initializeBenchmark() ...@@ -43,7 +43,7 @@ void DrawCallPerfBenchmark::initializeBenchmark()
ASSERT_LT(0u, params.iterations); ASSERT_LT(0u, params.iterations);
mProgram = SetupSimpleScaleAndOffsetProgram(); mProgram = SetupSimpleDrawProgram();
ASSERT_NE(0u, mProgram); ASSERT_NE(0u, mProgram);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
...@@ -109,6 +109,7 @@ ANGLE_INSTANTIATE_TEST(DrawCallPerfBenchmark, ...@@ -109,6 +109,7 @@ ANGLE_INSTANTIATE_TEST(DrawCallPerfBenchmark,
DrawCallPerfOpenGLParams(false, false), DrawCallPerfOpenGLParams(false, false),
DrawCallPerfOpenGLParams(true, false), DrawCallPerfOpenGLParams(true, false),
DrawCallPerfOpenGLParams(true, true), DrawCallPerfOpenGLParams(true, true),
DrawCallPerfValidationOnly()); DrawCallPerfValidationOnly(),
DrawCallPerfVulkanParams(false));
} // namespace } // namespace
...@@ -76,3 +76,11 @@ DrawCallPerfParams DrawCallPerfValidationOnly() ...@@ -76,3 +76,11 @@ DrawCallPerfParams DrawCallPerfValidationOnly()
params.runTimeSeconds = 5.0; params.runTimeSeconds = 5.0;
return params; return params;
} }
DrawCallPerfParams DrawCallPerfVulkanParams(bool renderToTexture)
{
DrawCallPerfParams params;
params.eglParameters = VULKAN();
params.useFBO = renderToTexture;
return params;
}
...@@ -43,4 +43,6 @@ DrawCallPerfParams DrawCallPerfOpenGLParams(bool useNullDevice, bool renderToTex ...@@ -43,4 +43,6 @@ DrawCallPerfParams DrawCallPerfOpenGLParams(bool useNullDevice, bool renderToTex
DrawCallPerfParams DrawCallPerfValidationOnly(); DrawCallPerfParams DrawCallPerfValidationOnly();
DrawCallPerfParams DrawCallPerfVulkanParams(bool renderToTexture);
#endif // TESTS_PERF_TESTS_DRAW_CALL_PERF_PARAMS_H_ #endif // TESTS_PERF_TESTS_DRAW_CALL_PERF_PARAMS_H_
...@@ -32,6 +32,23 @@ const char *SimpleScaleAndOffsetVertexShaderSource() ...@@ -32,6 +32,23 @@ const char *SimpleScaleAndOffsetVertexShaderSource()
// clang-format on // clang-format on
} }
const char *SimpleDrawVertexShaderSource()
{
// clang-format off
return SHADER_SOURCE
(
attribute vec2 vPosition;
const float scale = 0.5;
const float offset = -0.5;
void main()
{
gl_Position = vec4(vPosition * vec2(scale) + vec2(offset), 0, 1);
}
);
// clang-format on
}
const char *SimpleFragmentShaderSource() const char *SimpleFragmentShaderSource()
{ {
// clang-format off // clang-format off
...@@ -84,6 +101,22 @@ GLuint SetupSimpleScaleAndOffsetProgram() ...@@ -84,6 +101,22 @@ GLuint SetupSimpleScaleAndOffsetProgram()
return program; return program;
} }
GLuint SetupSimpleDrawProgram()
{
const std::string vs = SimpleDrawVertexShaderSource();
const std::string fs = SimpleFragmentShaderSource();
GLuint program = CompileProgram(vs, fs);
if (program == 0u)
{
return program;
}
// Use the program object
glUseProgram(program);
return program;
}
GLuint Create2DTriangleBuffer(size_t numTris, GLenum usage) GLuint Create2DTriangleBuffer(size_t numTris, GLenum usage)
{ {
GLuint buffer = 0u; GLuint buffer = 0u;
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
#include "angle_gl.h" #include "angle_gl.h"
// Returns program ID. The program is left in use, no uniforms.
GLuint SetupSimpleDrawProgram();
// Returns program ID. The program is left in use and the uniforms are set to default values: // Returns program ID. The program is left in use and the uniforms are set to default values:
// uScale = 0.5, uOffset = -0.5 // uScale = 0.5, uOffset = -0.5
GLuint SetupSimpleScaleAndOffsetProgram(); GLuint SetupSimpleScaleAndOffsetProgram();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment