skia2/samplecode
Brian Osman 767f444feb SkRuntimeEffect SkSL has a new signature for main()
There is no more 'inout half4 color'. Effects return their output color.
If an effect wants the input color, it must use the (already existing)
approach of sampling a nullptr input shader.

The change is guarded for Chromium (so we can update their runtime color
filters in skia_renderer.cc).

For the GPU backend, FPs can now override usesExplicitReturn to indicate
that their emitCode will generate a return statement. If that's true,
then writeProcessorFunction doesn't inject the automatic return of the
output color, and emitFragProc will *always* wrap that FP in a helper
function, even as a top-level FP. GrSkSLFP opts in to this behavior, so
that the user-supplied return becomes the actual return in the FP's
emitCode.

Adapting the skvm code to this wasn't too bad: It looks fragile (what
happens if there are multiple returns?), but that's not really possible
today, without varying control flow.

Bug: skia:10613

Change-Id: I205b81fd87dd32bab30b6d6d5fc78853485da036
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310756
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-25 13:36:28 +00:00
..
DecodeFile.h Sample/Filter2View: make it work without /skimages 2019-07-08 17:05:23 +00:00
PerlinPatch.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
Sample2PtRadial.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
Sample3D.cpp SkRuntimeEffect SkSL has a new signature for main() 2020-08-25 13:36:28 +00:00
Sample.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
Sample.h add std::function option to Click to simplify callsites 2020-04-22 15:41:28 +00:00
SampleAAClip.cpp Revert "add guard to switch to SkPathTypes" 2019-09-14 19:13:44 +00:00
SampleAAGeometry.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleAARectModes.cpp Samples: clean up cruft 2019-07-17 18:29:50 +00:00
SampleAARects.cpp more rect api simplifications 2019-08-25 10:12:57 +00:00
SampleAndroidShadows.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SampleAnimatedImage.cpp Fix implicit fallthroughs throughout Skia. 2020-06-11 22:29:53 +00:00
SampleAnimatedText.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleAnimBlur.cpp Samples: clean up cruft 2019-07-17 18:29:50 +00:00
SampleArc.cpp more rect api simplifications 2019-08-25 10:12:57 +00:00
SampleAtlas.cpp tools: separate TimeUtils from AnimTimer 2019-07-12 15:05:01 +00:00
SampleAudio.cpp Componentize SkAudioPlayer 2020-08-14 13:46:06 +00:00
SampleBackdropBounds.cpp Revert "Revert "move onto new factories for SkMatrix"" 2020-05-21 16:58:39 +00:00
SampleBitmapRect.cpp Samples: clean up cruft 2019-07-17 18:29:50 +00:00
SampleCamera.cpp tools: separate TimeUtils from AnimTimer 2019-07-12 15:05:01 +00:00
SampleCCPRGeometry.cpp Write GPU buffers directly from GrStrokeGeometry 2020-07-24 04:38:51 +00:00
SampleChart.cpp Switch over to SkPathBuilder 2020-07-31 02:21:51 +00:00
SampleChineseFling.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleCircle.cpp Samples: clean up cruft 2019-07-17 18:29:50 +00:00
SampleClip.cpp SkPathView for ownerless (can live on stack) SkPaths 2020-08-07 20:39:38 +00:00
SampleClipDrawMatch.cpp Samples: clean up cruft 2019-07-17 18:29:50 +00:00
SampleClock.cpp Revert "Reland "Revert "Use flat version of path-direction enum""" 2019-11-22 19:09:54 +00:00
SampleColorFilter.cpp more rect api simplifications 2019-08-25 10:12:57 +00:00
SampleComplexClip.cpp Update complex clip GMs to only use supported clip ops 2020-06-25 14:15:25 +00:00
SampleCowboy.cpp Revert "Revert "move onto new factories for SkMatrix"" 2020-05-21 16:58:39 +00:00
SampleCusp.cpp tools: separate TimeUtils from AnimTimer 2019-07-12 15:05:01 +00:00
SampleDegenerateQuads.cpp Rename domain types and vars to subset. 2020-04-21 21:43:45 +00:00
SampleDegenerateTwoPtRadials.cpp tools: separate TimeUtils from AnimTimer 2019-07-12 15:05:01 +00:00
SampleEffects.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleEmboss.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleFatBits.cpp Revert "Revert "move onto new factories for SkMatrix"" 2020-05-21 16:58:39 +00:00
SampleFillType.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleFilter2.cpp Sample/Filter2View: make it work without /skimages 2019-07-08 17:05:23 +00:00
SampleFilterQuality.cpp Revert "Revert "switch to new filltype for SkPath"" 2019-11-26 17:43:14 +00:00
SampleFitCubicToCircle.cpp Add an interactive sample that fits cubics to circular arcs 2020-06-09 23:04:03 +00:00
SampleFlutterAnimate.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleFontCache.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleGlyphTransform.cpp tools: separate TimeUtils from AnimTimer 2019-07-12 15:05:01 +00:00
SampleGradients.cpp more rect api simplifications 2019-08-25 10:12:57 +00:00
SampleHairCurves.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleHairline.cpp tools/skui: put all enums in a common namespace 2019-08-29 15:39:32 +00:00
SampleHairModes.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleHT.cpp tools/skui: put all enums in a common namespace 2019-08-29 15:39:32 +00:00
SampleIdentityScale.cpp SkBlurMaskFilter.h is only needed for (deprecated) emboss 2019-12-30 15:40:46 +00:00
SampleImageFilterDAG.cpp Remove SkMaxScalar and SkMinScalar 2020-02-06 15:43:22 +00:00
SampleLayerMask.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleLayers.cpp hide savelayer's clipmask fields 2020-05-31 14:06:42 +00:00
SampleLCD.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleLua.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleManyRects.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleMegaStroke.cpp more rect api simplifications 2019-08-25 10:12:57 +00:00
SampleMixer.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SamplePatch.cpp SkVertices: Remove volatile/nonvolatile bit 2020-03-11 17:33:17 +00:00
SamplePath.cpp show fat stroking on lines or curves 2020-06-26 19:13:00 +00:00
SamplePathClip.cpp add std::function option to Click to simplify callsites 2020-04-22 15:41:28 +00:00
SamplePathEffects.cpp Revert "add guard to switch to SkPathTypes" 2019-09-14 19:13:44 +00:00
SamplePathOverstroke.cpp Samples: simplify Sample::Event 2019-07-08 19:09:42 +00:00
SamplePathText.cpp Merge PathText samples into one, with different modes 2020-05-29 16:35:25 +00:00
SamplePolyToPoly.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleQuadStroker.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleRectanizer.cpp Reland GrRectanizerPow2 2020-05-19 18:35:13 +00:00
SampleRegion.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleRepeatTile.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleSG.cpp [skottie] Cleanup: relocate Animator base class out of SkSG 2020-03-26 20:50:10 +00:00
SampleShaders.cpp re-run tools/rewrite_includes.py 2019-07-25 15:40:33 +00:00
SampleShadowColor.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SampleShadowReference.cpp Samples: simplify Sample::Event 2019-07-08 19:09:42 +00:00
SampleShadowUtils.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SampleShip.cpp Remove WallTimer class. 2019-07-15 16:06:11 +00:00
SampleSimpleStroker.cpp Show mirror drawn with SkStroke (toy stroker) 2020-07-22 18:49:20 +00:00
SampleSlides.cpp Remove unnecessary SK_SIZE_T_SPECIFIER macro. 2020-05-05 13:25:28 +00:00
SampleStringArt.cpp Remove SkMaxScalar and SkMinScalar 2020-02-06 15:43:22 +00:00
SampleStrokePath.cpp Revert "Revert "switch to new filltype for SkPath"" 2019-11-26 17:43:14 +00:00
SampleStrokeRect.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleSubpixelTranslate.cpp SkBlurMaskFilter.h is only needed for (deprecated) emboss 2019-12-30 15:40:46 +00:00
SampleSVGFile.cpp Samples: add name() virtual 2019-07-03 17:41:16 +00:00
SampleTessellatedWedge.cpp Rename GrTessellateStroke* -> GrStrokeTessellate* and friends 2020-07-31 02:24:05 +00:00
SampleTextBox.cpp Regularize SkFontMgr for CoreText build. 2020-06-04 16:45:09 +00:00
SampleTextEffects.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleTextureUpload.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleThinAA.cpp Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SampleUnpremul.cpp remove code now that loopers are dead (w.r.t. canvas and paint) 2019-07-30 12:49:28 +00:00
SampleVertices.cpp tools/skui: put all enums in a common namespace 2019-08-29 15:39:32 +00:00
SampleWritePixels.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleXfer.cpp demo CubicResampler 2020-07-24 20:13:34 +00:00
SampleXfermodesBlur.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
vertexdump.cpp rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00