This is a reland of 4b39aaf2cb
Original change's description:
> Add GrRuntimeFPBuilder
>
> Like SkRuntimeShaderBuilder but for internal use for creating FPs.
>
> Currently it requires that the code be a static string so it can
> easily make a static SkRuntimeEffect instance for each effect.
>
> Bug: skia:11771
>
> Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:11771
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-GCC-x86_64-Release-Shared_Docker,Build-Win-Clang-x86_64-Release-Shared,Build-Win-MSVC-x86_64-Release-Shared
Change-Id: I10a7974aa209f9cd63a5dc1ef21a36822b49bda3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388097
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:11770
Change-Id: I118a85e58a5422ff42c693fd8f85af098d8f8a25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387816
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This reverts commit 4b39aaf2cb.
Reason for revert: DLL fail
Original change's description:
> Add GrRuntimeFPBuilder
>
> Like SkRuntimeShaderBuilder but for internal use for creating FPs.
>
> Currently it requires that the code be a static string so it can
> easily make a static SkRuntimeEffect instance for each effect.
>
> Bug: skia:11771
>
> Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: I13e22674a1bcb07b86342189bab84fc6cbb357e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11771
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387817
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Like SkRuntimeShaderBuilder but for internal use for creating FPs.
Currently it requires that the code be a static string so it can
easily make a static SkRuntimeEffect instance for each effect.
Bug: skia:11771
Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
The non-virtual filterColor4f handles premul and unpremul at the API
boundary. onFilterColor4f always works on premul colors.
To get the performance benefits, all color filters in a chain need
to override the virtual. For now, WorkingFormatColorFilter is the
other target, as builtin filters that use runtime effects are always
wrapped with that.
Net effect on matrix_filterColor4f timing:
before: 10000 ns
after : 380 ns
Bug: skia:11730
Change-Id: I43d06f22c082636c4eca9e58dc3bc8225d09c910
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383705
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 2960b6a62c.
Reason for revert: Android is invoking copy constructor.
Original change's description:
> Reland "Reland "export SkRuntimeShaderBuilder""
>
> This is a reland of a950fef9db
> ... with copy/move ctors/operators deleted for Clang warning.
>
> Original change's description:
> > Reland "export SkRuntimeShaderBuilder"
> >
> > This is a reland of f1a937f141
> >
> > Original change's description:
> > > export SkRuntimeShaderBuilder
> > >
> > > ... like we do SkRuntimeEffect.
> > >
> > > Change-Id: I024f1716b2f818d24b002213c02fa83d2b271123
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377757
> > > Commit-Queue: Mike Klein <mtklein@google.com>
> > > Commit-Queue: Brian Osman <brianosman@google.com>
> > > Auto-Submit: Mike Klein <mtklein@google.com>
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> >
> > Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared
> > Change-Id: I82c440be4ea53e21c6c3d2b6999d832f71563d83
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377859
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Mike Klein <mtklein@google.com>
>
> Change-Id: I29aaa84b6ff995b4226f2b9b34a94f4d2e9964dd
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared,Build-Win-Clang-x86_64-Release-Shared
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377867
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,brianosman@google.com
Change-Id: Iba51d1823bbee084c6a9055d7f41b09786b5418e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-Clang-x86_64-Release-Shared
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378316
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is a reland of a950fef9db
... with copy/move ctors/operators deleted for Clang warning.
Original change's description:
> Reland "export SkRuntimeShaderBuilder"
>
> This is a reland of f1a937f141
>
> Original change's description:
> > export SkRuntimeShaderBuilder
> >
> > ... like we do SkRuntimeEffect.
> >
> > Change-Id: I024f1716b2f818d24b002213c02fa83d2b271123
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377757
> > Commit-Queue: Mike Klein <mtklein@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Auto-Submit: Mike Klein <mtklein@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared
> Change-Id: I82c440be4ea53e21c6c3d2b6999d832f71563d83
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377859
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
Change-Id: I29aaa84b6ff995b4226f2b9b34a94f4d2e9964dd
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared,Build-Win-Clang-x86_64-Release-Shared
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377867
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit a950fef9db.
Reason for revert: sigh, Build-Win-Clang-x86_64-Release-Shared too
Original change's description:
> Reland "export SkRuntimeShaderBuilder"
>
> This is a reland of f1a937f141
>
> Original change's description:
> > export SkRuntimeShaderBuilder
> >
> > ... like we do SkRuntimeEffect.
> >
> > Change-Id: I024f1716b2f818d24b002213c02fa83d2b271123
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377757
> > Commit-Queue: Mike Klein <mtklein@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Auto-Submit: Mike Klein <mtklein@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared
> Change-Id: I82c440be4ea53e21c6c3d2b6999d832f71563d83
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377859
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,brianosman@google.com
Change-Id: Ia0f2da7a6761cad2020449d2d1be2f844f629f9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377866
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This is a reland of f1a937f141
Original change's description:
> export SkRuntimeShaderBuilder
>
> ... like we do SkRuntimeEffect.
>
> Change-Id: I024f1716b2f818d24b002213c02fa83d2b271123
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377757
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared
Change-Id: I82c440be4ea53e21c6c3d2b6999d832f71563d83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377859
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit f1a937f141.
Reason for revert: Build-Win-*-x86_64-Release-Shared
Original change's description:
> export SkRuntimeShaderBuilder
>
> ... like we do SkRuntimeEffect.
>
> Change-Id: I024f1716b2f818d24b002213c02fa83d2b271123
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377757
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=mtklein@google.com,brianosman@google.com
Change-Id: I594c123c5161102e8341033d7a62c4bb98ab3835
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377858
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
... like we do SkRuntimeEffect.
Change-Id: I024f1716b2f818d24b002213c02fa83d2b271123
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377757
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Also removes the now-empty SkImageFilters::RegisterFlattenables()
function (was public, but is private-use only, so no one should be using
it anyways).
The remainder of SkImageFilters.cpp will be cleaned up in a follow-up CL
Bug: skia:11230
Change-Id: Ibdccff70d37e78e935cadcaff2ac90384e27c990
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372120
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 0fdcaa5757.
Reason for revert: Fix landed in Android
Original change's description:
> Revert "Remove (unused) gpuType from SkRuntimeEffect::Uniform"
>
> This reverts commit cc80a47566.
>
> Reason for revert: IWYU cleanup broke less IWYU-clean Android,
>
> frameworks/native/libs/renderengine/skia/filters/BlurFilter.cpp:180:17: error: variable has incomplete type 'SkRRect'
> SkRRect roundedRect;
> ^
> external/skia/include/core/SkCanvas.h:58:7: note: forward declaration of 'SkRRect'
> class SkRRect;
>
>
> Original change's description:
> > Remove (unused) gpuType from SkRuntimeEffect::Uniform
> >
> > Also remove some unnecessary includes, then IWYU.
> >
> > Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Reviewed-by: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com
>
> Change-Id: Id655a6835ebffdb4f5f82474c287c09a69a737df
> No-Tree-Checks: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371941
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>
# Not skipping CQ checks because this is a reland.
Change-Id: I67deaee08f1dfea8d91121b3e665d2e6036b6139
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372216
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Also deletes the unnecessary old header file.
Bug: skia:11230
Change-Id: Ie7c3926fe635a37e617e5e1fcac7c05eb576bbf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368617
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit cc80a47566.
Reason for revert: IWYU cleanup broke less IWYU-clean Android,
frameworks/native/libs/renderengine/skia/filters/BlurFilter.cpp:180:17: error: variable has incomplete type 'SkRRect'
SkRRect roundedRect;
^
external/skia/include/core/SkCanvas.h:58:7: note: forward declaration of 'SkRRect'
class SkRRect;
Original change's description:
> Remove (unused) gpuType from SkRuntimeEffect::Uniform
>
> Also remove some unnecessary includes, then IWYU.
>
> Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: Id655a6835ebffdb4f5f82474c287c09a69a737df
No-Tree-Checks: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371941
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Also remove some unnecessary includes, then IWYU.
Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Change-Id: Id28ed827c4a896805c6d4eead339146fdd49e35f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359560
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Small diffs in a GM -- due to the dual nature of kMedium (cpu and gpu)
Another reason to stop using it, and switch to the more-explicit
sampling.
Bug: skia:7650
Change-Id: Ie7575071b19778626da7f94804abaaa11861a050
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370259
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I4475982f0a5b17bcc4bae4b3f75557969cc70fd2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369856
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit e89b50ae05.
Reason for revert: landed Android fix at http://ag/13544365 (master) and
http://ag/13554983 (sc-dev)
Original change's description:
> Android roll broke with a compilation error:
> frameworks/base/libs/hwui/jni/Shader.cpp:243:37: error: no matching function for call to 'get'
> sk_sp<SkRuntimeEffect> effect = std::get<0>(result)
>
> Revert "Remove deprecated form of SkRuntimeEffect::Make."
>
> This reverts commit 1cda194366.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Remove deprecated form of SkRuntimeEffect::Make.
> >
> > Chromium has migrated to the new API at https://crrev.com/c/2675855.
> >
> > Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
>
> TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
>
> Change-Id: Ie18f865f3b7f5b0263db1e52b19cf6faa0500fdd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368616
> Reviewed-by: Stan Iliev <stani@google.com>
> Commit-Queue: Stan Iliev <stani@google.com>
TBR=mtklein@google.com,brianosman@google.com,stani@google.com,johnstiles@google.com
Change-Id: I9d679013cb275dc80aaaa977b7f1f4da31f36d1e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369037
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Skia linking fails in GOLD because of missing instanciation of kNoCropRect
in SkImageFilters::CropRect. This breaks compilation of skia_renderer
service. More details of this kind of issue in GOLD can be seen in
https://chromium-review.googlesource.com/c/chromium/src/+/2436824
To workaround this, we move the declaration from being a member of
a struct to a namespace constexpr.
bug: chromium:819294
Change-Id: I52e98be440d05236df886b6ff83b84f29cbe7edd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335537
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
frameworks/base/libs/hwui/jni/Shader.cpp:243:37: error: no matching function for call to 'get'
sk_sp<SkRuntimeEffect> effect = std::get<0>(result)
Revert "Remove deprecated form of SkRuntimeEffect::Make."
This reverts commit 1cda194366.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Remove deprecated form of SkRuntimeEffect::Make.
>
> Chromium has migrated to the new API at https://crrev.com/c/2675855.
>
> Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: Ie18f865f3b7f5b0263db1e52b19cf6faa0500fdd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368616
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
Chromium has migrated to the new API at https://crrev.com/c/2675855.
Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This is now structured like the VM generator: Just a function that does
the conversion. Moved all relevant types and constants out of the
compiler, too. The key thing is that we don't need/want an error
handler, because it's too late to fail. We *must* catch all errors
during IR generation.
This is also another step along the path of directly emitting to the
fragment shader builder, rather than generating strings with
placeholders.
Bug: skia:11127
Change-Id: I18591270aa6e56dae1f040275a4b7d4a245007db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366956
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: Ibb48d30b9c0d80db3bf7b92d8c4a60bd9ce6839d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365696
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Change-Id: I10184e60617f65a513980e5389f226f2ebe3eb46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365656
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This allows us to control the inline threshold of runtime effects in a
thread-safe way.
The new Make API now returns a struct, for readability; the old Make API
continues to return a tuple.
The old Make function is deprecated and subject to removal. You can
migrate to the new API by passing a default-constructed Options struct.
In this case there will be no difference in behavior.
Change-Id: Ic62d6f294f596d0a61095e35a87ccdbbe0b1cf93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363785
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:7650
Change-Id: Ia16f169efdb6be2ce381b9ab3b7f6fcecda26312
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363799
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Moves the (SkRect + flags) struct into SkImageFilter_Base with protected
access only. Base constructor and all src/effects/imagefilters Make
functions now take a "const SkRect*" instead. CropRect is still what's
stored and used by filter implementations during filterImage(), but it's
no longer publicly available.
The SkImageFilters factory implementations now can go straight to the
Make functions in src/effects/imagefilters instead of wrapping its
"const SkRect*" in an SkImageFilter::CropRect.
Bug: skia:9296, skia:11230
Change-Id: I2c62f42031910ec405623d4519c8a434cd2b3bdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361496
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Bug: skia:9310
Change-Id: I387f0251f05a2b6f2bc5a759f608d5766ed11ce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357285
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Allows creation of an image directly from a RTE. Caller provides the
effect input bindings, image info for the image, and optional local
matrix.
The info's alpha type and colorspace are tags for the output image. No
alpha type or color space conversions are applied to the output of RTE.
CPU does not yet support making kUnpremul images.
Bug: chromium:1151490
Change-Id: I69babc9dbbce4431d756cd7a3eef4753e727d6fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357284
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: Idab539a4b39fe5ceab54948c99c0dcd6d19fd345
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352743
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Is not used by a major client and can be implemented using runtime
effects for users who want this noise.
Bug: skia:10536
Change-Id: Iaa06e6e1406b808c7f8dc0f76621fecf2becabf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352057
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Still TODO:
- Function calls. Can do these by inlining everything (recursively).
- Additional flow control: ES2 for loops can be supported (via
unrolling), and switch() can be implemented. (Was never done in
ByteCode).
- Uniforms and params have been set up to work very generically (caller
just supplies IDs, the generator collates everything into a master
working list). Builtins should work the same way (caller supplies a
map of builtin ID -> skvm::Val[]?), so that we don't need a special
case for device coord.
- Figure out integer type policy. Today, it's a mix of only supporting
signed integers, and just treating all integers as signed, even if
they're not.
- Now that defining intrinsics is *much* simpler, stop defining so many
of them in sksl_public.sksl, and just implement them here.
Change-Id: Id9771444ce54ccf8e6e408c44ebb3780c1170435
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341980
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Migrating chromium code to use SkImageFilters::Shader over
SkPaintImageFilter requires dithering to be preserved for its gradient
fills.
I debated always forcing it to true, but dithering was never turned on
for the turbulence filter and it's not necessary for const color shaders
Given that, I opted to just make it a parameter to the filter factory,
which seems okay since we're unlikely to embed dithering into SkShader
itself, it's a shading-related parameter of SkPaint, and if we migrate
to always dithering, then we can remove it.
Bug: skia:9310
Change-Id: I86f14969e2446f3a84e71e687cb263bcd44cf9d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338156
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This is needed to help ease the migration from SkImageFilters::Paint,
until image shaders always force you to embed sampling options.
Change-Id: Id8dc8c3196a7935073677a5fbb8d35c3bd22f9ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333757
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This ties the caps to the compiler instance, paving the way for
pre-optimizing the shared code. Most of the time, the compiler is
created and owned the GPU instance, so this is fine. For runtime
effects, we now use the shared (device-agnostic) compiler instance
for the first compile, even on GPU. It's configured with caps that
apply no workarounds. We pass the user's SkSL to the backend as
cleanly as possible, and then apply any workarounds once it's part
of the full program.
Bug: skia:10905
Bug: skia:10868
Change-Id: Ifcf8d7ebda5d43ad8e180f06700a261811da83de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331493
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
The original SkIRect* crop rect argument was a little too onerous.
First, as a pointer, it required you to declare your crop rect separately
just to take a pointer to it. Now, you can pass an SkIRect or SkRect in
directly when you are explicitly constructing a cropped filter.
Second, the crop rect is transformed by the same matrix as the other
filter parameters, so it can be scaled and translated. Allowing SkRect
instead of just SkIRect gives more precision and flexibility for local
coordinate systems. Now a crop rect could be defined to be from [-.5, .5]
and still map to real pixels after transformation (this was a request
from the skia-discuss mailing list, and also better matches the SVG spec).
The crop rect argument was always meant to be a convenience, since I
plan to refactor cropping into an indenendent image filter that will
give more explicit control over when the crop is applied in the DAG.
To maintain the convenience for the factories, the constructors of
the new CropRect type are not explicit so that callers don't ever need
to concern themselves with it.
Bug: skia:9296
Change-Id: I29a684cb925f1fca4dabc803114ab2b125660aaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
SkImageFilters::Paint did not use every slot of the SkPaint, with only
its color, alpha, color filter, and shader having a meaningful effect on
the image filter result. It was always blended into a transparent dst,
so blend mode wasn't very relevant, and it was always filled to whatever
required geometry, so stroke style, path effect, and mask filters were
ignored or not well specified.
Color, alpha, and color filter can all be combined into an SkShader, so
a more constrained SkImageFilters::Shader provides the same useful
capabilities without as many surprises.
SkImageFilters::Paint still exists, but is deprecated to be removed
once I've confirmed clients aren't depending on it.
Bug: skia:9310
Change-Id: I11a82bda1a5d440726cf4e2b5bfaae4929568679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323680
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Mechanically updated via Xcode "Replace Regular Expression":
typedef (.*) INHERITED;
-->
using INHERITED = $1;
The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.
Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
No public user needs these.
Change-Id: Ieeb519a0778b01697c9bbb3b91ce8423eaa94e57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314316
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Previously, if you snapped off a shader and then changed uniforms
(without drawing & flushing), we'd trigger the SkData assert about
calling writeable_data when not-uniquely-owned. Now we lazily copy the
SkData when necessary.
Includes unit test that previously failed.
Bug: skia:10667
Change-Id: If8d9dd8106d41e66560d760cb36ed83371791fc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313678
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Runtime effects previously allowed two kinds of global input variables:
'in' variables could be bool, int, or float. 'uniform' could be float,
vector, or matrix. Uniform variables worked like you'd expect, but 'in'
variables were baked into the program statically. There was a large
amount of machinery to make this work, and it meant that 'in' variables
needed to have values before we could make decisions about program
caching, and before we could catch some errors. It was also essentially
syntactic sugar over the client just inserting the value into their SkSL
as a string. Finally: No one was using the feature.
To simplify the mental model, and make the API much more predictable,
this CL removes 'in' variables entirely. We no longer need to
"specialize" runtime effect programs, which means we can catch more
errors up front (those not detected until optimization). All of the API
that referred to "inputs" (the previous term that unified 'in' and
'uniform') now just refers to "uniforms".
Bug: skia:10593
Change-Id: I971f620d868b259e652b3114f0b497c2620f4b0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309050
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Like shaders, sampling a null child will return the input color (in
this case, the output of the skia shader stage). This gives us a path
to removing the implicit input color passed to main, which is the real
goal. Using this to create more interesting color filters is also
possible, although we need to add the versions of sample() that take a
color to really unlock the potential.
Change-Id: I6a7506055120756497d7583f14d6f928180825fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308515
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).
Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Some of these checks are currently redundant (we don't allow color
filters to have children right now). But the next CL will re-add that
capability, and the unit tests here will ensure we don't re-break things
by allowing child-sampling to violate the color filter invariant.
Change-Id: I54c10d8b1d1e376c13347296765185d42b9f644a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308285
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
GrTypesPriv seems safe to include even without the GPU backend, which
lets us remove the condition from the struct layout. Hoisting and
reformatting the type conversion code just to make the core of the
factory easier to read. (More of this is coming).
Change-Id: I6e36b92789debc7b2630117c285c592ca7cbc37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304001
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
It now tracks all sample calls of a child (matrix, explicit coords,
pass through). There is now just one registerChild() call, and the
sampling pattern of that child is fully determined by the SampleUsage
parameter.
Change-Id: Iaadcd325fca64a59f24192aadd06923c66362181
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299875
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Added sksl_sample_chaining, which draws identically to
fp_sample_chaining, but uses runtime effects that implement each
strategy.
Change-Id: Ib54fbe4fc6d98b4a8e91cf0e3ae6b7e19283ad37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299076
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This removes the kMixed type of SkSL::SampleMatrix. All analysis of FP
sampling due to parent-child relationships is tracked in flags on
GrFragmentProcessor now.
The sample strategy is tracked as follows:
- An FP marks itself as using the local coordinate builtin directly (automatically done for .fp code based on reference to sk_TransformedCoords2D[0]).
- This state propagates up the parent towards the root, marking FPs as using coordinates indirectly. We stop the propagation when we hit a parent FP that explicitly samples the child because it becomes the source of the child's coordinates.
- If that parent references its local coordinates directly, that kicks off its own upwards propagation.
- Being sampled explicitly propagates down to all children, and effectively disables vertex-shader evaluation of transforms.
- A variable matrix automatically marks this flag as well, since it's essentially a shortcut to (matrix expression) * coords.
- The matrix type also propagates down, but right now that's only for whether or not there's perspective.
- This doesn't affect FS coord evaluation since each FP applies its action independently.
- But for VS-promoted transforms, the child's varying may inherit perspective (or other more general matrix types) from the parent and switch from a float2 to a float3.
- A SampleMatrix no longer tracks a base or owner, GrFragmentProcessor exposes its parent FP. An FP's sample matrix is always owned by its immediate parent.
- This means that you can have a hierarchy from root to leaf like: [uniform, none, none, uses local coords], and that leaf will have a SampleMatrix of kNone type. However, because of parent tracking, the coordinate generation can walk up to the root and detect the proper transform expression it needs to produce, and automatically de-duplicate across children.
Currently, all FP's that are explicitly sampled have a signature of (color, float2 coord). FP's that don't use local coords, or whose coords are promoted to a varying have a signature of (color).
- In this case, the shader builder either updates args.fLocalCoords to point to the varying directly, or adds a float2 local to the function body that includes the perspective divide.
GrFragmentProcessor automatically pretends it has an identity coord transform if the FP is marked as referencing the local coord builtin. This allows these FPs to still be processed as part of GrGLSLGeometryProcessor::collectTransforms, but removes the need for FP implementations to declare an identity GrCoordTransform.
- To test this theory, GrTextureEffect and GrSkSLFP no longer have coord transforms explicitly.
- Later CLs can trivially remove them from a lot of the other effects.
- The coord generation should not change because it detects in both cases that the coord transform matrices were identity.
GrGLSLGeometryProcessor's collectTransforms and emitTransformCode has been completely overhauled to recurse up an FP's parent pointers and collect the expressions that affect the result. It de-duplicates expressions between siblings, and is able to produce a single varying for the base local coord (either when there are no intervening transforms, or the root FP needs an explicit coordinate to start off with).
This also adds the fp_sample_chaining GM from Brian, with a few more configurations to fill out the cells.
Bug: skia:10396
Change-Id: I86acc0c34c9f29d6371b34370bee9a18c2acf1c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297868
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit fb5ede576d.
Reason for revert: major performance regression due to constant shader recompilation
Original change's description:
> fixed sample(..., matrix) with runtime effects
>
> Change-Id: Id5b7f1b5e992c587be000e112706bedfe00c90fd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294697
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Ica8322e0eab8f00bfc1d4f6d33778eb6493b278f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295835
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: Id5b7f1b5e992c587be000e112706bedfe00c90fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294697
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I2d95c63de18125e6258709b48b03abd7904b7537
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278596
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
For 3 and 4 channel float uniforms, this states that the data supplied
is unpremul sRGB, and transforms that data to the destination color
space (still unpremul) automatically.
Change-Id: I1b420d2fd10640963fa8e6736af3747cfc6e7d5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286656
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Utility class for getting named access to uniforms and children of an
SkRuntimeEffect (also functions as an example of using the
SkRuntimeEffect public API).
Moved several internal SkRuntimeEffect functions to private, and added
findInput/findChild helpers.
Change-Id: I8c2e7745ea81670a49b7ab2f51ce44a8d8169278
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286516
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Allows for uniforms to be automatically populated with
marked canvas matrices:
SkSL:
layout (marker=localToWorld) uniform float4x4 localToWorldMatrix;
C++:
canvas->concat(...);
canvas->markCTM("localToWorld");
canvas->concat(...);
canvas->drawFoo(...);
Any runtime effects created with that SkSL will have their
localToWorldMatrix uniform filled in with the CTM, ignoring
any transformation that happened before/above the markCTM
call. The marker needs to be a sequence of alphanumeric or
underscore characters, and match the string used in markCTM.
The marker can also be of the form "normals(<string>)", in
which case the uniform will be filled in with the transpose
of the inverse of the upper-left 3x3 portion of the CTM
identified by <string>. This is helpful for transforming
normal vectors, as is often done in lighting.
Change-Id: I7d1ca4dc3f8fabbe91b9bd2c8632013f26d2321a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
About same speed on CPU as pipeline-callback
Change-Id: If8769bebb3c51b5ea61fc34d76dde0cfc16b8473
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283871
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
The morphology image filters work on pixels, so took the radii as
integers. However, these radii will be mapped through the CTM, so any
rounding should happen as late as possible or the effect will be overly
discretized.
Bug: skia:10110
Change-Id: I62ab6c37d0b4612690addc48c9bc473099ac36b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282636
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
In inverted mode (Mode::kInverted), the trim result represents the
logical segment [stop..start] (wrapping around at the path's end).
We currently emit two segments [0..start] and [stop..1], in that
exact order. This behavior breaks continuity for single closed
contour paths.
Update SkTrimPath to
1) emit the segments in the correct order ([stop..1],[0..start])
2) skip the connecting moveTo for closed paths
Bug: skia:10107
Change-Id: Icd280554ba7291c985f504793feff104df2a4a99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Adds structure to the per-vertex (now custom) data.
Attributes currently just have a type, but the next
step is to augment that with semantic flags to handle
transformation logic in the vertex shader.
Added unit tests and GMs that exercise attributes of
varying float counts, as well as normalized bytes.
Bug: skia:9984
Change-Id: I02402d40b66a6e15b39f71125004efb98bc06295
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280338
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Adds a 'varying' modifier to the SkSL frontend. Only valid
for pipeline stage (runtime effect) SkSL programs, and only
on variables that are float, or float[2-4].
Runtime effect SkSL can declare varyings. The effect gathers
and reflects them. The GPU backend uses SkShader_Base's new
asRuntimeEffect() to get this data.
GrDrawVerticesOp and its GP get the shader's effect, if any.
They use this to add vertex attributes, varyings, and global
variables (in the fragment shader) of the appropriate width.
The globals have procedurally generated names, based on
their index in the list ("_vtx_attr_%d"). The GP's fragment
code copies the varyings to the globals.
When PipelineStageCodeGenerator sees a varying reference,
it just replaces that with the procedurally generated name
that matches the logic in the op.
Change-Id: I0effbc4f3425d452cb7d62e51e268f3b48fa3c74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275962
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Move (x,y) up front for shaders, Color for color filters.
I did think about wrapping the other params in a struct, but
for now I still find it less error prone (while admittedly
more tedious) to have all those params in my face when adding,
removing, or refactoring parameters or effects.
Change-Id: I5e124f1ecea3eff9366872d5e77ddfbadc0302e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277111
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Small diffs in affected gms, but doesn't seem wrong.
Change-Id: I6577943f924d682e9ad4ff195ab98ca2168fd527
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277064
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
- 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>
I've been increasingly concerned about the CPU and memory costs of
creating and holding on to many Compiler instances. Given that they're
use infrequently, having a shared (guarded) instance seems fine.
We can still look at reducing the startup cost of a single instance, but
this removes a large blocker to wider usage of SkRuntimeEffect.
Change-Id: Ia6dc721c73fdf8c9c4c7a8c1af5f350d2c028b22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272466
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 7281a86237.
Change-Id: I1759358ede39e2466362cc4d3f0b9530eff08c9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271656
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit 8980acd623.
Reason for revert: Win-Shared
Original change's description:
> Move runtime shader/colorfilter into SkRuntimeEffect.cpp
>
> Better organization that lets us share a bunch of code between these
> (very similar) objects.
>
> Change-Id: Ie559d6e144d8588b98a95d4170e2e6c19d9623bd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270736
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,reed@google.com
Change-Id: Ic13d85b7c4f2d593a6c15dde067f118ea5753eb6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Better organization that lets us share a bunch of code between these
(very similar) objects.
Change-Id: Ie559d6e144d8588b98a95d4170e2e6c19d9623bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270736
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
esp. during serialization. We now store/serialize SkColor, which is
stable.
Change-Id: Ib453920a9a06647f44b33c9ae8af33936d6ead33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270997
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Change-Id: Icf8c69464a44341a08df16dce53aebedc2826bfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270064
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
1. Document that Make() takes RGBA_premul
2. Change impl so that CPU matches this behavior/definition
3. Offer a clearer factory that takes SkColor
(perhaps migrate clients to this one in the future)
Bug: skia:9896
Change-Id: I0a81dda45834a2fbf2b28b711ba7e6b83f360aff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269906
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Change-Id: I1541e3f4629a117eee3f244c0209e442b705b67b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268844
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: Ia5e94704955aba33e07592711656fbeefef15912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I2ce210889452756d5d100fbb15f578bb72e2af2a
Bug: skia:9813
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268687
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Simplifies interaction with users who already have inputs in this form,
and doesn't really add any overhead to other clients.
Change-Id: I6e137e02a65e007621adf481ffb994665117caf4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268836
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
We were never calling specialize() to bake in the values of ins,
so do that. Add uniformSize() to get the size of just the uniform
values. (The interpreter asserts that the size of the uniforms
being passed in matches the expected size from the ByteCode,
so these need to match up).
Added a unit test that uses both 'in' and 'uniform'.
Change-Id: I595822171211d35a17d5977fa790de0d1bbd6c78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263519
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Add framework for unit tests that draw (CPU and GPU) with a runtime
shader, as well as couple example tests.
Change-Id: I43b3b39e86634ec55521a2689a4c55c21939dce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262809
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Adds a new structure to describe the inputs, including type,
shape, name, etc. This removes any references to the type
variables in the compiler's context, and centralizes the
logic for parsing those type variables.
Also normalizes the rules for what types are supported.
(This was inconsistent among the various functions before).
Now:
- bool and int must be 'in'
- float may be 'in' or 'uniform'
- float[2-4] and matrices must be 'uniform'
Includes a new Slide that allows for interactive editing
of a runtime shader.
Change-Id: Ic2af68a80c8bb645ba96417c430da24de0a9c2d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260497
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Remove the RGB/YUV helpers (use SkYUVMath instead), along with the
unused get20/set20.
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Bug: skia:9543
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252188
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Add version SkImageInfo::Make() that takes SkISize instead of separate
width and height.
Change-Id: I42aa79d23b19e22f5405631728c245b04bce0559
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245172
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bugs:
morphology GM: Had swapped Erode and Dilate
imagefilterscropexpand GM: Was applying the filter to the wrong rectangle
imagefilterstransformed, filterfastbounds, et al GMs: The new
SkImageFilters::Image() factory had defaulted to using kNone for quality,
since it appeared to keep a 1-to-1 scale. However, it actually draws the
image from srcRect into the dstRect, mapped by the CTM, so if there's a
scaling factor in the CTM the filter no longer is 1-to-1 and kNone leads
to weird scaling artifacts. So switched back to the original kHigh default.
Change-Id: I30ee455008720048fb27eaed1c2c42915d222c97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232396
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
In preparation for moving the filter-specific headers from include/effects and into src/effects/imagefilters, this exposes a more convenient API where all filters provided by Skia are accessible from the same factory.
It also only exposes the factories that take the shared enums (SkColorChannel, SkTileMode), so the per-filter enums can be phased out (SkBlurImageFilter::TileMode, etc.). It also accepts an SkIRect* instead of an SkImageFilter::CropRect* since all uses seem to be for integer rectangles and flags are either always on or always off. This will allow us to later remove the CropRect type.
Bug: skia:9280
Change-Id: I71f77ff44b573f87b837d6523b9eb565521f0f36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230876
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Combine the GPU and Raster morph type and direction enums, and have the
morphology base class accept the type as an argument instead of a virtual.
Adds somewhat complex deserialization code to be backwards compatible with
the old erode and dilate create procs.
Also updates SkXfermodeImageFilter's implementation to be named with the
"Impl" suffix instead of _Base, and updates both filters to have the common
code layout for image filter implementations.
Change-Id: I5082914f9754c2be71becfceb0c7d9a8fd06f569
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231099
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:9280
Change-Id: Ice3624467f5e643f9d3d81da72d77911eeac963e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230198
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>