summaryrefslogtreecommitdiff
path: root/chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp')
-rw-r--r--chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp b/chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp
index 12d5794ab20..0bc5781a1aa 100644
--- a/chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp
+++ b/chromium/third_party/dawn/src/dawn_native/opengl/OpenGLFunctions.cpp
@@ -22,7 +22,7 @@ namespace dawn_native { namespace opengl {
MaybeError OpenGLFunctions::Initialize(GetProcAddress getProc) {
PFNGLGETSTRINGPROC getString = reinterpret_cast<PFNGLGETSTRINGPROC>(getProc("glGetString"));
if (getString == nullptr) {
- return DAWN_CONTEXT_LOST_ERROR("Couldn't load glGetString");
+ return DAWN_DEVICE_LOST_ERROR("Couldn't load glGetString");
}
std::string version = reinterpret_cast<const char*>(getString(GL_VERSION));
@@ -54,9 +54,26 @@ namespace dawn_native { namespace opengl {
DAWN_TRY(LoadDesktopGLProcs(getProc, mMajorVersion, mMinorVersion));
}
+ InitializeSupportedGLExtensions();
+
return {};
}
+ void OpenGLFunctions::InitializeSupportedGLExtensions() {
+ int32_t numExtensions;
+ GetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+
+ for (int32_t i = 0; i < numExtensions; ++i) {
+ const char* extensionName = reinterpret_cast<const char*>(GetStringi(GL_EXTENSIONS, i));
+ mSupportedGLExtensionsSet.insert(extensionName);
+ }
+ }
+
+ bool OpenGLFunctions::IsGLExtensionSupported(const char* extension) const {
+ ASSERT(extension != nullptr);
+ return mSupportedGLExtensionsSet.count(extension) != 0;
+ }
+
bool OpenGLFunctions::IsAtLeastGL(uint32_t majorVersion, uint32_t minorVersion) {
return mStandard == Standard::Desktop &&
std::tie(mMajorVersion, mMinorVersion) >= std::tie(majorVersion, minorVersion);