Commit fca78130 by Martin Radev Committed by Commit Bot

Extend multiview perf tests to cover all extension code paths

The ANGLE_multiview extension can be supported with three possible code paths - through view being selected in the vertex shader on D3D and OpenGL, and through the view being selected in the geometry shader on D3D only. This patch extends the multi-view performance tests to benchmark these three different code paths. BUG=angleproject:2062 TEST=angle_end2end_tests Change-Id: I443e4db64a95eede1142718a43a095ee5a03738c Reviewed-on: https://chromium-review.googlesource.com/652466 Commit-Queue: Martin Radev <mradev@nvidia.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent a0d38875
...@@ -8,13 +8,25 @@ ...@@ -8,13 +8,25 @@
// //
#include "ANGLEPerfTest.h" #include "ANGLEPerfTest.h"
#include "third_party/perf/perf_test.h" #include "third_party/perf/perf_test.h"
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
namespace
{
void EmptyPlatformMethod(angle::PlatformMethods *, const char *)
{
}
void OverrideWorkaroundsD3D(angle::PlatformMethods *platform, angle::WorkaroundsD3D *workaroundsD3D)
{
auto *angleRenderTest = static_cast<ANGLERenderTest *>(platform->context);
angleRenderTest->overrideWorkaroundsD3D(workaroundsD3D);
}
} // namespace
ANGLEPerfTest::ANGLEPerfTest(const std::string &name, const std::string &suffix) ANGLEPerfTest::ANGLEPerfTest(const std::string &name, const std::string &suffix)
: mName(name), : mName(name),
mSuffix(suffix), mSuffix(suffix),
...@@ -140,6 +152,13 @@ void ANGLERenderTest::SetUp() ...@@ -140,6 +152,13 @@ void ANGLERenderTest::SetUp()
mTestParams.eglParameters); mTestParams.eglParameters);
mEGLWindow->setSwapInterval(0); mEGLWindow->setSwapInterval(0);
mPlatformMethods.overrideWorkaroundsD3D = OverrideWorkaroundsD3D;
mPlatformMethods.logError = EmptyPlatformMethod;
mPlatformMethods.logWarning = EmptyPlatformMethod;
mPlatformMethods.logInfo = EmptyPlatformMethod;
mPlatformMethods.context = this;
mEGLWindow->setPlatformMethods(&mPlatformMethods);
if (!mOSWindow->initialize(mName, mTestParams.windowWidth, mTestParams.windowHeight)) if (!mOSWindow->initialize(mName, mTestParams.windowWidth, mTestParams.windowHeight))
{ {
FAIL() << "Failed initializing OSWindow"; FAIL() << "Failed initializing OSWindow";
......
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include "common/angleutils.h"
#include "common/debug.h"
#include "EGLWindow.h" #include "EGLWindow.h"
#include "OSWindow.h" #include "OSWindow.h"
#include "Timer.h"
#include "common/angleutils.h"
#include "common/debug.h"
#include "platform/Platform.h"
#include "test_utils/angle_test_configs.h" #include "test_utils/angle_test_configs.h"
#include "test_utils/angle_test_instantiate.h" #include "test_utils/angle_test_instantiate.h"
#include "Timer.h"
class Event; class Event;
...@@ -99,6 +100,8 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -99,6 +100,8 @@ class ANGLERenderTest : public ANGLEPerfTest
OSWindow *getWindow(); OSWindow *getWindow();
virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {}
protected: protected:
const RenderTestParams &mTestParams; const RenderTestParams &mTestParams;
...@@ -114,6 +117,7 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -114,6 +117,7 @@ class ANGLERenderTest : public ANGLEPerfTest
EGLWindow *mEGLWindow; EGLWindow *mEGLWindow;
OSWindow *mOSWindow; OSWindow *mOSWindow;
std::vector<std::string> mExtensionPrerequisites; std::vector<std::string> mExtensionPrerequisites;
angle::PlatformMethods mPlatformMethods;
}; };
#endif // PERF_TESTS_ANGLE_PERF_TEST_H_ #endif // PERF_TESTS_ANGLE_PERF_TEST_H_
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ANGLEPerfTest.h" #include "ANGLEPerfTest.h"
#include "common/vector_utils.h" #include "common/vector_utils.h"
#include "platform/WorkaroundsD3D.h"
#include "shader_utils.h" #include "shader_utils.h"
#include "test_utils/gl_raii.h" #include "test_utils/gl_raii.h"
#include "tests/test_utils/ANGLETest.h" #include "tests/test_utils/ANGLETest.h"
...@@ -49,20 +50,26 @@ struct Vertex ...@@ -49,20 +50,26 @@ struct Vertex
enum class MultiviewOption enum class MultiviewOption
{ {
NoAcceleration, NoAcceleration,
InstancedMultiview, InstancedMultiviewVertexShader,
InstancedMultiviewGeometryShader,
Unspecified Unspecified
}; };
using MultiviewPerfWorkload = std::pair<int, int>;
struct MultiviewPerfParams final : public RenderTestParams struct MultiviewPerfParams final : public RenderTestParams
{ {
MultiviewPerfParams() MultiviewPerfParams(const EGLPlatformParameters &platformParametersIn,
const MultiviewPerfWorkload &workloadIn,
MultiviewOption multiviewOptionIn)
{ {
majorVersion = 3; majorVersion = 3;
minorVersion = 0; minorVersion = 0;
windowWidth = 64; eglParameters = platformParametersIn;
windowHeight = 64; windowWidth = workloadIn.first;
multiviewOption = MultiviewOption::Unspecified; windowHeight = workloadIn.second;
multiviewOption = multiviewOptionIn;
numViews = 2; numViews = 2;
} }
...@@ -74,8 +81,11 @@ struct MultiviewPerfParams final : public RenderTestParams ...@@ -74,8 +81,11 @@ struct MultiviewPerfParams final : public RenderTestParams
case MultiviewOption::NoAcceleration: case MultiviewOption::NoAcceleration:
name += "_no_acc"; name += "_no_acc";
break; break;
case MultiviewOption::InstancedMultiview: case MultiviewOption::InstancedMultiviewVertexShader:
name += "_instanced_multiview"; name += "_instanced_multiview_vertex_shader";
break;
case MultiviewOption::InstancedMultiviewGeometryShader:
name += "_instanced_multiview_geometry_shader";
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -113,6 +123,12 @@ class MultiviewBenchmark : public ANGLERenderTest, ...@@ -113,6 +123,12 @@ class MultiviewBenchmark : public ANGLERenderTest,
void initializeBenchmark() override; void initializeBenchmark() override;
void drawBenchmark() final; void drawBenchmark() final;
void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) override
{
workarounds->selectViewInGeometryShader =
(GetParam().multiviewOption == MultiviewOption::InstancedMultiviewGeometryShader);
}
protected: protected:
virtual void renderScene() = 0; virtual void renderScene() = 0;
...@@ -182,7 +198,8 @@ void MultiviewBenchmark::initializeBenchmark() ...@@ -182,7 +198,8 @@ void MultiviewBenchmark::initializeBenchmark()
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D,
mDepthTexture, 0); mDepthTexture, 0);
break; break;
case MultiviewOption::InstancedMultiview: case MultiviewOption::InstancedMultiviewVertexShader:
case MultiviewOption::InstancedMultiviewGeometryShader:
{ {
const int widthPerView = params->windowWidth / params->numViews; const int widthPerView = params->windowWidth / params->numViews;
std::vector<GLint> viewportOffsets(2 * params->numViews); std::vector<GLint> viewportOffsets(2 * params->numViews);
...@@ -227,7 +244,8 @@ void MultiviewBenchmark::drawBenchmark() ...@@ -227,7 +244,8 @@ void MultiviewBenchmark::drawBenchmark()
renderScene(); renderScene();
} }
break; break;
case MultiviewOption::InstancedMultiview: case MultiviewOption::InstancedMultiviewVertexShader:
case MultiviewOption::InstancedMultiviewGeometryShader:
glViewport(0, 0, viewWidth, viewHeight); glViewport(0, 0, viewWidth, viewHeight);
glScissor(0, 0, viewWidth, viewHeight); glScissor(0, 0, viewWidth, viewHeight);
renderScene(); renderScene();
...@@ -458,27 +476,37 @@ void MultiviewGPUBoundBenchmark::renderScene() ...@@ -458,27 +476,37 @@ void MultiviewGPUBoundBenchmark::renderScene()
glDrawArrays(GL_TRIANGLES, 0, viewWidth * viewHeight * 6); glDrawArrays(GL_TRIANGLES, 0, viewWidth * viewHeight * 6);
} }
MultiviewPerfParams SmallWorkload(MultiviewOption multiviewOption, namespace
const EGLPlatformParameters &eglParameters) {
MultiviewPerfWorkload SmallWorkload()
{
return MultiviewPerfWorkload(64, 64);
}
MultiviewPerfWorkload BigWorkload()
{
return MultiviewPerfWorkload(1024, 768);
}
MultiviewPerfParams NoAcceleration(const EGLPlatformParameters &eglParameters,
const MultiviewPerfWorkload &workload)
{
return MultiviewPerfParams(eglParameters, workload, MultiviewOption::NoAcceleration);
}
MultiviewPerfParams SelectViewInGeometryShader(const MultiviewPerfWorkload &workload)
{ {
MultiviewPerfParams params; return MultiviewPerfParams(egl_platform::D3D11(), workload,
params.multiviewOption = multiviewOption; MultiviewOption::InstancedMultiviewGeometryShader);
params.eglParameters = eglParameters;
params.windowWidth = 64;
params.windowHeight = 64;
return params;
} }
MultiviewPerfParams BigWorkload(MultiviewOption multiviewOption, MultiviewPerfParams SelectViewInVertexShader(const EGLPlatformParameters &eglParameters,
const EGLPlatformParameters &eglParameters) const MultiviewPerfWorkload &workload)
{ {
MultiviewPerfParams params; return MultiviewPerfParams(eglParameters, workload,
params.multiviewOption = multiviewOption; MultiviewOption::InstancedMultiviewVertexShader);
params.eglParameters = eglParameters;
params.windowWidth = 1024;
params.windowHeight = 768;
return params;
} }
} // namespace
TEST_P(MultiviewCPUBoundBenchmark, Run) TEST_P(MultiviewCPUBoundBenchmark, Run)
{ {
...@@ -486,10 +514,11 @@ TEST_P(MultiviewCPUBoundBenchmark, Run) ...@@ -486,10 +514,11 @@ TEST_P(MultiviewCPUBoundBenchmark, Run)
} }
ANGLE_INSTANTIATE_TEST(MultiviewCPUBoundBenchmark, ANGLE_INSTANTIATE_TEST(MultiviewCPUBoundBenchmark,
SmallWorkload(MultiviewOption::NoAcceleration, egl_platform::OPENGL()), NoAcceleration(egl_platform::OPENGL(), SmallWorkload()),
SmallWorkload(MultiviewOption::InstancedMultiview, egl_platform::OPENGL()), NoAcceleration(egl_platform::D3D11(), SmallWorkload()),
SmallWorkload(MultiviewOption::NoAcceleration, egl_platform::D3D11()), SelectViewInGeometryShader(SmallWorkload()),
SmallWorkload(MultiviewOption::InstancedMultiview, egl_platform::D3D11())); SelectViewInVertexShader(egl_platform::OPENGL(), SmallWorkload()),
SelectViewInVertexShader(egl_platform::D3D11(), SmallWorkload()));
TEST_P(MultiviewGPUBoundBenchmark, Run) TEST_P(MultiviewGPUBoundBenchmark, Run)
{ {
...@@ -497,9 +526,10 @@ TEST_P(MultiviewGPUBoundBenchmark, Run) ...@@ -497,9 +526,10 @@ TEST_P(MultiviewGPUBoundBenchmark, Run)
} }
ANGLE_INSTANTIATE_TEST(MultiviewGPUBoundBenchmark, ANGLE_INSTANTIATE_TEST(MultiviewGPUBoundBenchmark,
BigWorkload(MultiviewOption::NoAcceleration, egl_platform::OPENGL()), NoAcceleration(egl_platform::OPENGL(), BigWorkload()),
BigWorkload(MultiviewOption::InstancedMultiview, egl_platform::OPENGL()), NoAcceleration(egl_platform::D3D11(), BigWorkload()),
BigWorkload(MultiviewOption::NoAcceleration, egl_platform::D3D11()), SelectViewInGeometryShader(BigWorkload()),
BigWorkload(MultiviewOption::InstancedMultiview, egl_platform::D3D11())); SelectViewInVertexShader(egl_platform::OPENGL(), BigWorkload()),
SelectViewInVertexShader(egl_platform::D3D11(), BigWorkload()));
} // anonymous namespace } // anonymous namespace
\ No newline at end of file
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