Commit 4968f6f2 by Jonah Ryan-Davis Committed by Commit Bot

Move getRendererDescription from ContextImpl to DisplayImpl

The other backend description strings are in DisplayImpl. This will help with caching the result of glGetString in the GL backend. Also Update the getters to not be const in order to allow caching. Bug: chromium:1173672 Change-Id: I43df35688762b23429f47f169c04482cf4cd089a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2676881Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
parent e174c358
......@@ -3080,9 +3080,9 @@ void Context::programParameteri(ShaderProgramID program, GLenum pname, GLint val
void Context::initRendererString()
{
std::ostringstream frontendRendererString;
std::string vendorString(mDisplay->getImplementation()->getVendorString());
std::string rendererString(mImplementation->getRendererDescription());
std::string versionString(mDisplay->getImplementation()->getVersionString());
std::string vendorString(mDisplay->getBackendVendorString());
std::string rendererString(mDisplay->getBackendRendererDescription());
std::string versionString(mDisplay->getBackendVersionString());
// Commas are used as a separator in ANGLE's renderer string, so remove commas from each
// element.
vendorString.erase(std::remove(vendorString.begin(), vendorString.end(), ','),
......
......@@ -1856,6 +1856,21 @@ const std::string &Display::getVersionString() const
return mVersionString;
}
std::string Display::getBackendRendererDescription() const
{
return mImplementation->getRendererDescription();
}
std::string Display::getBackendVendorString() const
{
return mImplementation->getVendorString();
}
std::string Display::getBackendVersionString() const
{
return mImplementation->getVersionString();
}
Device *Display::getDevice() const
{
return mDevice;
......
......@@ -229,6 +229,10 @@ class Display final : public LabeledObject,
const std::string &getVendorString() const;
const std::string &getVersionString() const;
std::string getBackendRendererDescription() const;
std::string getBackendVendorString() const;
std::string getBackendVersionString() const;
EGLint programCacheGetAttrib(EGLenum attrib) const;
Error programCacheQuery(EGLint index,
void *key,
......
......@@ -161,9 +161,6 @@ class ContextImpl : public GLImplFactory
// Device loss
virtual gl::GraphicsResetStatus getResetStatus() = 0;
// Renderer description
virtual std::string getRendererDescription() const = 0;
// EXT_debug_marker
virtual angle::Result insertEventMarker(GLsizei length, const char *marker) = 0;
virtual angle::Result pushGroupMarker(GLsizei length, const char *marker) = 0;
......
......@@ -94,8 +94,9 @@ class DisplayImpl : public EGLImplFactory, public angle::Subject
EGLNativePixmapType pixmap,
const egl::AttributeMap &attributes) const;
virtual std::string getVendorString() const = 0;
virtual std::string getVersionString() const = 0;
virtual std::string getRendererDescription() = 0;
virtual std::string getVendorString() = 0;
virtual std::string getVersionString() = 0;
virtual DeviceImpl *createDevice();
......
......@@ -353,7 +353,16 @@ void DisplayD3D::generateExtensions(egl::DisplayExtensions *outExtensions) const
mRenderer->generateDisplayExtensions(outExtensions);
}
std::string DisplayD3D::getVendorString() const
std::string DisplayD3D::getRendererDescription()
{
if (mRenderer)
{
return mRenderer->getRendererDescription();
}
return std::string();
}
std::string DisplayD3D::getVendorString()
{
if (mRenderer)
{
......@@ -362,7 +371,7 @@ std::string DisplayD3D::getVendorString() const
return std::string();
}
std::string DisplayD3D::getVersionString() const
std::string DisplayD3D::getVersionString()
{
if (mRenderer)
{
......
......@@ -84,8 +84,9 @@ class DisplayD3D : public DisplayImpl, public d3d::Context
DeviceImpl *createDevice() override;
std::string getVendorString() const override;
std::string getVersionString() const override;
std::string getRendererDescription() override;
std::string getVendorString() override;
std::string getVersionString() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
......
......@@ -160,8 +160,9 @@ class RendererD3D : public BufferFactoryD3D
virtual ContextImpl *createContext(const gl::State &state, gl::ErrorSet *errorSet) = 0;
virtual std::string getVendorString() const = 0;
virtual std::string getVersionString() const = 0;
virtual std::string getRendererDescription() const = 0;
virtual std::string getVendorString() const = 0;
virtual std::string getVersionString() const = 0;
virtual int getMinorShaderModel() const = 0;
virtual std::string getShaderModelSuffix() const = 0;
......
......@@ -723,11 +723,6 @@ gl::GraphicsResetStatus Context11::getResetStatus()
return mRenderer->getResetStatus();
}
std::string Context11::getRendererDescription() const
{
return mRenderer->getRendererDescription();
}
angle::Result Context11::insertEventMarker(GLsizei length, const char *marker)
{
mRenderer->getAnnotator()->setMarker(marker);
......
......@@ -191,9 +191,6 @@ class Context11 : public ContextD3D, public MultisampleTextureInitializer
// Device loss
gl::GraphicsResetStatus getResetStatus() override;
// Renderer description
std::string getRendererDescription() const override;
// EXT_debug_marker
angle::Result insertEventMarker(GLsizei length, const char *marker) override;
angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
......
......@@ -118,7 +118,6 @@ class Renderer11 : public RendererD3D
bool testDeviceLost() override;
bool testDeviceResettable() override;
std::string getRendererDescription() const;
DeviceIdentifier getAdapterIdentifier() const override;
unsigned int getReservedVertexUniformVectors() const;
......@@ -478,6 +477,7 @@ class Renderer11 : public RendererD3D
void setGlobalDebugAnnotator() override;
std::string getRendererDescription() const override;
std::string getVendorString() const override;
std::string getVersionString() const override;
......
......@@ -358,11 +358,6 @@ gl::GraphicsResetStatus Context9::getResetStatus()
return mRenderer->getResetStatus();
}
std::string Context9::getRendererDescription() const
{
return mRenderer->getRendererDescription();
}
angle::Result Context9::insertEventMarker(GLsizei length, const char *marker)
{
mRenderer->getAnnotator()->setMarker(marker);
......
......@@ -190,9 +190,6 @@ class Context9 : public ContextD3D
// Device loss
gl::GraphicsResetStatus getResetStatus() override;
// Renderer description
std::string getRendererDescription() const override;
// EXT_debug_marker
angle::Result insertEventMarker(GLsizei length, const char *marker) override;
angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
......
......@@ -157,7 +157,6 @@ class Renderer9 : public RendererD3D
bool testDeviceResettable() override;
VendorID getVendorId() const;
std::string getRendererDescription() const;
DeviceIdentifier getAdapterIdentifier() const override;
IDirect3DDevice9 *getDevice() { return mDevice; }
......@@ -408,6 +407,7 @@ class Renderer9 : public RendererD3D
void setGlobalDebugAnnotator() override;
std::string getRendererDescription() const override;
std::string getVendorString() const override;
std::string getVersionString() const override;
......
......@@ -760,11 +760,6 @@ gl::GraphicsResetStatus ContextGL::getResetStatus()
return resetStatus;
}
std::string ContextGL::getRendererDescription() const
{
return mRenderer->getRendererDescription();
}
angle::Result ContextGL::insertEventMarker(GLsizei length, const char *marker)
{
mRenderer->insertEventMarker(length, marker);
......
......@@ -212,9 +212,6 @@ class ContextGL : public ContextImpl
// Device loss
gl::GraphicsResetStatus getResetStatus() override;
// Renderer description
std::string getRendererDescription() const override;
// EXT_debug_marker
angle::Result insertEventMarker(GLsizei length, const char *marker) override;
angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
......
......@@ -100,12 +100,17 @@ egl::Error DisplayGL::makeCurrentSurfaceless(gl::Context *context)
return egl::NoError();
}
std::string DisplayGL::getVendorString() const
std::string DisplayGL::getRendererDescription()
{
return GetRendererString(getRenderer()->getFunctions());
}
std::string DisplayGL::getVendorString()
{
return GetVendorString(getRenderer()->getFunctions());
}
std::string DisplayGL::getVersionString() const
std::string DisplayGL::getVersionString()
{
return GetVersionString(getRenderer()->getFunctions());
}
......
......@@ -52,8 +52,9 @@ class DisplayGL : public DisplayImpl
virtual RendererGL *getRenderer() const = 0;
std::string getVendorString() const override;
std::string getVersionString() const override;
std::string getRendererDescription() override;
std::string getVendorString() override;
std::string getVersionString() override;
protected:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
......
......@@ -253,11 +253,6 @@ void RendererGL::pushDebugGroup(GLenum source, GLuint id, const std::string &mes
void RendererGL::popDebugGroup() {}
std::string RendererGL::getRendererDescription() const
{
return GetRendererString(mFunctions.get());
}
const gl::Version &RendererGL::getMaxSupportedESVersion() const
{
// Force generation of caps
......
......@@ -97,8 +97,6 @@ class RendererGL : angle::NonCopyable
void pushDebugGroup(GLenum source, GLuint id, const std::string &message);
void popDebugGroup();
std::string getRendererDescription() const;
GLint getGPUDisjoint();
GLint64 getTimestamp();
......
......@@ -162,7 +162,7 @@ egl::Error DisplayAndroid::initialize(egl::Display *display)
ANGLE_TRY(DisplayGL::initialize(display));
std::string rendererDescription = mRenderer->getRendererDescription();
std::string rendererDescription = getRendererDescription();
__android_log_print(ANDROID_LOG_INFO, "ANGLE", "%s", rendererDescription.c_str());
return egl::NoError();
}
......
......@@ -161,9 +161,6 @@ class ContextMtl : public ContextImpl, public mtl::Context
// Device loss
gl::GraphicsResetStatus getResetStatus() override;
// Renderer description
std::string getRendererDescription() const override;
// EXT_debug_marker
angle::Result insertEventMarker(GLsizei length, const char *marker) override;
angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
......
......@@ -790,12 +790,6 @@ gl::GraphicsResetStatus ContextMtl::getResetStatus()
return gl::GraphicsResetStatus::NoError;
}
// Renderer description
std::string ContextMtl::getRendererDescription() const
{
return getDisplay()->getRendererDescription();
}
// EXT_debug_marker
angle::Result ContextMtl::insertEventMarker(GLsizei length, const char *marker)
{
......
......@@ -46,8 +46,9 @@ class DisplayMtl : public DisplayImpl
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
std::string getVendorString() const override;
std::string getVersionString() const override;
std::string getRendererDescription() override;
std::string getVendorString() override;
std::string getVersionString() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
......@@ -102,7 +103,6 @@ class DisplayMtl : public DisplayImpl
egl::ConfigSet generateConfigs() override;
std::string getRendererDescription() const;
gl::Caps getNativeCaps() const;
const gl::TextureCapsMap &getNativeTextureCaps() const;
const gl::Extensions &getNativeExtensions() const;
......
......@@ -138,12 +138,28 @@ egl::Error DisplayMtl::restoreLostDevice(const egl::Display *display)
return egl::NoError();
}
std::string DisplayMtl::getVendorString() const
std::string DisplayMtl::getRendererDescription()
{
ANGLE_MTL_OBJC_SCOPE
{
std::string desc = "Metal Renderer";
if (mMetalDevice)
{
desc += ": ";
desc += mMetalDevice.get().name.UTF8String;
}
return desc;
}
}
std::string DisplayMtl::getVendorString()
{
return GetVendorString(mMetalDeviceVendorId);
}
std::string DisplayMtl::getVersionString() const
std::string DisplayMtl::getVersionString()
{
ANGLE_MTL_OBJC_SCOPE
{
......@@ -422,22 +438,6 @@ egl::Error DisplayMtl::validateClientBuffer(const egl::Config *configuration,
return egl::NoError();
}
std::string DisplayMtl::getRendererDescription() const
{
ANGLE_MTL_OBJC_SCOPE
{
std::string desc = "Metal Renderer";
if (mMetalDevice)
{
desc += ": ";
desc += mMetalDevice.get().name.UTF8String;
}
return desc;
}
}
gl::Caps DisplayMtl::getNativeCaps() const
{
ensureCapsInitialized();
......
......@@ -313,11 +313,6 @@ gl::GraphicsResetStatus ContextNULL::getResetStatus()
return gl::GraphicsResetStatus::NoError;
}
std::string ContextNULL::getRendererDescription() const
{
return "NULL";
}
angle::Result ContextNULL::insertEventMarker(GLsizei length, const char *marker)
{
return angle::Result::Continue;
......
......@@ -160,9 +160,6 @@ class ContextNULL : public ContextImpl
// Device loss
gl::GraphicsResetStatus getResetStatus() override;
// Renderer description
std::string getRendererDescription() const override;
// EXT_debug_marker
angle::Result insertEventMarker(GLsizei length, const char *marker) override;
angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
......
......@@ -107,12 +107,17 @@ bool DisplayNULL::isValidNativeWindow(EGLNativeWindowType window) const
return true;
}
std::string DisplayNULL::getVendorString() const
std::string DisplayNULL::getRendererDescription()
{
return "NULL";
}
std::string DisplayNULL::getVersionString() const
std::string DisplayNULL::getVendorString()
{
return "NULL";
}
std::string DisplayNULL::getVersionString()
{
return std::string();
}
......
......@@ -40,8 +40,9 @@ class DisplayNULL : public DisplayImpl
bool isValidNativeWindow(EGLNativeWindowType window) const override;
std::string getVendorString() const override;
std::string getVersionString() const override;
std::string getRendererDescription() override;
std::string getVendorString() override;
std::string getVersionString() override;
DeviceImpl *createDevice() override;
......
......@@ -2456,11 +2456,6 @@ gl::GraphicsResetStatus ContextVk::getResetStatus()
return gl::GraphicsResetStatus::NoError;
}
std::string ContextVk::getRendererDescription() const
{
return mRenderer->getRendererDescription();
}
angle::Result ContextVk::insertEventMarker(GLsizei length, const char *marker)
{
if (!mRenderer->enableDebugUtils())
......
......@@ -178,9 +178,6 @@ class ContextVk : public ContextImpl, public vk::Context, public MultisampleText
// Device loss
gl::GraphicsResetStatus getResetStatus() override;
// Vendor and description strings.
std::string getRendererDescription() const override;
// EXT_debug_marker
angle::Result insertEventMarker(GLsizei length, const char *marker) override;
angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
......
......@@ -74,7 +74,16 @@ egl::Error DisplayVk::restoreLostDevice(const egl::Display *display)
return egl::EglBadDisplay();
}
std::string DisplayVk::getVendorString() const
std::string DisplayVk::getRendererDescription()
{
if (mRenderer)
{
return mRenderer->getRendererDescription();
}
return std::string();
}
std::string DisplayVk::getVendorString()
{
if (mRenderer)
{
......@@ -83,7 +92,7 @@ std::string DisplayVk::getVendorString() const
return std::string();
}
std::string DisplayVk::getVersionString() const
std::string DisplayVk::getVersionString()
{
if (mRenderer)
{
......
......@@ -82,8 +82,9 @@ class DisplayVk : public DisplayImpl, public vk::Context
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
std::string getVendorString() const override;
std::string getVersionString() const override;
std::string getRendererDescription() override;
std::string getVendorString() override;
std::string getVersionString() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
......
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