Commit 08142700 by Ian Elliott Committed by Commit Bot

Work-around test runner & DebugAnnotator

Note: This precedes another CL that needs this change. DebugAnnotator uses a global variable. The test runner doesn't change state between testing different back-ends. This works-around the problem by setting the global variable when the context is switched. Because the GL back-end doesn't have its own DebugAnnotator sub-class, add a Display* to DisplayImpl::makeCurrent(), so that DisplayGL::makeCurrent() can install the front-end-Display's DebugAnnotator. Note: the Vulkan back-end gets this fix even though the new DebugAnnotatorVk class will be added in a follow-on CL. Bug: b/162068318 Bug: b/169243237 Bug: angleproject:5121 Change-Id: If08626a5310f9b4e3210e1a897a6886248e4d8ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2451423Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 23624c53
......@@ -786,7 +786,7 @@ Error Display::initialize()
mBlobCache.resize(1024 * 1024);
}
gl::InitializeDebugAnnotations(&mAnnotator);
setGlobalDebugAnnotator();
gl::InitializeDebugMutexIfNeeded();
......@@ -1258,7 +1258,7 @@ Error Display::makeCurrent(gl::Context *previousContext,
}
}
ANGLE_TRY(mImplementation->makeCurrent(drawSurface, readSurface, context));
ANGLE_TRY(mImplementation->makeCurrent(this, drawSurface, readSurface, context));
if (context != nullptr)
{
......
......@@ -258,6 +258,10 @@ class Display final : public LabeledObject,
std::mutex &getDisplayGlobalMutex() { return mDisplayGlobalMutex; }
std::mutex &getProgramCacheMutex() { return mProgramCacheMutex; }
// Installs LoggingAnnotator as the global DebugAnnotator, for back-ends that do not implement
// their own DebugAnnotator.
void setGlobalDebugAnnotator() { gl::InitializeDebugAnnotations(&mAnnotator); }
private:
Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
......
......@@ -69,7 +69,8 @@ class DisplayImpl : public EGLImplFactory, public angle::Subject
virtual egl::Error initialize(egl::Display *display) = 0;
virtual void terminate() = 0;
virtual egl::Error makeCurrent(egl::Surface *drawSurface,
virtual egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) = 0;
......
......@@ -240,10 +240,15 @@ ShareGroupImpl *DisplayD3D::createShareGroup()
return new ShareGroupD3D();
}
egl::Error DisplayD3D::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayD3D::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
// Ensure the appropriate global DebugAnnotator is used
ASSERT(mRenderer != nullptr);
mRenderer->setGlobalDebugAnnotator();
return egl::NoError();
}
......
......@@ -62,7 +62,8 @@ class DisplayD3D : public DisplayImpl, public d3d::Context
ShareGroupImpl *createShareGroup() override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -194,6 +194,8 @@ class RendererD3D : public BufferFactoryD3D
virtual int getMajorShaderModel() const = 0;
virtual void setGlobalDebugAnnotator() = 0;
const angle::FeaturesD3D &getFeatures() const;
// Pixel operations
......
......@@ -956,6 +956,11 @@ egl::Error Renderer11::initializeD3DDevice()
return egl::NoError();
}
void Renderer11::setGlobalDebugAnnotator()
{
gl::InitializeDebugAnnotations(&mAnnotator);
}
// do any one-time device initialization
// NOTE: this is also needed after a device lost/reset
// to reset the scene status and ensure the default states are reset.
......
......@@ -475,6 +475,8 @@ class Renderer11 : public RendererD3D
gl::TextureType type,
gl::Texture **textureOut) override;
void setGlobalDebugAnnotator() override;
private:
void generateCaps(gl::Caps *outCaps,
gl::TextureCapsMap *outTextureCaps,
......
......@@ -154,6 +154,11 @@ Renderer9::Renderer9(egl::Display *display) : RendererD3D(display), mStateManage
gl::InitializeDebugAnnotations(&mAnnotator);
}
void Renderer9::setGlobalDebugAnnotator()
{
gl::InitializeDebugAnnotations(&mAnnotator);
}
Renderer9::~Renderer9()
{
if (mDevice)
......
......@@ -405,6 +405,8 @@ class Renderer9 : public RendererD3D
angle::Result ensureVertexDataManagerInitialized(const gl::Context *context);
void setGlobalDebugAnnotator() override;
private:
angle::Result drawArraysImpl(const gl::Context *context,
gl::PrimitiveMode mode,
......
......@@ -55,10 +55,15 @@ ShareGroupImpl *DisplayGL::createShareGroup()
return new ShareGroupGL();
}
egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayGL::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
// Ensure that the correct global DebugAnnotator is installed when the end2end tests change
// the ANGLE back-end (done frequently).
display->setGlobalDebugAnnotator();
if (!context)
{
return egl::NoError();
......
......@@ -43,7 +43,8 @@ class DisplayGL : public DisplayImpl
ShareGroupImpl *createShareGroup() override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -33,7 +33,8 @@ class DisplayCGL : public DisplayGL
egl::Error initialize(egl::Display *display) override;
void terminate() override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -235,7 +235,8 @@ void DisplayCGL::terminate()
}
}
egl::Error DisplayCGL::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayCGL::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......@@ -252,7 +253,7 @@ egl::Error DisplayCGL::makeCurrent(egl::Surface *drawSurface,
CGLSetCurrentContext(newContext);
mCurrentContexts[std::this_thread::get_id()] = newContext;
}
return DisplayGL::makeCurrent(drawSurface, readSurface, context);
return DisplayGL::makeCurrent(display, drawSurface, readSurface, context);
}
SurfaceImpl *DisplayCGL::createWindowSurface(const egl::SurfaceState &state,
......
......@@ -557,7 +557,8 @@ egl::Error DisplayEGL::waitNative(const gl::Context *context, EGLint engine)
return egl::NoError();
}
egl::Error DisplayEGL::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayEGL::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......@@ -587,7 +588,7 @@ egl::Error DisplayEGL::makeCurrent(egl::Surface *drawSurface,
currentContext.context = newContext;
}
return DisplayGL::makeCurrent(drawSurface, readSurface, context);
return DisplayGL::makeCurrent(display, drawSurface, readSurface, context);
}
gl::Version DisplayEGL::getMaxSupportedESVersion() const
......
......@@ -81,7 +81,8 @@ class DisplayEGL : public DisplayGL
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -268,7 +268,8 @@ ExternalImageSiblingImpl *DisplayAndroid::createExternalImageSibling(
}
}
egl::Error DisplayAndroid::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayAndroid::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......@@ -324,7 +325,7 @@ egl::Error DisplayAndroid::makeCurrent(egl::Surface *drawSurface,
currentContext.context = newContext;
}
return DisplayGL::makeCurrent(drawSurface, readSurface, context);
return DisplayGL::makeCurrent(display, drawSurface, readSurface, context);
}
void DisplayAndroid::destroyNativeContext(EGLContext context)
......
......@@ -46,7 +46,8 @@ class DisplayAndroid : public DisplayEGL
EGLClientBuffer buffer,
const egl::AttributeMap &attribs) override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -915,11 +915,12 @@ ContextImpl *DisplayGbm::createContext(const gl::State &state,
return new ContextEGL(state, errorSet, mRenderer);
}
egl::Error DisplayGbm::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayGbm::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
return DisplayGL::makeCurrent(drawSurface, readSurface, context);
return DisplayGL::makeCurrent(display, drawSurface, readSurface, context);
}
bool DisplayGbm::validateEglConfig(const EGLint *configAttribs)
......
......@@ -115,7 +115,8 @@ class DisplayGbm final : public DisplayEGL
const gl::Context *shareContext,
const egl::AttributeMap &attribs) override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -377,7 +377,8 @@ void DisplayGLX::terminate()
}
}
egl::Error DisplayGLX::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayGLX::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......@@ -402,7 +403,7 @@ egl::Error DisplayGLX::makeCurrent(egl::Surface *drawSurface,
mCurrentDrawable = newDrawable;
}
return DisplayGL::makeCurrent(drawSurface, readSurface, context);
return DisplayGL::makeCurrent(display, drawSurface, readSurface, context);
}
SurfaceImpl *DisplayGLX::createWindowSurface(const egl::SurfaceState &state,
......
......@@ -35,7 +35,8 @@ class DisplayGLX : public DisplayGL
egl::Error initialize(egl::Display *display) override;
void terminate() override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -679,7 +679,8 @@ egl::Error DisplayWGL::waitNative(const gl::Context *context, EGLint engine)
return egl::NoError();
}
egl::Error DisplayWGL::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayWGL::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......@@ -720,7 +721,7 @@ egl::Error DisplayWGL::makeCurrent(egl::Surface *drawSurface,
currentContext.glrc = newContext;
}
return DisplayGL::makeCurrent(drawSurface, readSurface, context);
return DisplayGL::makeCurrent(display, drawSurface, readSurface, context);
}
egl::Error DisplayWGL::registerD3DDevice(IUnknown *device, HANDLE *outHandle)
......
......@@ -70,7 +70,8 @@ class DisplayWGL : public DisplayGL
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -85,7 +85,8 @@ class DisplayMtl : public DisplayImpl
EGLSyncImpl *createSync(const egl::AttributeMap &attribs) override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -245,7 +245,8 @@ EGLSyncImpl *DisplayMtl::createSync(const egl::AttributeMap &attribs)
return nullptr;
}
egl::Error DisplayMtl::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayMtl::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......
......@@ -36,7 +36,8 @@ void DisplayNULL::terminate()
mAllocationTracker.reset();
}
egl::Error DisplayNULL::makeCurrent(egl::Surface *drawSurface,
egl::Error DisplayNULL::makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context)
{
......
......@@ -28,7 +28,8 @@ class DisplayNULL : public DisplayImpl
egl::Error initialize(egl::Display *display) override;
void terminate() override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -50,10 +50,15 @@ void DisplayVk::terminate()
mRenderer->onDestroy();
}
egl::Error DisplayVk::makeCurrent(egl::Surface * /*drawSurface*/,
egl::Error DisplayVk::makeCurrent(egl::Display * /*display*/,
egl::Surface * /*drawSurface*/,
egl::Surface * /*readSurface*/,
gl::Context * /*context*/)
{
// Ensure the appropriate global DebugAnnotator is used
ASSERT(mRenderer);
mRenderer->setGlobalDebugAnnotator();
return egl::NoError();
}
......
......@@ -54,7 +54,8 @@ class DisplayVk : public DisplayImpl, public vk::Context
egl::Error initialize(egl::Display *display) override;
void terminate() override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Error makeCurrent(egl::Display *display,
egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
......
......@@ -902,6 +902,8 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
// Initialize the format table.
mFormatTable.initialize(this, &mNativeTextureCaps, &mNativeCaps.compressedTextureFormats);
setGlobalDebugAnnotator();
if (getFeatures().enableCommandProcessingThread.enabled)
{
mCommandProcessorThread =
......@@ -2374,6 +2376,13 @@ void RendererVk::onCompletedSerial(Serial serial)
}
}
void RendererVk::setGlobalDebugAnnotator()
{
// TODO(ianelliott): Implement this method.
//
// https://issuetracker.google.com/issues/162068318
}
void RendererVk::reloadVolkIfNeeded() const
{
#if defined(ANGLE_SHARED_LIBVULKAN)
......
......@@ -272,6 +272,8 @@ class RendererVk : angle::NonCopyable
vk::ResourceSerialFactory &getResourceSerialFactory() { return mResourceSerialFactory; }
void setGlobalDebugAnnotator();
private:
angle::Result initializeDevice(DisplayVk *displayVk, uint32_t queueFamilyIndex);
void ensureCapsInitialized() const;
......
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