chromium/third_party/angle/src/tests/test_utils/ANGLETest.cpp

//
// Copyright 2015 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.
//
// ANGLETest:
//   Implementation of common ANGLE testing fixture.
//

#include "ANGLETest.h"

#include <algorithm>
#include <cstdlib>

#include "common/PackedEnums.h"
#include "common/platform.h"
#include "gpu_info_util/SystemInfo.h"
#include "test_utils/runner/TestSuite.h"
#include "util/EGLWindow.h"
#include "util/OSWindow.h"
#include "util/random_utils.h"
#include "util/test_utils.h"

#if defined(ANGLE_PLATFORM_WINDOWS)
#    include <VersionHelpers.h>
#endif  // defined(ANGLE_PLATFORM_WINDOWS)

namespace angle
{

const GLColorRGB GLColorRGB::black(0u, 0u, 0u);
const GLColorRGB GLColorRGB::blue(0u, 0u, 255u);
const GLColorRGB GLColorRGB::green(0u, 255u, 0u);
const GLColorRGB GLColorRGB::red(255u, 0u, 0u);
const GLColorRGB GLColorRGB::yellow(255u, 255u, 0);

const GLColor GLColor::black            =;
const GLColor GLColor::blue             =;
const GLColor GLColor::cyan             =;
const GLColor GLColor::green            =;
const GLColor GLColor::red              =;
const GLColor GLColor::transparentBlack =;
const GLColor GLColor::white            =;
const GLColor GLColor::yellow           =;
const GLColor GLColor::magenta          =;

namespace
{
float ColorNorm(GLubyte channelValue)
{}

GLubyte ColorDenorm(float colorValue)
{}

void TestPlatform_logError(PlatformMethods *platform, const char *errorMessage)
{}

void TestPlatform_logWarning(PlatformMethods *platform, const char *warningMessage)
{}

void TestPlatform_logInfo(PlatformMethods *platform, const char *infoMessage) {}

const std::array<Vector3, 6> kQuadVertices =;

const std::array<Vector3, 4> kIndexedQuadVertices =;

constexpr std::array<GLushort, 6> kIndexedQuadIndices =;

const char *GetColorName(GLColor color)
{}

const char *GetColorName(GLColorRGB color)
{}

// Always re-use displays when using --bot-mode in the test runner.
bool gReuseDisplays =;

bool ShouldAlwaysForceNewDisplay(const PlatformParameters &params)
{}

GPUTestConfig::API GetTestConfigAPIFromRenderer(angle::GLESDriverType driverType,
                                                EGLenum renderer,
                                                EGLenum deviceType)
{}
}  // anonymous namespace

GLColorRGB::GLColorRGB(const Vector3 &floatColor)
    :{}

GLColor::GLColor(const Vector3 &floatColor)
    :{}

GLColor::GLColor(const Vector4 &floatColor)
    :{}

GLColor::GLColor(GLuint colorValue) :{}

GLuint GLColor::asUint() const
{}

testing::AssertionResult GLColor::ExpectNear(const GLColor &expected, const GLColor &err) const
{}

void CreatePixelCenterWindowCoords(const std::vector<Vector2> &pixelPoints,
                                   int windowWidth,
                                   int windowHeight,
                                   std::vector<Vector3> *outVertices)
{}

Vector4 GLColor::toNormalizedVector() const
{}

GLColor RandomColor(angle::RNG *rng)
{}

GLColor ReadColor(GLint x, GLint y)
{}

bool operator==(const GLColor &a, const GLColor &b)
{}

bool operator!=(const GLColor &a, const GLColor &b)
{}

std::ostream &operator<<(std::ostream &ostream, const GLColor &color)
{}

bool operator==(const GLColorRGB &a, const GLColorRGB &b)
{}

bool operator!=(const GLColorRGB &a, const GLColorRGB &b)
{}

std::ostream &operator<<(std::ostream &ostream, const GLColorRGB &color)
{}

std::ostream &operator<<(std::ostream &ostream, const GLColor32F &color)
{}

GLColor32F ReadColor32F(GLint x, GLint y)
{}

void LoadEntryPointsWithUtilLoader(angle::GLESDriverType driverType)
{}

bool IsFormatEmulated(GLenum target)
{}

}  // namespace angle

usingnamespaceangle;

PlatformMethods gDefaultPlatformMethods;

namespace
{
TestPlatformContext gPlatformContext;

// After a fixed number of iterations we reset the test window. This works around some driver bugs.
constexpr uint32_t kWindowReuseLimit =;

constexpr char kUseConfig[]                      =;
constexpr char kReuseDisplays[]                  =;
constexpr char kEnableANGLEPerTestCaptureLabel[] =;
constexpr char kBatchId[]                        =;
constexpr char kDelayTestStart[]                 =;
constexpr char kRenderDoc[]                      =;
constexpr char kNoRenderDoc[]                    =;

void SetupEnvironmentVarsForCaptureReplay()
{}
}  // anonymous namespace

