Commit 193c671d by Jamie Madill Committed by Commit Bot

Add a perf test for render-to-texture.

This perf test focuses on the hotspot we have in Framebuffer:: checkStatus. It's exactly the same as the standard draw call benchmark, but binds a Framebuffer before rendering. BUG=angleproject:1388 Change-Id: Icc7a99e399f469d765bf1ac6abe0562977b9a39d Reviewed-on: https://chromium-review.googlesource.com/348956Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 9de84a5d
...@@ -26,9 +26,6 @@ struct DrawCallPerfParams final : public RenderTestParams ...@@ -26,9 +26,6 @@ struct DrawCallPerfParams final : public RenderTestParams
minorVersion = 0; minorVersion = 0;
windowWidth = 256; windowWidth = 256;
windowHeight = 256; windowHeight = 256;
iterations = 50;
numTris = 1;
runTimeSeconds = 10.0;
} }
std::string suffix() const override std::string suffix() const override
...@@ -42,6 +39,11 @@ struct DrawCallPerfParams final : public RenderTestParams ...@@ -42,6 +39,11 @@ struct DrawCallPerfParams final : public RenderTestParams
strstr << "_validation_only"; strstr << "_validation_only";
} }
if (useFBO)
{
strstr << "_render_to_texture";
}
if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE) if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE)
{ {
strstr << "_null"; strstr << "_null";
...@@ -50,9 +52,10 @@ struct DrawCallPerfParams final : public RenderTestParams ...@@ -50,9 +52,10 @@ struct DrawCallPerfParams final : public RenderTestParams
return strstr.str(); return strstr.str();
} }
unsigned int iterations; unsigned int iterations = 50;
double runTimeSeconds; double runTimeSeconds = 10.0;
int numTris; int numTris = 1;
bool useFBO = false;
}; };
std::ostream &operator<<(std::ostream &os, const DrawCallPerfParams &params) std::ostream &operator<<(std::ostream &os, const DrawCallPerfParams &params)
...@@ -72,16 +75,14 @@ class DrawCallPerfBenchmark : public ANGLERenderTest, ...@@ -72,16 +75,14 @@ class DrawCallPerfBenchmark : public ANGLERenderTest,
void drawBenchmark() override; void drawBenchmark() override;
private: private:
GLuint mProgram; GLuint mProgram = 0;
GLuint mBuffer; GLuint mBuffer = 0;
int mNumTris; GLuint mFBO = 0;
GLuint mTexture = 0;
int mNumTris = GetParam().numTris;
}; };
DrawCallPerfBenchmark::DrawCallPerfBenchmark() DrawCallPerfBenchmark::DrawCallPerfBenchmark() : ANGLERenderTest("DrawCallPerf", GetParam())
: ANGLERenderTest("DrawCallPerf", GetParam()),
mProgram(0),
mBuffer(0),
mNumTris(GetParam().numTris)
{ {
mRunTimeSeconds = GetParam().runTimeSeconds; mRunTimeSeconds = GetParam().runTimeSeconds;
} }
...@@ -155,6 +156,17 @@ void DrawCallPerfBenchmark::initializeBenchmark() ...@@ -155,6 +156,17 @@ void DrawCallPerfBenchmark::initializeBenchmark()
glUniform1f(glGetUniformLocation(mProgram, "uScale"), scale); glUniform1f(glGetUniformLocation(mProgram, "uScale"), scale);
glUniform1f(glGetUniformLocation(mProgram, "uOffset"), offset); glUniform1f(glGetUniformLocation(mProgram, "uOffset"), offset);
if (params.useFBO)
{
glGenFramebuffers(1, &mFBO);
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
glGenTextures(1, &mTexture);
glBindTexture(GL_TEXTURE_2D, mTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindow()->getWidth(), getWindow()->getHeight(),
0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0);
}
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
} }
...@@ -162,6 +174,8 @@ void DrawCallPerfBenchmark::destroyBenchmark() ...@@ -162,6 +174,8 @@ void DrawCallPerfBenchmark::destroyBenchmark()
{ {
glDeleteProgram(mProgram); glDeleteProgram(mProgram);
glDeleteBuffers(1, &mBuffer); glDeleteBuffers(1, &mBuffer);
glDeleteTextures(1, &mTexture);
glDeleteFramebuffers(1, &mFBO);
} }
void DrawCallPerfBenchmark::drawBenchmark() void DrawCallPerfBenchmark::drawBenchmark()
...@@ -180,24 +194,27 @@ void DrawCallPerfBenchmark::drawBenchmark() ...@@ -180,24 +194,27 @@ void DrawCallPerfBenchmark::drawBenchmark()
using namespace egl_platform; using namespace egl_platform;
DrawCallPerfParams DrawCallPerfD3D11Params(bool useNullDevice) DrawCallPerfParams DrawCallPerfD3D11Params(bool useNullDevice, bool renderToTexture)
{ {
DrawCallPerfParams params; DrawCallPerfParams params;
params.eglParameters = useNullDevice ? D3D11_NULL() : D3D11(); params.eglParameters = useNullDevice ? D3D11_NULL() : D3D11();
params.useFBO = renderToTexture;
return params; return params;
} }
DrawCallPerfParams DrawCallPerfD3D9Params(bool useNullDevice) DrawCallPerfParams DrawCallPerfD3D9Params(bool useNullDevice, bool renderToTexture)
{ {
DrawCallPerfParams params; DrawCallPerfParams params;
params.eglParameters = useNullDevice ? D3D9_NULL() : D3D9(); params.eglParameters = useNullDevice ? D3D9_NULL() : D3D9();
params.useFBO = renderToTexture;
return params; return params;
} }
DrawCallPerfParams DrawCallPerfOpenGLParams(bool useNullDevice) DrawCallPerfParams DrawCallPerfOpenGLParams(bool useNullDevice, bool renderToTexture)
{ {
DrawCallPerfParams params; DrawCallPerfParams params;
params.eglParameters = useNullDevice ? OPENGL_NULL() : OPENGL(); params.eglParameters = useNullDevice ? OPENGL_NULL() : OPENGL();
params.useFBO = renderToTexture;
return params; return params;
} }
...@@ -217,12 +234,14 @@ TEST_P(DrawCallPerfBenchmark, Run) ...@@ -217,12 +234,14 @@ TEST_P(DrawCallPerfBenchmark, Run)
} }
ANGLE_INSTANTIATE_TEST(DrawCallPerfBenchmark, ANGLE_INSTANTIATE_TEST(DrawCallPerfBenchmark,
DrawCallPerfD3D11Params(false), DrawCallPerfD3D9Params(false, false),
DrawCallPerfD3D9Params(false), DrawCallPerfD3D9Params(true, false),
DrawCallPerfOpenGLParams(false), DrawCallPerfD3D11Params(false, false),
DrawCallPerfD3D11Params(true), DrawCallPerfD3D11Params(true, false),
DrawCallPerfD3D9Params(true), DrawCallPerfD3D11Params(true, true),
DrawCallPerfOpenGLParams(true), DrawCallPerfOpenGLParams(false, false),
DrawCallPerfOpenGLParams(true, false),
DrawCallPerfOpenGLParams(true, true),
DrawCallPerfValidationOnly()); DrawCallPerfValidationOnly());
} // namespace } // namespace
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