mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Add preliminary OpenGL ES and EGL support to Dawn.
This is enough to get all of the sample apps running on a conformant ES 3.1 implementation, such as ANGLE/Vk or NVidia's OpenGL ES Linux driver. Implements a new opengl::AdapterDiscoveryOptionsES subclass to specify its creation at adapter discovery time. Adds a "-b opengles" command-line flag to the code samples. Asserts on a call to glShaderStorageBlockBinding() on ES. Works around missing indexed draw buffers support by asserting when a non-0 color attachment is specified. Works around missing glClearTexSubImage() by asserting. :/ These will likely require front-end validation. BUG=dawn:580 Change-Id: I4a4240ca695a22388c55073fd2aee0323cd4afc9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31000 Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
90bac683b4
commit
70102b7190
@@ -50,12 +50,19 @@ namespace utils {
|
||||
DAWN_UNUSED(type);
|
||||
DAWN_UNUSED(window);
|
||||
|
||||
if (type == wgpu::BackendType::OpenGL) {
|
||||
if (type == wgpu::BackendType::OpenGL || type == wgpu::BackendType::OpenGLES) {
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
glfwMakeContextCurrent(window);
|
||||
dawn_native::opengl::AdapterDiscoveryOptions adapterOptions;
|
||||
adapterOptions.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress);
|
||||
instance->DiscoverAdapters(&adapterOptions);
|
||||
auto getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress);
|
||||
if (type == wgpu::BackendType::OpenGL) {
|
||||
dawn_native::opengl::AdapterDiscoveryOptions adapterOptions;
|
||||
adapterOptions.getProc = getProc;
|
||||
instance->DiscoverAdapters(&adapterOptions);
|
||||
} else {
|
||||
dawn_native::opengl::AdapterDiscoveryOptionsES adapterOptions;
|
||||
adapterOptions.getProc = getProc;
|
||||
instance->DiscoverAdapters(&adapterOptions);
|
||||
}
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
} else {
|
||||
instance->DiscoverDefaultAdapters();
|
||||
@@ -81,6 +88,7 @@ namespace utils {
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
case wgpu::BackendType::OpenGL:
|
||||
case wgpu::BackendType::OpenGLES:
|
||||
return CreateOpenGLBinding(window, device);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ namespace utils {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
} else if (type == wgpu::BackendType::OpenGLES) {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
|
||||
} else {
|
||||
// Without this GLFW will initialize a GL context on the window, which prevents using
|
||||
// the window with other APIs (by crashing in weird ways).
|
||||
|
||||
Reference in New Issue
Block a user