Commit e174c358 by Jonah Ryan-Davis Committed by Commit Bot

GL: Consolidate glGetString calls

First step for cacheing the result of glGetString calls is mostly cleanup. Bug: chromium:1173672 Change-Id: I47281a09b9bd5859655d16376977a6eabcfbb3c4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2676203 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 0ccf1010
...@@ -99,4 +99,15 @@ egl::Error DisplayGL::makeCurrentSurfaceless(gl::Context *context) ...@@ -99,4 +99,15 @@ egl::Error DisplayGL::makeCurrentSurfaceless(gl::Context *context)
UNIMPLEMENTED(); UNIMPLEMENTED();
return egl::NoError(); return egl::NoError();
} }
std::string DisplayGL::getVendorString() const
{
return GetVendorString(getRenderer()->getFunctions());
}
std::string DisplayGL::getVersionString() const
{
return GetVersionString(getRenderer()->getFunctions());
}
} // namespace rx } // namespace rx
...@@ -50,6 +50,11 @@ class DisplayGL : public DisplayImpl ...@@ -50,6 +50,11 @@ class DisplayGL : public DisplayImpl
gl::Version getMaxConformantESVersion() const override; gl::Version getMaxConformantESVersion() const override;
virtual RendererGL *getRenderer() const = 0;
std::string getVendorString() const override;
std::string getVersionString() const override;
protected: protected:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override; void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
......
...@@ -255,7 +255,7 @@ void RendererGL::popDebugGroup() {} ...@@ -255,7 +255,7 @@ void RendererGL::popDebugGroup() {}
std::string RendererGL::getRendererDescription() const std::string RendererGL::getRendererDescription() const
{ {
return std::string(reinterpret_cast<const char *>(mFunctions->getString(GL_RENDERER))); return GetRendererString(mFunctions.get());
} }
const gl::Version &RendererGL::getMaxSupportedESVersion() const const gl::Version &RendererGL::getMaxSupportedESVersion() const
......
...@@ -84,9 +84,6 @@ class DisplayCGL : public DisplayGL ...@@ -84,9 +84,6 @@ class DisplayCGL : public DisplayGL
DeviceImpl *createDevice() override; DeviceImpl *createDevice() override;
std::string getVendorString() const override;
std::string getVersionString() const override;
egl::Error waitClient(const gl::Context *context) override; egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override; egl::Error waitNative(const gl::Context *context, EGLint engine) override;
...@@ -101,6 +98,8 @@ class DisplayCGL : public DisplayGL ...@@ -101,6 +98,8 @@ class DisplayCGL : public DisplayGL
void populateFeatureList(angle::FeatureList *features) override; void populateFeatureList(angle::FeatureList *features) override;
RendererGL *getRenderer() const override;
// Support for dual-GPU MacBook Pros. Used only by ContextCGL. The use of // Support for dual-GPU MacBook Pros. Used only by ContextCGL. The use of
// these entry points is gated by the presence of dual GPUs. // these entry points is gated by the presence of dual GPUs.
egl::Error referenceDiscreteGPU(); egl::Error referenceDiscreteGPU();
......
...@@ -460,16 +460,6 @@ egl::Error DisplayCGL::validateClientBuffer(const egl::Config *configuration, ...@@ -460,16 +460,6 @@ egl::Error DisplayCGL::validateClientBuffer(const egl::Config *configuration,
return egl::NoError(); return egl::NoError();
} }
std::string DisplayCGL::getVendorString() const
{
return GetVendorString(mRenderer->getFunctions());
}
std::string DisplayCGL::getVersionString() const
{
return GetVersionString(mRenderer->getFunctions());
}
CGLContextObj DisplayCGL::getCGLContext() const CGLContextObj DisplayCGL::getCGLContext() const
{ {
return mContext; return mContext;
...@@ -587,6 +577,11 @@ void DisplayCGL::populateFeatureList(angle::FeatureList *features) ...@@ -587,6 +577,11 @@ void DisplayCGL::populateFeatureList(angle::FeatureList *features)
mRenderer->getFeatures().populateFeatureList(features); mRenderer->getFeatures().populateFeatureList(features);
} }
RendererGL *DisplayCGL::getRenderer() const
{
return mRenderer.get();
}
egl::Error DisplayCGL::referenceDiscreteGPU() egl::Error DisplayCGL::referenceDiscreteGPU()
{ {
// Should have been rejected by validation if not supported. // Should have been rejected by validation if not supported.
......
...@@ -73,9 +73,6 @@ class DisplayEAGL : public DisplayGL ...@@ -73,9 +73,6 @@ class DisplayEAGL : public DisplayGL
DeviceImpl *createDevice() override; DeviceImpl *createDevice() override;
std::string getVendorString() const override;
std::string getVersionString() const override;
egl::Error waitClient(const gl::Context *context) override; egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override; egl::Error waitNative(const gl::Context *context, EGLint engine) override;
...@@ -89,6 +86,8 @@ class DisplayEAGL : public DisplayGL ...@@ -89,6 +86,8 @@ class DisplayEAGL : public DisplayGL
void populateFeatureList(angle::FeatureList *features) override; void populateFeatureList(angle::FeatureList *features) override;
RendererGL *getRenderer() const override;
private: private:
egl::Error makeCurrentSurfaceless(gl::Context *context) override; egl::Error makeCurrentSurfaceless(gl::Context *context) override;
......
...@@ -294,16 +294,6 @@ egl::Error DisplayEAGL::validateClientBuffer(const egl::Config *configuration, ...@@ -294,16 +294,6 @@ egl::Error DisplayEAGL::validateClientBuffer(const egl::Config *configuration,
return egl::NoError(); return egl::NoError();
} }
std::string DisplayEAGL::getVendorString() const
{
return GetVendorString(mRenderer->getFunctions());
}
std::string DisplayEAGL::getVersionString() const
{
return GetVersionString(mRenderer->getFunctions());
}
EAGLContextObj DisplayEAGL::getEAGLContext() const EAGLContextObj DisplayEAGL::getEAGLContext() const
{ {
return mContext; return mContext;
...@@ -410,6 +400,12 @@ void DisplayEAGL::populateFeatureList(angle::FeatureList *features) ...@@ -410,6 +400,12 @@ void DisplayEAGL::populateFeatureList(angle::FeatureList *features)
{ {
mRenderer->getFeatures().populateFeatureList(features); mRenderer->getFeatures().populateFeatureList(features);
} }
RendererGL *DisplayEAGL::getRenderer() const
{
return mRenderer.get();
}
} }
#endif // defined(ANGLE_ENABLE_EAGL) #endif // defined(ANGLE_ENABLE_EAGL)
...@@ -133,16 +133,6 @@ EGLSyncImpl *DisplayEGL::createSync(const egl::AttributeMap &attribs) ...@@ -133,16 +133,6 @@ EGLSyncImpl *DisplayEGL::createSync(const egl::AttributeMap &attribs)
return new SyncEGL(attribs, mEGL); return new SyncEGL(attribs, mEGL);
} }
std::string DisplayEGL::getVendorString() const
{
return GetVendorString(mRenderer->getFunctions());
}
std::string DisplayEGL::getVersionString() const
{
return GetVersionString(mRenderer->getFunctions());
}
egl::Error DisplayEGL::initializeContext(EGLContext shareContext, egl::Error DisplayEGL::initializeContext(EGLContext shareContext,
const egl::AttributeMap &eglAttributes, const egl::AttributeMap &eglAttributes,
EGLContext *outContext, EGLContext *outContext,
...@@ -782,6 +772,11 @@ void DisplayEGL::populateFeatureList(angle::FeatureList *features) ...@@ -782,6 +772,11 @@ void DisplayEGL::populateFeatureList(angle::FeatureList *features)
mRenderer->getFeatures().populateFeatureList(features); mRenderer->getFeatures().populateFeatureList(features);
} }
RendererGL *DisplayEGL::getRenderer() const
{
return reinterpret_cast<RendererGL *>(mRenderer.get());
}
egl::Error DisplayEGL::validateImageClientBuffer(const gl::Context *context, egl::Error DisplayEGL::validateImageClientBuffer(const gl::Context *context,
EGLenum target, EGLenum target,
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
......
...@@ -37,9 +37,6 @@ class DisplayEGL : public DisplayGL ...@@ -37,9 +37,6 @@ class DisplayEGL : public DisplayGL
EGLSyncImpl *createSync(const egl::AttributeMap &attribs) override; EGLSyncImpl *createSync(const egl::AttributeMap &attribs) override;
std::string getVendorString() const override;
std::string getVersionString() const override;
void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) override; void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) override;
virtual void destroyNativeContext(EGLContext context); virtual void destroyNativeContext(EGLContext context);
...@@ -91,6 +88,8 @@ class DisplayEGL : public DisplayGL ...@@ -91,6 +88,8 @@ class DisplayEGL : public DisplayGL
void populateFeatureList(angle::FeatureList *features) override; void populateFeatureList(angle::FeatureList *features) override;
RendererGL *getRenderer() const override;
egl::Error validateImageClientBuffer(const gl::Context *context, egl::Error validateImageClientBuffer(const gl::Context *context,
EGLenum target, EGLenum target,
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
......
...@@ -787,16 +787,6 @@ bool DisplayGLX::isValidNativeWindow(EGLNativeWindowType window) const ...@@ -787,16 +787,6 @@ bool DisplayGLX::isValidNativeWindow(EGLNativeWindowType window) const
return status != 0; return status != 0;
} }
std::string DisplayGLX::getVendorString() const
{
return GetVendorString(mRenderer->getFunctions());
}
std::string DisplayGLX::getVersionString() const
{
return GetVersionString(mRenderer->getFunctions());
}
egl::Error DisplayGLX::waitClient(const gl::Context *context) egl::Error DisplayGLX::waitClient(const gl::Context *context)
{ {
mGLX.waitGL(); mGLX.waitGL();
...@@ -1084,4 +1074,9 @@ void DisplayGLX::populateFeatureList(angle::FeatureList *features) ...@@ -1084,4 +1074,9 @@ void DisplayGLX::populateFeatureList(angle::FeatureList *features)
mRenderer->getFeatures().populateFeatureList(features); mRenderer->getFeatures().populateFeatureList(features);
} }
RendererGL *DisplayGLX::getRenderer() const
{
return mRenderer.get();
}
} // namespace rx } // namespace rx
...@@ -70,9 +70,6 @@ class DisplayGLX : public DisplayGL ...@@ -70,9 +70,6 @@ class DisplayGLX : public DisplayGL
bool isValidNativeWindow(EGLNativeWindowType window) const override; bool isValidNativeWindow(EGLNativeWindowType window) const override;
std::string getVendorString() const override;
std::string getVersionString() const override;
egl::Error waitClient(const gl::Context *context) override; egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override; egl::Error waitNative(const gl::Context *context, EGLint engine) override;
...@@ -99,7 +96,7 @@ class DisplayGLX : public DisplayGL ...@@ -99,7 +96,7 @@ class DisplayGLX : public DisplayGL
void populateFeatureList(angle::FeatureList *features) override; void populateFeatureList(angle::FeatureList *features) override;
RendererGL *getRenderer() const { return mRenderer.get(); } RendererGL *getRenderer() const override;
private: private:
egl::Error initializeContext(glx::FBConfig config, egl::Error initializeContext(glx::FBConfig config,
......
...@@ -2340,6 +2340,11 @@ std::vector<ContextCreationTry> GenerateContextCreationToTry(EGLint requestedTyp ...@@ -2340,6 +2340,11 @@ std::vector<ContextCreationTry> GenerateContextCreationToTry(EGLint requestedTyp
return contextsToTry; return contextsToTry;
} }
std::string GetRendererString(const FunctionsGL *functions)
{
return std::string(reinterpret_cast<const char *>(functions->getString(GL_RENDERER)));
}
std::string GetVendorString(const FunctionsGL *functions) std::string GetVendorString(const FunctionsGL *functions)
{ {
return std::string(reinterpret_cast<const char *>(functions->getString(GL_VENDOR))); return std::string(reinterpret_cast<const char *>(functions->getString(GL_VENDOR)));
......
...@@ -165,6 +165,7 @@ struct ContextCreationTry ...@@ -165,6 +165,7 @@ struct ContextCreationTry
std::vector<ContextCreationTry> GenerateContextCreationToTry(EGLint requestedType, bool isMesaGLX); std::vector<ContextCreationTry> GenerateContextCreationToTry(EGLint requestedType, bool isMesaGLX);
std::string GetRendererString(const FunctionsGL *functions);
std::string GetVendorString(const FunctionsGL *functions); std::string GetVendorString(const FunctionsGL *functions);
std::string GetVersionString(const FunctionsGL *functions); std::string GetVersionString(const FunctionsGL *functions);
......
...@@ -472,16 +472,6 @@ rx::ContextImpl *DisplayWGL::createContext(const gl::State &state, ...@@ -472,16 +472,6 @@ rx::ContextImpl *DisplayWGL::createContext(const gl::State &state,
return new ContextWGL(state, errorSet, mRenderer); return new ContextWGL(state, errorSet, mRenderer);
} }
std::string DisplayWGL::getVendorString() const
{
return GetVendorString(mRenderer->getFunctions());
}
std::string DisplayWGL::getVersionString() const
{
return GetVersionString(mRenderer->getFunctions());
}
egl::ConfigSet DisplayWGL::generateConfigs() egl::ConfigSet DisplayWGL::generateConfigs()
{ {
egl::ConfigSet configs; egl::ConfigSet configs;
...@@ -1059,4 +1049,9 @@ void DisplayWGL::populateFeatureList(angle::FeatureList *features) ...@@ -1059,4 +1049,9 @@ void DisplayWGL::populateFeatureList(angle::FeatureList *features)
mRenderer->getFeatures().populateFeatureList(features); mRenderer->getFeatures().populateFeatureList(features);
} }
RendererGL *DisplayWGL::getRenderer() const
{
return reinterpret_cast<RendererGL *>(mRenderer.get());
}
} // namespace rx } // namespace rx
...@@ -63,9 +63,6 @@ class DisplayWGL : public DisplayGL ...@@ -63,9 +63,6 @@ class DisplayWGL : public DisplayGL
EGLClientBuffer clientBuffer, EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) const override; const egl::AttributeMap &attribs) const override;
std::string getVendorString() const override;
std::string getVersionString() const override;
egl::Error waitClient(const gl::Context *context) override; egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override; egl::Error waitNative(const gl::Context *context, EGLint engine) override;
...@@ -89,6 +86,8 @@ class DisplayWGL : public DisplayGL ...@@ -89,6 +86,8 @@ class DisplayWGL : public DisplayGL
void populateFeatureList(angle::FeatureList *features) override; void populateFeatureList(angle::FeatureList *features) override;
RendererGL *getRenderer() const override;
private: private:
egl::Error initializeImpl(egl::Display *display); egl::Error initializeImpl(egl::Display *display);
void destroy(); void destroy();
......
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