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 @@
//
#include "ANGLEPerfTest.h"
#include "third_party/perf/perf_test.h"
#include <cassert>
#include <cmath>
#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)
: mName(name),
mSuffix(suffix),
......@@ -140,6 +152,13 @@ void ANGLERenderTest::SetUp()
mTestParams.eglParameters);
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))
{
FAIL() << "Failed initializing OSWindow";
......
......@@ -17,13 +17,14 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "common/angleutils.h"
#include "common/debug.h"
#include "EGLWindow.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_instantiate.h"
#include "Timer.h"
class Event;
......@@ -99,6 +100,8 @@ class ANGLERenderTest : public ANGLEPerfTest
OSWindow *getWindow();
virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {}
protected:
const RenderTestParams &mTestParams;
......@@ -114,6 +117,7 @@ class ANGLERenderTest : public ANGLEPerfTest
EGLWindow *mEGLWindow;
OSWindow *mOSWindow;
std::vector<std::string> mExtensionPrerequisites;
angle::PlatformMethods mPlatformMethods;
};
#endif // PERF_TESTS_ANGLE_PERF_TEST_H_
......@@ -12,6 +12,7 @@
#include "ANGLEPerfTest.h"
#include "common/vector_utils.h"
#include "platform/WorkaroundsD3D.h"
#include "shader_utils.h"
#include "test_utils/gl_raii.h"
#include "tests/test_utils/ANGLETest.h"
......@@ -49,20 +50,26 @@ struct Vertex
enum class MultiviewOption
{
NoAcceleration,
InstancedMultiview,
InstancedMultiviewVertexShader,
InstancedMultiviewGeometryShader,
Unspecified
};
using MultiviewPerfWorkload = std::pair<int, int>;
struct MultiviewPerfParams final : public RenderTestParams
{
MultiviewPerfParams()
MultiviewPerfParams(const EGLPlatformParameters &platformParametersIn,
const MultiviewPerfWorkload &workloadIn,
MultiviewOption multiviewOptionIn)
{
majorVersion = 3;
minorVersion = 0;
windowWidth = 64;
windowHeight = 64;
multiviewOption = MultiviewOption::Unspecified;
eglParameters = platformParametersIn;
windowWidth = workloadIn.first;
windowHeight = workloadIn.second;
multiviewOption = multiviewOptionIn;
numViews = 2;
}
......@@ -74,8 +81,11 @@ struct MultiviewPerfParams final : public RenderTestParams
case MultiviewOption::NoAcceleration:
name += "_no_acc";
break;
case MultiviewOption::InstancedMultiview:
name += "_instanced_multiview";
case MultiviewOption::InstancedMultiviewVertexShader:
name += "_instanced_multiview_vertex_shader";
break;
case MultiviewOption::InstancedMultiviewGeometryShader:
name += "_instanced_multiview_geometry_shader";
break;
default:
UNREACHABLE();
......@@ -113,6 +123,12 @@ class MultiviewBenchmark : public ANGLERenderTest,
void initializeBenchmark() override;
void drawBenchmark() final;
void overrideWorkaroundsD3D(WorkaroundsD3D *workarounds) override
{
workarounds->selectViewInGeometryShader =
(GetParam().multiviewOption == MultiviewOption::InstancedMultiviewGeometryShader);
}
protected:
virtual void renderScene() = 0;
......@@ -182,7 +198,8 @@ void MultiviewBenchmark::initializeBenchmark()
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D,
mDepthTexture, 0);
break;
case MultiviewOption::InstancedMultiview:
case MultiviewOption::InstancedMultiviewVertexShader:
case MultiviewOption::InstancedMultiviewGeometryShader:
{
const int widthPerView = params->windowWidth / params->numViews;
std::vector<GLint> viewportOffsets(2 * params->numViews);
......@@ -227,7 +244,8 @@ void MultiviewBenchmark::drawBenchmark()
renderScene();
}
break;
case MultiviewOption::InstancedMultiview:
case MultiviewOption::InstancedMultiviewVertexShader:
case MultiviewOption::InstancedMultiviewGeometryShader:
glViewport(0, 0, viewWidth, viewHeight);
glScissor(0, 0, viewWidth, viewHeight);
renderScene();
......@@ -458,27 +476,37 @@ void MultiviewGPUBoundBenchmark::renderScene()
glDrawArrays(GL_TRIANGLES, 0, viewWidth * viewHeight * 6);
}
MultiviewPerfParams SmallWorkload(MultiviewOption multiviewOption,
const EGLPlatformParameters &eglParameters)
namespace
{
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;
params.multiviewOption = multiviewOption;
params.eglParameters = eglParameters;
params.windowWidth = 64;
params.windowHeight = 64;
return params;
return MultiviewPerfParams(egl_platform::D3D11(), workload,
MultiviewOption::InstancedMultiviewGeometryShader);
}
MultiviewPerfParams BigWorkload(MultiviewOption multiviewOption,
const EGLPlatformParameters &eglParameters)
MultiviewPerfParams SelectViewInVertexShader(const EGLPlatformParameters &eglParameters,
const MultiviewPerfWorkload &workload)
{
MultiviewPerfParams params;
params.multiviewOption = multiviewOption;
params.eglParameters = eglParameters;
params.windowWidth = 1024;
params.windowHeight = 768;
return params;
return MultiviewPerfParams(eglParameters, workload,
MultiviewOption::InstancedMultiviewVertexShader);
}
} // namespace
TEST_P(MultiviewCPUBoundBenchmark, Run)
{
......@@ -486,10 +514,11 @@ TEST_P(MultiviewCPUBoundBenchmark, Run)
}
ANGLE_INSTANTIATE_TEST(MultiviewCPUBoundBenchmark,
SmallWorkload(MultiviewOption::NoAcceleration, egl_platform::OPENGL()),
SmallWorkload(MultiviewOption::InstancedMultiview, egl_platform::OPENGL()),
SmallWorkload(MultiviewOption::NoAcceleration, egl_platform::D3D11()),
SmallWorkload(MultiviewOption::InstancedMultiview, egl_platform::D3D11()));
NoAcceleration(egl_platform::OPENGL(), SmallWorkload()),
NoAcceleration(egl_platform::D3D11(), SmallWorkload()),
SelectViewInGeometryShader(SmallWorkload()),
SelectViewInVertexShader(egl_platform::OPENGL(), SmallWorkload()),
SelectViewInVertexShader(egl_platform::D3D11(), SmallWorkload()));
TEST_P(MultiviewGPUBoundBenchmark, Run)
{
......@@ -497,9 +526,10 @@ TEST_P(MultiviewGPUBoundBenchmark, Run)
}
ANGLE_INSTANTIATE_TEST(MultiviewGPUBoundBenchmark,
BigWorkload(MultiviewOption::NoAcceleration, egl_platform::OPENGL()),
BigWorkload(MultiviewOption::InstancedMultiview, egl_platform::OPENGL()),
BigWorkload(MultiviewOption::NoAcceleration, egl_platform::D3D11()),
BigWorkload(MultiviewOption::InstancedMultiview, egl_platform::D3D11()));
NoAcceleration(egl_platform::OPENGL(), BigWorkload()),
NoAcceleration(egl_platform::D3D11(), BigWorkload()),
SelectViewInGeometryShader(BigWorkload()),
SelectViewInVertexShader(egl_platform::OPENGL(), BigWorkload()),
SelectViewInVertexShader(egl_platform::D3D11(), BigWorkload()));
} // 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