Add ShaderErrorHandler to GrContextOptions
Allows clients to customize behavior when shaders fail to compile.
Added nicer shader error handling to viewer.
Change-Id: If82b48e40d64fd786f37e88c564fd623b53c7f9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211361
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index ca9e679..98d6f21 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -21,6 +21,7 @@
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSemaphore.h"
+#include "src/gpu/GrShaderUtils.h"
#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrTracing.h"
#include "src/gpu/SkGr.h"
@@ -92,6 +93,10 @@
}
fPersistentCache = this->options().fPersistentCache;
+ fShaderErrorHandler = this->options().fShaderErrorHandler;
+ if (!fShaderErrorHandler) {
+ fShaderErrorHandler = GrShaderUtils::DefaultShaderErrorHandler();
+ }
return true;
}