int gTestStartDelaySeconds =;

int GetTestStartDelaySeconds()
{}

void SetTestStartDelay(const char *testStartDelay)
{}

#if defined(ANGLE_TEST_ENABLE_RENDERDOC_CAPTURE)
bool gEnableRenderDocCapture =;
#else
bool gEnableRenderDocCapture = false;
#endif

// static
std::array<Vector3, 6> ANGLETestBase::GetQuadVertices()
{}

// static
std::array<GLushort, 6> ANGLETestBase::GetQuadIndices()
{}

// static
std::array<Vector3, 4> ANGLETestBase::GetIndexedQuadVertices()
{}

testing::AssertionResult AssertEGLEnumsEqual(const char *lhsExpr,
                                             const char *rhsExpr,
                                             EGLenum lhs,
                                             EGLenum rhs)
{}

ANGLETestBase::ANGLETestBase(const PlatformParameters &params)
    :{}

void ANGLETestBase::initOSWindow()
{}

ANGLETestBase::~ANGLETestBase()
{}

void ANGLETestBase::ANGLETestSetUp()
{}

void ANGLETestBase::ANGLETestPreTearDown()
{}

void ANGLETestBase::ANGLETestTearDown()
{}

void ANGLETestBase::ReleaseFixtures()
{}

void ANGLETestBase::swapBuffers()
{}

void ANGLETestBase::setupQuadVertexBuffer(GLfloat positionAttribZ, GLfloat positionAttribXYScale)
{}

void ANGLETestBase::setupIndexedQuadVertexBuffer(GLfloat positionAttribZ,
                                                 GLfloat positionAttribXYScale)
{}

void ANGLETestBase::setupIndexedQuadIndexBuffer()
{}

// static
void ANGLETestBase::drawQuad(GLuint program,
                             const std::string &positionAttribName,
                             GLfloat positionAttribZ)
{}

// static
void ANGLETestBase::drawQuad(GLuint program,
                             const std::string &positionAttribName,
                             GLfloat positionAttribZ,
                             GLfloat positionAttribXYScale)
{}

void ANGLETestBase::drawQuad(GLuint program,
                             const std::string &positionAttribName,
                             GLfloat positionAttribZ,
                             GLfloat positionAttribXYScale,
                             bool useVertexBuffer)
{}

void ANGLETestBase::drawQuadInstanced(GLuint program,
                                      const std::string &positionAttribName,
                                      GLfloat positionAttribZ,
                                      GLfloat positionAttribXYScale,
                                      bool useVertexBuffer,
                                      GLuint numInstances)
{}

void ANGLETestBase::drawPatches(GLuint program,
                                const std::string &positionAttribName,
                                GLfloat positionAttribZ,
                                GLfloat positionAttribXYScale,
                                bool useVertexBuffer)
{}

void ANGLETestBase::drawQuad(GLuint program,
                             const std::string &positionAttribName,
                             GLfloat positionAttribZ,
                             GLfloat positionAttribXYScale,
                             bool useVertexBuffer,
                             bool useInstancedDrawCalls,
                             bool useTessellationPatches,
                             GLuint numInstances)
{}

void ANGLETestBase::drawQuadPPO(GLuint vertProgram,
                                const std::string &positionAttribName,
                                const GLfloat positionAttribZ,
                                const GLfloat positionAttribXYScale)
{}

void ANGLETestBase::drawIndexedQuad(GLuint program,
                                    const std::string &positionAttribName,
                                    GLfloat positionAttribZ)
{}

void ANGLETestBase::drawIndexedQuad(GLuint program,
                                    const std::string &positionAttribName,
                                    GLfloat positionAttribZ,
                                    GLfloat positionAttribXYScale)
{}

void ANGLETestBase::drawIndexedQuad(GLuint program,
                                    const std::string &positionAttribName,
                                    GLfloat positionAttribZ,
                                    GLfloat positionAttribXYScale,
                                    bool useIndexBuffer)
{}

void ANGLETestBase::drawIndexedQuad(GLuint program,
                                    const std::string &positionAttribName,
                                    GLfloat positionAttribZ,
                                    GLfloat positionAttribXYScale,
                                    bool useIndexBuffer,
                                    bool restrictedRange)
{}

GLuint ANGLETestBase::get2DTexturedQuadProgram()
{}

GLuint ANGLETestBase::get3DTexturedQuadProgram()
{}

void ANGLETestBase::draw2DTexturedQuad(GLfloat positionAttribZ,
                                       GLfloat positionAttribXYScale,
                                       bool useVertexBuffer)
{}

void ANGLETestBase::draw3DTexturedQuad(GLfloat positionAttribZ,
                                       GLfloat positionAttribXYScale,
                                       bool useVertexBuffer,
                                       float layer)
{}

bool ANGLETestBase::platformSupportsMultithreading() const
{}

void ANGLETestBase::checkD3D11SDKLayersMessages()
{}

void ANGLETestBase::setWindowWidth(int width)
{}

void ANGLETestBase::setWindowHeight(int height)
{}

GLWindowBase *ANGLETestBase::getGLWindow() const
{}

void ANGLETestBase::setConfigRedBits(int bits)
{}

void ANGLETestBase::setConfigGreenBits(int bits)
{}

void ANGLETestBase::setConfigBlueBits(int bits)
{}

void ANGLETestBase::setConfigAlphaBits(int bits)
{}

void ANGLETestBase::setConfigDepthBits(int bits)
{}

void ANGLETestBase::setConfigStencilBits(int bits)
{}

void ANGLETestBase::setConfigComponentType(EGLenum componentType)
{}

void ANGLETestBase::setMultisampleEnabled(bool enabled)
{}

void ANGLETestBase::setSamples(EGLint samples)
{}

void ANGLETestBase::setDebugEnabled(bool enabled)
{}

void ANGLETestBase::setNoErrorEnabled(bool enabled)
{}

void ANGLETestBase::setWebGLCompatibilityEnabled(bool webglCompatibility)
{}

void ANGLETestBase::setExtensionsEnabled(bool extensionsEnabled)
{}

void ANGLETestBase::setRobustAccess(bool enabled)
{}

void ANGLETestBase::setBindGeneratesResource(bool bindGeneratesResource)
{}

void ANGLETestBase::setClientArraysEnabled(bool enabled)
{}

void ANGLETestBase::setRobustResourceInit(bool enabled)
{}

void ANGLETestBase::setMutableRenderBuffer(bool enabled)
{}

void ANGLETestBase::setContextProgramCacheEnabled(bool enabled)
{}

void ANGLETestBase::setContextResetStrategy(EGLenum resetStrategy)
{}

void ANGLETestBase::forceNewDisplay()
{}

void ANGLETestBase::setDeferContextInit(bool enabled)
{}

int ANGLETestBase::getClientMajorVersion() const
{}

int ANGLETestBase::getClientMinorVersion() const
{}

EGLWindow *ANGLETestBase::getEGLWindow() const
{}

int ANGLETestBase::getWindowWidth() const
{}

int ANGLETestBase::getWindowHeight() const
{}

void ANGLETestBase::setWindowVisible(OSWindow *osWindow, bool isVisible)
{}

ANGLETestBase::TestFixture::TestFixture()  = default;
ANGLETestBase::TestFixture::~TestFixture() = default;

EGLint ANGLETestBase::getPlatformRenderer() const
{}

void ANGLETestBase::ignoreD3D11SDKLayersWarnings()
{}

ANGLETestBase::ScopedIgnorePlatformMessages::ScopedIgnorePlatformMessages()
{}

ANGLETestBase::ScopedIgnorePlatformMessages::~ScopedIgnorePlatformMessages()
{}

OSWindow *ANGLETestBase::mOSWindowSingleton =;
std::map<angle::PlatformParameters, ANGLETestBase::TestFixture> ANGLETestBase::gFixtures;
Optional<EGLint> ANGLETestBase::mLastRendererType;
Optional<angle::GLESDriverType> ANGLETestBase::mLastLoadedDriver;

std::unique_ptr<Library> ANGLETestEnvironment::gAngleEGLLibrary;
std::unique_ptr<Library> ANGLETestEnvironment::gAngleVulkanSecondariesEGLLibrary;
std::unique_ptr<Library> ANGLETestEnvironment::gMesaEGLLibrary;
std::unique_ptr<Library> ANGLETestEnvironment::gSystemEGLLibrary;
std::unique_ptr<Library> ANGLETestEnvironment::gSystemWGLLibrary;

void ANGLETestEnvironment::SetUp() {}

void ANGLETestEnvironment::TearDown()
{}

// static
Library *ANGLETestEnvironment::GetDriverLibrary(angle::GLESDriverType driver)
{}

// static
Library *ANGLETestEnvironment::GetAngleEGLLibrary()
{}

// static
Library *ANGLETestEnvironment::GetAngleVulkanSecondariesEGLLibrary()
{}

// static
Library *ANGLETestEnvironment::GetMesaEGLLibrary()
{}

// static
Library *ANGLETestEnvironment::GetSystemEGLLibrary()
{}

// static
Library *ANGLETestEnvironment::GetSystemWGLLibrary()
{}

void ANGLEProcessTestArgs(int *argc, char *argv[])
{}