Set the default ANGLE backend to swiftshader for example code.

As was done for DawnTest, we should set ANGLE's default backend to
SwiftShader for the examples as well.

Bug: dawn:691
Change-Id: I6ced2ffbeed48a555e74a9373c52cbf9e1e3c708
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42301
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2021-02-24 16:53:53 +00:00 committed by Commit Bot service account
parent 0d10a8f7f9
commit e8d9843973
1 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "common/Assert.h"
#include "common/Log.h"
#include "common/Platform.h"
#include "common/SystemUtils.h"
#include "utils/BackendBinding.h"
#include "utils/GLFWUtils.h"
#include "utils/TerribleCommandBuffer.h"
@ -89,6 +90,10 @@ static utils::TerribleCommandBuffer* c2sBuf = nullptr;
static utils::TerribleCommandBuffer* s2cBuf = nullptr;
wgpu::Device CreateCppDawnDevice() {
if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").empty()) {
SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", "swiftshader");
}
glfwSetErrorCallback(PrintGLFWError);
if (!glfwInit()) {
return wgpu::Device();