bd4f872d69
- 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>
42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
/*
|
|
* Copyright 2019 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkSLSlide_DEFINED
|
|
#define SkSLSlide_DEFINED
|
|
|
|
#include "tools/viewer/Slide.h"
|
|
|
|
#include "include/effects/SkRuntimeEffect.h"
|
|
#include "include/gpu/GrContextOptions.h"
|
|
|
|
class SkSLSlide : public Slide {
|
|
public:
|
|
SkSLSlide();
|
|
|
|
// TODO: We need a way for primarily interactive slides to always be as large as the window
|
|
SkISize getDimensions() const override { return SkISize::MakeEmpty(); }
|
|
|
|
void draw(SkCanvas* canvas) override;
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
void unload() override;
|
|
|
|
private:
|
|
bool rebuild(GrContextOptions::ShaderErrorHandler*);
|
|
|
|
SkString fSkSL;
|
|
bool fCodeIsDirty;
|
|
sk_sp<SkRuntimeEffect> fEffect;
|
|
SkAutoTMalloc<char> fInputs;
|
|
SkTArray<sk_sp<SkShader>> fChildren;
|
|
|
|
// Named shaders that can be selected as inputs
|
|
SkTArray<std::pair<const char*, sk_sp<SkShader>>> fShaders;
|
|
};
|
|
|
|
#endif
|