2019-06-13 10:22:32 +00:00
|
|
|
//* Copyright 2019 The Dawn Authors
|
|
|
|
//*
|
|
|
|
//* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
//* you may not use this file except in compliance with the License.
|
|
|
|
//* You may obtain a copy of the License at
|
|
|
|
//*
|
|
|
|
//* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//*
|
|
|
|
//* Unless required by applicable law or agreed to in writing, software
|
|
|
|
//* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//* See the License for the specific language governing permissions and
|
|
|
|
//* limitations under the License.
|
|
|
|
|
2022-02-04 17:07:46 +00:00
|
|
|
#include "dawn/native/opengl/OpenGLFunctionsBase_autogen.h"
|
2019-06-13 10:22:32 +00:00
|
|
|
|
2022-01-12 09:17:35 +00:00
|
|
|
namespace dawn::native::opengl {
|
2019-06-13 10:22:32 +00:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
MaybeError OpenGLFunctionsBase::LoadProc(GetProcAddress getProc, T* memberProc, const char* name) {
|
|
|
|
*memberProc = reinterpret_cast<T>(getProc(name));
|
|
|
|
if (DAWN_UNLIKELY(memberProc == nullptr)) {
|
2020-04-01 12:07:43 +00:00
|
|
|
return DAWN_INTERNAL_ERROR(std::string("Couldn't load GL proc: ") + name);
|
2019-06-13 10:22:32 +00:00
|
|
|
}
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
MaybeError OpenGLFunctionsBase::LoadOpenGLESProcs(GetProcAddress getProc, int majorVersion, int minorVersion) {
|
|
|
|
{% for block in gles_blocks %}
|
|
|
|
// OpenGL ES {{block.version.major}}.{{block.version.minor}}
|
|
|
|
if (majorVersion > {{block.version.major}} || (majorVersion == {{block.version.major}} && minorVersion >= {{block.version.minor}})) {
|
|
|
|
{% for proc in block.procs %}
|
|
|
|
DAWN_TRY(LoadProc(getProc, &{{proc.ProcName()}}, "{{proc.glProcName()}}"));
|
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
|
|
|
|
{% endfor %}
|
2021-05-06 18:34:14 +00:00
|
|
|
|
|
|
|
{% for block in extension_gles_blocks %}
|
|
|
|
// {{block.extension}}
|
|
|
|
{% for proc in block.procs %}
|
|
|
|
DAWN_TRY(LoadProc(getProc, &{{proc.ProcName()}}, "{{proc.glProcName()}}"));
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
|
2019-06-13 10:22:32 +00:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
MaybeError OpenGLFunctionsBase::LoadDesktopGLProcs(GetProcAddress getProc, int majorVersion, int minorVersion) {
|
|
|
|
{% for block in desktop_gl_blocks %}
|
|
|
|
// Desktop OpenGL {{block.version.major}}.{{block.version.minor}}
|
|
|
|
if (majorVersion > {{block.version.major}} || (majorVersion == {{block.version.major}} && minorVersion >= {{block.version.minor}})) {
|
|
|
|
{% for proc in block.procs %}
|
|
|
|
DAWN_TRY(LoadProc(getProc, &{{proc.ProcName()}}, "{{proc.glProcName()}}"));
|
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
|
|
|
|
{% endfor %}
|
2021-05-06 18:34:14 +00:00
|
|
|
|
|
|
|
{% for block in extension_desktop_gl_blocks %}
|
|
|
|
// {{block.extension}}
|
|
|
|
{% for proc in block.procs %}
|
|
|
|
DAWN_TRY(LoadProc(getProc, &{{proc.ProcName()}}, "{{proc.glProcName()}}"));
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
|
2019-06-13 10:22:32 +00:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2022-01-12 09:17:35 +00:00
|
|
|
} // namespace dawn::native::opengl
|