diff options
author | 2016-07-30 14:21:10 -0700 | |
---|---|---|
committer | 2016-07-30 14:21:10 -0700 | |
commit | 02aed95f9c7c6745c02e9aa8604d27d7a3ae93db (patch) | |
tree | bf573a00bea3456ce3fcc43c052aa9ae107b60fe /src/core/SkNormalBevelSource.cpp | |
parent | 7c0db75f40f588d91884dfbf3c207d040f3d802d (diff) |
Revert of GrFP can express distance vector field req., program builder declares variable for it (patchset #20 id:370001 of https://codereview.chromium.org/2114993002/ )
Reason for revert:
UBSAN says we're reading a bad bool here:
bool usesDistanceVectorField() const { return fUsesDistanceVectorField; }
../../../include/gpu/GrPaint.h:83:51: runtime error: load of value 239, which is not a valid value for type 'bool'
SUMMARY: AddressSanitizer: undefined-behavior ../../../include/gpu/GrPaint.h:83:51 in
Seems likely also the root of Valgrind failure:
https://luci-milo.appspot.com/swarming/task/30522e4f2241cb10
Original issue's description:
> GrFP can express distance vector field req., program builder declares variable for it
>
> This update allows fragment processors to require a field of vectors to the nearest edge. This requirement propagates:
>
> - from child FPs to their parent
> - from parent FPs to the GrPaint
> - from GrPaint through the PipelineBuilder into GrPipeline
> - acessed from GrPipeline by GrGLSLProgramBuilder
>
> GrGLSL generates a variable for the distance vector and passes it down to the GeometryProcessor->emitCode() method.
>
> This CL's base is the CL for adding the BevelNormalSource API: https://codereview.chromium.org/2080993002
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2114993002
>
> Committed: https://skia.googlesource.com/skia/+/4ef6dfa7089c092c67b0d5ec34e89c1e319af196
TBR=egdaniel@google.com,robertphillips@google.com,bsalomon@google.com,dvonbeck@google.com
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=skia:
Review-Url: https://codereview.chromium.org/2201613002
Diffstat (limited to 'src/core/SkNormalBevelSource.cpp')
-rw-r--r-- | src/core/SkNormalBevelSource.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/SkNormalBevelSource.cpp b/src/core/SkNormalBevelSource.cpp index a63e434c3f..feccb0cce8 100644 --- a/src/core/SkNormalBevelSource.cpp +++ b/src/core/SkNormalBevelSource.cpp @@ -8,7 +8,6 @@ #include "SkNormalBevelSource.h" #include "SkNormalSource.h" -#include "SkNormalSourcePriv.h" #include "SkPoint3.h" #include "SkReadBuffer.h" #include "SkWriteBuffer.h" @@ -26,19 +25,17 @@ public: , fWidth(width) , fHeight(height) { this->initClassID<NormalBevelFP>(); - - fUsesDistanceVectorField = true; } - class GLSLNormalBevelFP : public GLSLNormalFP { + class GLSLNormalBevelFP : public GrGLSLFragmentProcessor { public: GLSLNormalBevelFP() { fPrevWidth = SkFloatToScalar(0.0f); fPrevHeight = SkFloatToScalar(0.0f); } - void onEmitCode(EmitArgs& args) override { - GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; + void emitCode(EmitArgs& args) override { + GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; const char* widthUniName = nullptr; @@ -49,7 +46,7 @@ public: fHeightUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kFloat_GrSLType, kDefault_GrSLPrecision, "Height", &heightUniName); - fragBuilder->codeAppendf("%s = vec4(0.0, 0.0, 1.0, 0.0);", args.fOutputColor); + fragBuilder->codeAppendf("%s = vec4(0, 0, 1, 0);", args.fOutputColor); } static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, @@ -59,8 +56,7 @@ public: } protected: - void setNormalData(const GrGLSLProgramDataManager& pdman, - const GrProcessor& proc) override { + void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override { const NormalBevelFP& normalBevelFP = proc.cast<NormalBevelFP>(); if (fPrevWidth != normalBevelFP.fWidth) { |