Split #defines for OpenGL and OpenGL ES backends.
This permits enabling the OpenGL and OpenGL ES backends independently. This change also enables the OpenGL ES backend on Windows. This will cause the end2end tests to run on OpenGL ES on the GPU-less bots, via SwANGLE. Bug: dawn:580 Change-Id: I43d514b18862d176610b95e97013a67723ddac20 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50881 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
58ec60ea23
commit
21ce5d2965
|
@ -72,7 +72,9 @@ static wgpu::BackendType backendType = wgpu::BackendType::D3D12;
|
|||
static wgpu::BackendType backendType = wgpu::BackendType::Metal;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::Vulkan;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
#elif defined(DAWN_ENABLE_BACKEND_OPENGLES)
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::OpenGLES;
|
||||
#elif defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
|
||||
static wgpu::BackendType backendType = wgpu::BackendType::OpenGL;
|
||||
#else
|
||||
# error
|
||||
|
|
|
@ -62,7 +62,11 @@ declare_args() {
|
|||
|
||||
# Enables the compilation of Dawn's OpenGL backend
|
||||
# (best effort, non-conformant)
|
||||
dawn_enable_opengl = is_linux && !is_chromeos
|
||||
dawn_enable_desktop_gl = is_linux && !is_chromeos
|
||||
|
||||
# Enables the compilation of Dawn's OpenGLES backend
|
||||
# (WebGPU/Compat subset)
|
||||
dawn_enable_opengles = (is_linux && !is_chromeos) || is_win
|
||||
|
||||
# Enables the compilation of Dawn's Vulkan backend
|
||||
# Disables vulkan when compiling for UWP, since UWP only supports d3d
|
||||
|
@ -97,3 +101,6 @@ declare_args() {
|
|||
# UWP only supports CoreWindow for windowing
|
||||
dawn_supports_glfw_for_windowing =
|
||||
(is_win && !dawn_is_winuwp) || (is_linux && !is_chromeos) || is_mac
|
||||
|
||||
# Much of the backend code is shared, so define a convenience var.
|
||||
dawn_enable_opengl = dawn_enable_opengles || dawn_enable_desktop_gl
|
||||
|
|
|
@ -71,6 +71,12 @@ config("dawn_internal") {
|
|||
if (dawn_enable_opengl) {
|
||||
defines += [ "DAWN_ENABLE_BACKEND_OPENGL" ]
|
||||
}
|
||||
if (dawn_enable_desktop_gl) {
|
||||
defines += [ "DAWN_ENABLE_BACKEND_DESKTOP_GL" ]
|
||||
}
|
||||
if (dawn_enable_opengles) {
|
||||
defines += [ "DAWN_ENABLE_BACKEND_OPENGLES" ]
|
||||
}
|
||||
if (dawn_enable_vulkan) {
|
||||
defines += [ "DAWN_ENABLE_BACKEND_VULKAN" ]
|
||||
}
|
||||
|
|
|
@ -150,10 +150,12 @@ namespace dawn_native {
|
|||
Register(vulkan::Connect(this, true), wgpu::BackendType::Vulkan);
|
||||
# endif // defined(DAWN_ENABLE_SWIFTSHADER)
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
#if defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
|
||||
Register(opengl::Connect(this, wgpu::BackendType::OpenGL), wgpu::BackendType::OpenGL);
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGLES)
|
||||
Register(opengl::Connect(this, wgpu::BackendType::OpenGLES), wgpu::BackendType::OpenGLES);
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_OPENGLES)
|
||||
#if defined(DAWN_ENABLE_BACKEND_NULL)
|
||||
Register(null::Connect(this), wgpu::BackendType::Null);
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_NULL)
|
||||
|
|
|
@ -386,7 +386,7 @@ std::unique_ptr<dawn_native::Instance> DawnTestEnvironment::CreateInstanceAndDis
|
|||
instance->SetBackendValidationLevel(mBackendValidationLevel);
|
||||
instance->DiscoverDefaultAdapters();
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_OPENGL
|
||||
#ifdef DAWN_ENABLE_BACKEND_DESKTOP_GL
|
||||
if (!glfwInit()) {
|
||||
return instance;
|
||||
}
|
||||
|
@ -403,11 +403,16 @@ std::unique_ptr<dawn_native::Instance> DawnTestEnvironment::CreateInstanceAndDis
|
|||
dawn_native::opengl::AdapterDiscoveryOptions adapterOptions;
|
||||
adapterOptions.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress);
|
||||
instance->DiscoverAdapters(&adapterOptions);
|
||||
#endif // DAWN_ENABLE_BACKEND_DESKTOP_GL
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_OPENGLES
|
||||
|
||||
if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").empty()) {
|
||||
SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", "swiftshader");
|
||||
}
|
||||
|
||||
if (!glfwInit()) {
|
||||
return instance;
|
||||
}
|
||||
glfwDefaultWindowHints();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
|
@ -419,10 +424,10 @@ std::unique_ptr<dawn_native::Instance> DawnTestEnvironment::CreateInstanceAndDis
|
|||
|
||||
glfwMakeContextCurrent(mOpenGLESWindow);
|
||||
dawn_native::opengl::AdapterDiscoveryOptionsES adapterOptionsES;
|
||||
adapterOptionsES.getProc = adapterOptions.getProc;
|
||||
adapterOptionsES.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress);
|
||||
instance->DiscoverAdapters(&adapterOptionsES);
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE);
|
||||
#endif // DAWN_ENABLE_BACKEND_OPENGL
|
||||
#endif // DAWN_ENABLE_BACKEND_OPENGLES
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
@ -903,13 +908,16 @@ void DawnTestBase::SetUp() {
|
|||
|
||||
device.SetUncapturedErrorCallback(OnDeviceError, this);
|
||||
device.SetDeviceLostCallback(OnDeviceLost, this);
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
#if defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
|
||||
if (IsOpenGL()) {
|
||||
glfwMakeContextCurrent(gTestEnv->GetOpenGLWindow());
|
||||
} else if (IsOpenGLES()) {
|
||||
}
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGLES)
|
||||
if (IsOpenGLES()) {
|
||||
glfwMakeContextCurrent(gTestEnv->GetOpenGLESWindow());
|
||||
}
|
||||
#endif
|
||||
#endif // defined(DAWN_ENABLE_BACKEND_OPENGLES)
|
||||
}
|
||||
|
||||
void DawnTestBase::TearDown() {
|
||||
|
|
|
@ -86,8 +86,12 @@ namespace utils {
|
|||
return CreateNullBinding(window, device);
|
||||
#endif
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGL)
|
||||
#if defined(DAWN_ENABLE_BACKEND_DESKTOP_GL)
|
||||
case wgpu::BackendType::OpenGL:
|
||||
return CreateOpenGLBinding(window, device);
|
||||
#endif
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_OPENGLES)
|
||||
case wgpu::BackendType::OpenGLES:
|
||||
return CreateOpenGLBinding(window, device);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue