mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
This makes the OpenGL entry points loaded at Adapter creation from the getProcAddress passed in the DiscoveryOptions and update all GL calls in the backend to go through the new OpenGLFunctions object. A code generator is added that generates the function loader and list of GL procs from Khronos' gl.xml file but we can't get rid of glad yet because it is used to have the PROC typedefs and enum values. BUG=dawn:165 Change-Id: I2a583d79752f55877fa4190846f5be16cf91651a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7983 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
42 lines
1.4 KiB
C++
42 lines
1.4 KiB
C++
//* 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.
|
|
|
|
#include "dawn_native/Error.h"
|
|
|
|
#include <glad/glad.h>
|
|
|
|
namespace dawn_native { namespace opengl {
|
|
using GetProcAddress = void* (*) (const char*);
|
|
|
|
struct OpenGLFunctionsBase {
|
|
public:
|
|
{% for block in header_blocks %}
|
|
// {{block.description}}
|
|
{% for proc in block.procs %}
|
|
{{proc.PFNPROCNAME()}} {{proc.ProcName()}} = nullptr;
|
|
{% endfor %}
|
|
|
|
{% endfor%}
|
|
|
|
protected:
|
|
MaybeError LoadDesktopGLProcs(GetProcAddress getProc, int majorVersion, int minorVersion);
|
|
MaybeError LoadOpenGLESProcs(GetProcAddress getProc, int majorVersion, int minorVersion);
|
|
|
|
private:
|
|
template<typename T>
|
|
MaybeError LoadProc(GetProcAddress getProc, T* memberProc, const char* name);
|
|
};
|
|
|
|
}} // namespace dawn_native::opengl
|