mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
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:
committed by
Commit Bot service account
parent
58ec60ea23
commit
21ce5d2965
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user