Commit 9b1a9084 by Jamie Madill Committed by Commit Bot

dEQP: Format display factory and clean up style.

This fixes a bunch of minor style issues. Bug: angleproject:2552 Change-Id: If0e8130cf85deb176a5dcbca568cca477d2c1068 Reviewed-on: https://chromium-review.googlesource.com/1062789Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 78b7f3a8
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "angle_deqp_libtester.h" #include "angle_deqp_libtester.h"
#include "common/Optional.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/Optional.h"
#include "common/platform.h" #include "common/platform.h"
#include "common/string_utils.h" #include "common/string_utils.h"
#include "gpu_test_expectations_parser.h" #include "gpu_test_expectations_parser.h"
...@@ -119,8 +119,7 @@ void Die() ...@@ -119,8 +119,7 @@ void Die()
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
Optional<std::string> FindTestExpectationsPath(const std::string &exeDir, Optional<std::string> FindTestExpectationsPath(const std::string &exeDir, size_t testModuleIndex)
size_t testModuleIndex)
{ {
for (const char *testPath : gTestExpectationsSearchPaths) for (const char *testPath : gTestExpectationsSearchPaths)
{ {
...@@ -146,12 +145,8 @@ class dEQPCaseList ...@@ -146,12 +145,8 @@ class dEQPCaseList
struct CaseInfo struct CaseInfo
{ {
CaseInfo(const std::string &dEQPName, CaseInfo(const std::string &dEQPName, const std::string &gTestName, int expectation)
const std::string &gTestName, : mDEQPName(dEQPName), mGTestName(gTestName), mExpectation(expectation)
int expectation)
: mDEQPName(dEQPName),
mGTestName(gTestName),
mExpectation(expectation)
{ {
} }
...@@ -184,8 +179,7 @@ class dEQPCaseList ...@@ -184,8 +179,7 @@ class dEQPCaseList
}; };
dEQPCaseList::dEQPCaseList(size_t testModuleIndex) dEQPCaseList::dEQPCaseList(size_t testModuleIndex)
: mTestModuleIndex(testModuleIndex), : mTestModuleIndex(testModuleIndex), mInitialized(false)
mInitialized(false)
{ {
} }
......
...@@ -23,13 +23,12 @@ ...@@ -23,13 +23,12 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include "OSPixmap.h"
#include "OSWindow.h"
#include "deClock.h" #include "deClock.h"
#include "deMemory.h" #include "deMemory.h"
#include "deThread.h"
#include "egluDefs.hpp" #include "egluDefs.hpp"
#include "eglwLibrary.hpp" #include "eglwLibrary.hpp"
#include "OSPixmap.h"
#include "OSWindow.h"
#include "tcuTexture.hpp" #include "tcuTexture.hpp"
// clang-format off // clang-format off
...@@ -53,13 +52,15 @@ enum ...@@ -53,13 +52,15 @@ enum
{ {
DEFAULT_SURFACE_WIDTH = 400, DEFAULT_SURFACE_WIDTH = 400,
DEFAULT_SURFACE_HEIGHT = 300, DEFAULT_SURFACE_HEIGHT = 300,
WAIT_WINDOW_VISIBLE_MS = 500 //!< Time to wait before issuing screenshot after changing window visibility (hack for DWM)
}; };
static const eglu::NativeDisplay::Capability DISPLAY_CAPABILITIES = eglu::NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM; constexpr eglu::NativeDisplay::Capability kDisplayCapabilities =
static const eglu::NativePixmap::Capability BITMAP_CAPABILITIES = eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY; eglu::NativeDisplay::CAPABILITY_GET_DISPLAY_PLATFORM;
static const eglu::NativeWindow::Capability WINDOW_CAPABILITIES = (eglu::NativeWindow::Capability) constexpr eglu::NativePixmap::Capability kBitmapCapabilities =
(eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY | eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY;
constexpr eglu::NativeWindow::Capability kWindowCapabilities =
static_cast<eglu::NativeWindow::Capability>(
eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY |
eglu::NativeWindow::CAPABILITY_GET_SURFACE_SIZE | eglu::NativeWindow::CAPABILITY_GET_SURFACE_SIZE |
eglu::NativeWindow::CAPABILITY_GET_SCREEN_SIZE | eglu::NativeWindow::CAPABILITY_GET_SCREEN_SIZE |
eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS | eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS |
...@@ -69,8 +70,8 @@ static const eglu::NativeWindow::Capability WINDOW_CAPABILITIES = (eglu::Nativ ...@@ -69,8 +70,8 @@ static const eglu::NativeWindow::Capability WINDOW_CAPABILITIES = (eglu::Nativ
class ANGLENativeDisplay : public eglu::NativeDisplay class ANGLENativeDisplay : public eglu::NativeDisplay
{ {
public: public:
ANGLENativeDisplay(const std::vector<eglw::EGLAttrib> &attribs); explicit ANGLENativeDisplay(std::vector<eglw::EGLAttrib> attribs);
virtual ~ANGLENativeDisplay() {} ~ANGLENativeDisplay() override = default;
void *getPlatformNative() override void *getPlatformNative() override
{ {
...@@ -80,10 +81,13 @@ class ANGLENativeDisplay : public eglu::NativeDisplay ...@@ -80,10 +81,13 @@ class ANGLENativeDisplay : public eglu::NativeDisplay
memcpy(&result, &mDeviceContext, sizeof(mDeviceContext)); memcpy(&result, &mDeviceContext, sizeof(mDeviceContext));
return result; return result;
} }
const eglw::EGLAttrib *getPlatformAttributes() const override { return &mPlatformAttributes[0]; } const eglw::EGLAttrib *getPlatformAttributes() const override
{
return &mPlatformAttributes[0];
}
const eglw::Library &getLibrary() const override { return mLibrary; } const eglw::Library &getLibrary() const override { return mLibrary; }
EGLNativeDisplayType getDeviceContext() { return mDeviceContext; } EGLNativeDisplayType getDeviceContext() const { return mDeviceContext; }
private: private:
EGLNativeDisplayType mDeviceContext; EGLNativeDisplayType mDeviceContext;
...@@ -95,10 +99,17 @@ class NativePixmapFactory : public eglu::NativePixmapFactory ...@@ -95,10 +99,17 @@ class NativePixmapFactory : public eglu::NativePixmapFactory
{ {
public: public:
NativePixmapFactory(); NativePixmapFactory();
~NativePixmapFactory() {} ~NativePixmapFactory() override = default;
eglu::NativePixmap *createPixmap(eglu::NativeDisplay *nativeDisplay, int width, int height) const override; eglu::NativePixmap *createPixmap(eglu::NativeDisplay *nativeDisplay,
eglu::NativePixmap *createPixmap(eglu::NativeDisplay *nativeDisplay, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList, int width, int height) const override; int width,
int height) const override;
eglu::NativePixmap *createPixmap(eglu::NativeDisplay *nativeDisplay,
eglw::EGLDisplay display,
eglw::EGLConfig config,
const eglw::EGLAttrib *attribList,
int width,
int height) const override;
}; };
class NativePixmap : public eglu::NativePixmap class NativePixmap : public eglu::NativePixmap
...@@ -116,10 +127,11 @@ class NativePixmap : public eglu::NativePixmap ...@@ -116,10 +127,11 @@ class NativePixmap : public eglu::NativePixmap
class NativeWindowFactory : public eglu::NativeWindowFactory class NativeWindowFactory : public eglu::NativeWindowFactory
{ {
public: public:
NativeWindowFactory(EventState *eventState); explicit NativeWindowFactory(EventState *eventState);
~NativeWindowFactory() override {} ~NativeWindowFactory() override = default;
eglu::NativeWindow *createWindow(eglu::NativeDisplay *nativeDisplay, const eglu::WindowParams &params) const override; eglu::NativeWindow *createWindow(eglu::NativeDisplay *nativeDisplay,
const eglu::WindowParams &params) const override;
private: private:
EventState *mEvents; EventState *mEvents;
...@@ -128,7 +140,9 @@ class NativeWindowFactory : public eglu::NativeWindowFactory ...@@ -128,7 +140,9 @@ class NativeWindowFactory : public eglu::NativeWindowFactory
class NativeWindow : public eglu::NativeWindow class NativeWindow : public eglu::NativeWindow
{ {
public: public:
NativeWindow(ANGLENativeDisplay *nativeDisplay, const eglu::WindowParams &params, EventState *eventState); NativeWindow(ANGLENativeDisplay *nativeDisplay,
const eglu::WindowParams &params,
EventState *eventState);
~NativeWindow() override; ~NativeWindow() override;
eglw::EGLNativeWindowType getLegacyNative() override; eglw::EGLNativeWindowType getLegacyNative() override;
...@@ -137,7 +151,7 @@ class NativeWindow : public eglu::NativeWindow ...@@ -137,7 +151,7 @@ class NativeWindow : public eglu::NativeWindow
void processEvents() override; void processEvents() override;
void setSurfaceSize(IVec2 size) override; void setSurfaceSize(IVec2 size) override;
void setVisibility(eglu::WindowParams::Visibility visibility) override; void setVisibility(eglu::WindowParams::Visibility visibility) override;
void readScreenPixels(tcu::TextureLevel* dst) const override; void readScreenPixels(tcu::TextureLevel *dst) const override;
private: private:
OSWindow *mWindow; OSWindow *mWindow;
...@@ -146,19 +160,18 @@ class NativeWindow : public eglu::NativeWindow ...@@ -146,19 +160,18 @@ class NativeWindow : public eglu::NativeWindow
// ANGLE NativeDisplay // ANGLE NativeDisplay
ANGLENativeDisplay::ANGLENativeDisplay(const std::vector<EGLAttrib> &attribs) ANGLENativeDisplay::ANGLENativeDisplay(std::vector<EGLAttrib> attribs)
: eglu::NativeDisplay(DISPLAY_CAPABILITIES, EGL_PLATFORM_ANGLE_ANGLE, "EGL_EXT_platform_base"), : eglu::NativeDisplay(kDisplayCapabilities, EGL_PLATFORM_ANGLE_ANGLE, "EGL_EXT_platform_base"),
mDeviceContext(EGL_DEFAULT_DISPLAY), mDeviceContext(EGL_DEFAULT_DISPLAY),
mLibrary(ANGLE_EGL_LIBRARY_FULL_NAME), mLibrary(ANGLE_EGL_LIBRARY_FULL_NAME),
mPlatformAttributes(attribs) mPlatformAttributes(std::move(attribs))
{ {
} }
// NativePixmap // NativePixmap
NativePixmap::NativePixmap(EGLNativeDisplayType display, int width, int height, int bitDepth) NativePixmap::NativePixmap(EGLNativeDisplayType display, int width, int height, int bitDepth)
: eglu::NativePixmap(BITMAP_CAPABILITIES), : eglu::NativePixmap(kBitmapCapabilities), mPixmap(CreateOSPixmap())
mPixmap(CreateOSPixmap())
{ {
if (!mPixmap) if (!mPixmap)
{ {
...@@ -184,13 +197,18 @@ eglw::EGLNativePixmapType NativePixmap::getLegacyNative() ...@@ -184,13 +197,18 @@ eglw::EGLNativePixmapType NativePixmap::getLegacyNative()
// NativePixmapFactory // NativePixmapFactory
NativePixmapFactory::NativePixmapFactory() NativePixmapFactory::NativePixmapFactory()
: eglu::NativePixmapFactory("bitmap", "ANGLE Bitmap", BITMAP_CAPABILITIES) : eglu::NativePixmapFactory("bitmap", "ANGLE Bitmap", kBitmapCapabilities)
{ {
} }
eglu::NativePixmap *NativePixmapFactory::createPixmap (eglu::NativeDisplay* nativeDisplay, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList, int width, int height) const eglu::NativePixmap *NativePixmapFactory::createPixmap(eglu::NativeDisplay *nativeDisplay,
eglw::EGLDisplay display,
eglw::EGLConfig config,
const eglw::EGLAttrib *attribList,
int width,
int height) const
{ {
const eglw::Library& egl = nativeDisplay->getLibrary(); const eglw::Library &egl = nativeDisplay->getLibrary();
int redBits = 0; int redBits = 0;
int greenBits = 0; int greenBits = 0;
int blueBits = 0; int blueBits = 0;
...@@ -205,44 +223,50 @@ eglu::NativePixmap *NativePixmapFactory::createPixmap (eglu::NativeDisplay* nati ...@@ -205,44 +223,50 @@ eglu::NativePixmap *NativePixmapFactory::createPixmap (eglu::NativeDisplay* nati
egl.getConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaBits); egl.getConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaBits);
EGLU_CHECK_MSG(egl, "eglGetConfigAttrib()"); EGLU_CHECK_MSG(egl, "eglGetConfigAttrib()");
bitSum = redBits+greenBits+blueBits+alphaBits; bitSum = redBits + greenBits + blueBits + alphaBits;
return new NativePixmap(dynamic_cast<ANGLENativeDisplay*>(nativeDisplay)->getDeviceContext(), width, height, bitSum); return new NativePixmap(dynamic_cast<ANGLENativeDisplay *>(nativeDisplay)->getDeviceContext(),
width, height, bitSum);
} }
eglu::NativePixmap *NativePixmapFactory::createPixmap(eglu::NativeDisplay* nativeDisplay, int width, int height) const eglu::NativePixmap *NativePixmapFactory::createPixmap(eglu::NativeDisplay *nativeDisplay,
int width,
int height) const
{ {
const int defaultDepth = 32; const int defaultDepth = 32;
return new NativePixmap(dynamic_cast<ANGLENativeDisplay*>(nativeDisplay)->getDeviceContext(), width, height, defaultDepth); return new NativePixmap(dynamic_cast<ANGLENativeDisplay *>(nativeDisplay)->getDeviceContext(),
width, height, defaultDepth);
} }
// NativeWindowFactory // NativeWindowFactory
NativeWindowFactory::NativeWindowFactory(EventState *eventState) NativeWindowFactory::NativeWindowFactory(EventState *eventState)
: eglu::NativeWindowFactory("window", "ANGLE Window", WINDOW_CAPABILITIES), : eglu::NativeWindowFactory("window", "ANGLE Window", kWindowCapabilities), mEvents(eventState)
mEvents(eventState)
{ {
} }
eglu::NativeWindow *NativeWindowFactory::createWindow(eglu::NativeDisplay* nativeDisplay, const eglu::WindowParams& params) const eglu::NativeWindow *NativeWindowFactory::createWindow(eglu::NativeDisplay *nativeDisplay,
const eglu::WindowParams &params) const
{ {
return new NativeWindow(dynamic_cast<ANGLENativeDisplay*>(nativeDisplay), params, mEvents); return new NativeWindow(dynamic_cast<ANGLENativeDisplay *>(nativeDisplay), params, mEvents);
} }
// NativeWindow // NativeWindow
NativeWindow::NativeWindow(ANGLENativeDisplay *nativeDisplay, const eglu::WindowParams& params, EventState *eventState) NativeWindow::NativeWindow(ANGLENativeDisplay *nativeDisplay,
: eglu::NativeWindow(WINDOW_CAPABILITIES), const eglu::WindowParams &params,
mWindow(CreateOSWindow()), EventState *eventState)
mEvents(eventState) : eglu::NativeWindow(kWindowCapabilities), mWindow(CreateOSWindow()), mEvents(eventState)
{ {
bool initialized = mWindow->initialize("dEQP ANGLE Tests", bool initialized = mWindow->initialize(
"dEQP ANGLE Tests",
params.width == eglu::WindowParams::SIZE_DONT_CARE ? DEFAULT_SURFACE_WIDTH : params.width, params.width == eglu::WindowParams::SIZE_DONT_CARE ? DEFAULT_SURFACE_WIDTH : params.width,
params.height == eglu::WindowParams::SIZE_DONT_CARE ? DEFAULT_SURFACE_HEIGHT : params.height); params.height == eglu::WindowParams::SIZE_DONT_CARE ? DEFAULT_SURFACE_HEIGHT
: params.height);
TCU_CHECK(initialized); TCU_CHECK(initialized);
if (params.visibility != eglu::WindowParams::VISIBILITY_DONT_CARE) if (params.visibility != eglu::WindowParams::VISIBILITY_DONT_CARE)
setVisibility(params.visibility); NativeWindow::setVisibility(params.visibility);
} }
void NativeWindow::setVisibility(eglu::WindowParams::Visibility visibility) void NativeWindow::setVisibility(eglu::WindowParams::Visibility visibility)
...@@ -255,7 +279,6 @@ void NativeWindow::setVisibility(eglu::WindowParams::Visibility visibility) ...@@ -255,7 +279,6 @@ void NativeWindow::setVisibility(eglu::WindowParams::Visibility visibility)
case eglu::WindowParams::VISIBILITY_VISIBLE: case eglu::WindowParams::VISIBILITY_VISIBLE:
case eglu::WindowParams::VISIBILITY_FULLSCREEN: case eglu::WindowParams::VISIBILITY_FULLSCREEN:
// \todo [2014-03-12 pyry] Implement FULLSCREEN, or at least SW_MAXIMIZE.
mWindow->setVisible(true); mWindow->setVisible(true);
break; break;
...@@ -284,7 +307,7 @@ void NativeWindow::processEvents() ...@@ -284,7 +307,7 @@ void NativeWindow::processEvents()
mWindow->messageLoop(); mWindow->messageLoop();
// Look for a quit event to forward to the EventState // Look for a quit event to forward to the EventState
Event event; Event event = {};
while (mWindow->popEvent(&event)) while (mWindow->popEvent(&event))
{ {
if (event.Type == Event::EVENT_CLOSED) if (event.Type == Event::EVENT_CLOSED)
...@@ -301,7 +324,8 @@ void NativeWindow::setSurfaceSize(IVec2 size) ...@@ -301,7 +324,8 @@ void NativeWindow::setSurfaceSize(IVec2 size)
void NativeWindow::readScreenPixels(tcu::TextureLevel *dst) const void NativeWindow::readScreenPixels(tcu::TextureLevel *dst) const
{ {
dst->setStorage(TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_INT8), mWindow->getWidth(), mWindow->getHeight()); dst->setStorage(TextureFormat(TextureFormat::BGRA, TextureFormat::UNORM_INT8),
mWindow->getWidth(), mWindow->getHeight());
if (!mWindow->takeScreenshot(reinterpret_cast<uint8_t *>(dst->getAccess().getDataPtr()))) if (!mWindow->takeScreenshot(reinterpret_cast<uint8_t *>(dst->getAccess().getDataPtr())))
{ {
throw InternalError("Failed to read screen pixels", DE_NULL, __FILE__, __LINE__); throw InternalError("Failed to read screen pixels", DE_NULL, __FILE__, __LINE__);
...@@ -310,22 +334,26 @@ void NativeWindow::readScreenPixels(tcu::TextureLevel *dst) const ...@@ -310,22 +334,26 @@ void NativeWindow::readScreenPixels(tcu::TextureLevel *dst) const
} // anonymous } // anonymous
ANGLENativeDisplayFactory::ANGLENativeDisplayFactory(const std::string &name, ANGLENativeDisplayFactory::ANGLENativeDisplayFactory(
const std::string &name,
const std::string &description, const std::string &description,
const std::vector<eglw::EGLAttrib> &platformAttributes, std::vector<eglw::EGLAttrib> platformAttributes,
EventState *eventState) EventState *eventState)
: eglu::NativeDisplayFactory(name, description, DISPLAY_CAPABILITIES, EGL_PLATFORM_ANGLE_ANGLE, "EGL_EXT_platform_base"), : eglu::NativeDisplayFactory(name,
mPlatformAttributes(platformAttributes) description,
kDisplayCapabilities,
EGL_PLATFORM_ANGLE_ANGLE,
"EGL_EXT_platform_base"),
mPlatformAttributes(std::move(platformAttributes))
{ {
m_nativeWindowRegistry.registerFactory(new NativeWindowFactory(eventState)); m_nativeWindowRegistry.registerFactory(new NativeWindowFactory(eventState));
m_nativePixmapRegistry.registerFactory(new NativePixmapFactory()); m_nativePixmapRegistry.registerFactory(new NativePixmapFactory());
} }
ANGLENativeDisplayFactory::~ANGLENativeDisplayFactory() ANGLENativeDisplayFactory::~ANGLENativeDisplayFactory() = default;
{
}
eglu::NativeDisplay *ANGLENativeDisplayFactory::createDisplay(const eglw::EGLAttrib *attribList) const eglu::NativeDisplay *ANGLENativeDisplayFactory::createDisplay(
const eglw::EGLAttrib *attribList) const
{ {
DE_UNREF(attribList); DE_UNREF(attribList);
return new ANGLENativeDisplay(mPlatformAttributes); return new ANGLENativeDisplay(mPlatformAttributes);
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#ifndef TCU_ANGLE_WIN32_NATIVE_DISPLAY_FACTORY_H_ #ifndef TCU_ANGLE_WIN32_NATIVE_DISPLAY_FACTORY_H_
#define TCU_ANGLE_WIN32_NATIVE_DISPLAY_FACTORY_H_ #define TCU_ANGLE_WIN32_NATIVE_DISPLAY_FACTORY_H_
#include "tcuDefs.hpp"
#include "egluNativeDisplay.hpp" #include "egluNativeDisplay.hpp"
#include "eglwDefs.hpp" #include "eglwDefs.hpp"
#include "tcuDefs.hpp"
namespace tcu namespace tcu
{ {
...@@ -31,10 +31,7 @@ namespace tcu ...@@ -31,10 +31,7 @@ namespace tcu
class EventState class EventState
{ {
public: public:
EventState() EventState() : mQuit(false) {}
: mQuit(false)
{
}
bool quitSignaled() const { return mQuit; }; bool quitSignaled() const { return mQuit; };
void signalQuitEvent() { mQuit = true; }; void signalQuitEvent() { mQuit = true; };
...@@ -47,11 +44,11 @@ class ANGLENativeDisplayFactory : public eglu::NativeDisplayFactory ...@@ -47,11 +44,11 @@ class ANGLENativeDisplayFactory : public eglu::NativeDisplayFactory
public: public:
ANGLENativeDisplayFactory(const std::string &name, ANGLENativeDisplayFactory(const std::string &name,
const std::string &description, const std::string &description,
const std::vector<eglw::EGLAttrib> &platformAttributes, std::vector<eglw::EGLAttrib> platformAttributes,
EventState *eventState); EventState *eventState);
~ANGLENativeDisplayFactory() override; ~ANGLENativeDisplayFactory() override;
eglu::NativeDisplay *createDisplay(const eglw::EGLAttrib* attribList) const override; eglu::NativeDisplay *createDisplay(const eglw::EGLAttrib *attribList) const override;
private: private:
std::vector<eglw::EGLAttrib> mPlatformAttributes; std::vector<eglw::EGLAttrib> mPlatformAttributes;
......
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