Hash :
fca78130
Author :
Date :
2017-09-06T13:51:39
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: Geoff Lang <geofflang@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ANGLEPerfTests:
// Base class for google test performance tests
//
#ifndef PERF_TESTS_ANGLE_PERF_TEST_H_
#define PERF_TESTS_ANGLE_PERF_TEST_H_
#include <string>
#include <vector>
#include <gtest/gtest.h>
#include <EGL/egl.h>
#include <EGL/eglext.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"
class Event;
#if !defined(ASSERT_GL_NO_ERROR)
#define ASSERT_GL_NO_ERROR() ASSERT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError())
#endif // !defined(ASSERT_GL_NO_ERROR)
#if !defined(ASSERT_GLENUM_EQ)
#define ASSERT_GLENUM_EQ(expected, actual) \
ASSERT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
#endif // !defined(ASSERT_GLENUM_EQ)
class ANGLEPerfTest : public testing::Test, angle::NonCopyable
{
public:
ANGLEPerfTest(const std::string &name, const std::string &suffix);
virtual ~ANGLEPerfTest();
virtual void step() = 0;
// Called right before timer is stopped to let the test wait for asynchronous operations.
virtual void finishTest() {}
protected:
void run();
void printResult(const std::string &trace, double value, const std::string &units, bool important) const;
void printResult(const std::string &trace, size_t value, const std::string &units, bool important) const;
void SetUp() override;
void TearDown() override;
// Normalize a time value according to the number of test loop iterations (mFrameCount)
double normalizedTime(size_t value) const;
// Call if the test step was aborted and the test should stop running.
void abortTest() { mRunning = false; }
unsigned int getNumStepsPerformed() const { return mNumStepsPerformed; }
std::string mName;
std::string mSuffix;
Timer *mTimer;
double mRunTimeSeconds;
bool mSkipTest;
private:
unsigned int mNumStepsPerformed;
bool mRunning;
};
struct RenderTestParams : public angle::PlatformParameters
{
virtual std::string suffix() const;
EGLint windowWidth;
EGLint windowHeight;
};
class ANGLERenderTest : public ANGLEPerfTest
{
public:
ANGLERenderTest(const std::string &name, const RenderTestParams &testParams);
ANGLERenderTest(const std::string &name,
const RenderTestParams &testParams,
const std::vector<std::string> &extensionPrerequisites);
~ANGLERenderTest();
virtual void initializeBenchmark() { }
virtual void destroyBenchmark() { }
virtual void drawBenchmark() = 0;
bool popEvent(Event *event);
OSWindow *getWindow();
virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {}
protected:
const RenderTestParams &mTestParams;
private:
void SetUp() override;
void TearDown() override;
void step() override;
void finishTest() override;
bool areExtensionPrerequisitesFulfilled() const;
EGLWindow *mEGLWindow;
OSWindow *mOSWindow;
std::vector<std::string> mExtensionPrerequisites;
angle::PlatformMethods mPlatformMethods;
};
#endif // PERF_TESTS_ANGLE_PERF_TEST_H_