Handle runtime effect shader errors better
- Expose shader error handler on GrBaseContextPriv
- Use that to report errors that happen during (late) SkSL conversion
- Remove various asserts. We expect these functions not to fail, but
they absolutely can for any kind of error that gets past the first
compile in SkRuntimeEffect::Make. We'll still make a GLSLFP, but it
won't inject any code, so the resulting shader will *also* fail to
compile. Injecting our own errors first gives the user a better idea
what's actually broken.
- SkSLSlide also reports errors via the error handler now, too.
Change-Id: I4b871cdaa5e3217b042ebf000bb7474afaeab04c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275679
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrContext_Base.cpp b/src/gpu/GrContext_Base.cpp
index bd1a7c4..5ac2b08 100644
--- a/src/gpu/GrContext_Base.cpp
+++ b/src/gpu/GrContext_Base.cpp
@@ -9,6 +9,7 @@
#include "src/gpu/GrBaseContextPriv.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrShaderUtils.h"
#include "src/gpu/effects/GrSkSLFP.h"
static int32_t next_id() {
@@ -71,3 +72,9 @@
sk_sp<const GrCaps> GrBaseContextPriv::refCaps() const {
return fContext->refCaps();
}
+
+GrContextOptions::ShaderErrorHandler* GrBaseContextPriv::getShaderErrorHandler() const {
+ const GrContextOptions& options(this->options());
+ return options.fShaderErrorHandler ? options.fShaderErrorHandler
+ : GrShaderUtils::DefaultShaderErrorHandler();
+}