Commit Graph

32011 Commits

Author SHA1 Message Date
Sergey Ulanov
119fb6bb25 Add support for GL_ANGLE_rgbx_internal_format format
Angle/Vulkan added GL_ANGLE_rgbx_internal_format extension for RGBX
texture format. Add support for that format in Skia.

Bug: chromium:1261867, chromium:1269826, angle:6690
Change-Id: I74fc91699dc1eaf2b275b29fbcf3d4060e63c5a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485157
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-13 22:47:21 +00:00
Ben Wagner
62b32180c1 Fix Chromium Libfuzzer Upload Windows ASan bot.
This bot has been failing due to a warning as error about the extra ';'
inside a class. This extra semicolon comes from some older existing
code, so this appears to be a new warning from -Wextra-semi.

Change-Id: Ibbd2ccda4dced9f0892ee19b1d5d9465131ec74e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494819
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-13 21:11:21 +00:00
Dominik Röttsches
6dece64b9d [COLRv1] Take P2 into account again in gradient skewing
The change in [1] is likely responsible for a regression in which we're
not taking into account P2 for gradient skewing anymore.

Fix that, and add a test case to the gradient set of test cases.
Source for test glyph, see here:
https://github.com/googlefonts/color-fonts/pull/90/files

[1] 2da029b28f

Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_NativeFonts,Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-NativeFonts
Bug: skia:12822, chromium:1287162
Change-Id: I8b790e2a5c6c04487118306b4b38b1d77349431d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494676
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Dominik Röttsches <drott@google.com>
2022-01-13 18:16:50 +00:00
Herb Derby
8fd014bb67 align prepareForMaskDrawing to agree for remote and gpu
The prepareForMaskDrawing in the RemoteStrike and the SkScalerCache
must fully agree on the maximum dimensions calculations.

Bug: chromium:1280180

Change-Id: Idfe98618027e5b04a481fa55f27e10b5bb048aea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494580
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-13 17:23:20 +00:00
Greg Daniel
61a03aa0b9 Fix MSAN unitialized memory in vulkan memory allocator.
Bug: skia:12821
Change-Id: Iaadc9c5d2723b0973e46e121f27d204c5cfaa657
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494477
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-13 16:59:07 +00:00
Kevin Lubick
25a7797820 [bazel] Add mirrors to every external dependency.
- We always download from https
- All external assets have a primary and a mirror URL.
- We prioritize the sources as follows:
    bazel mirror, github/original source, our mirror
- There is a way (see build_toolchain) to test the sources
  from the mirrors (done before CL submission).

This adds a utility to upload files to the mirror in a
consistent, scripted way. It includes a way to copy in
parts of our bazel files (e.g. debs_to_install from
toolchain/build_toolchain.bzl) to update many things
at once.

Our Bazel mirror (gs://skia-world-readable/bazel)
is a Content Addressable Storage system, where the
file name is based on the sha256sum of the contents
(the same hash that Bazel uses). All files in it should
be publicly accessible.

Change-Id: Ida8b8e07d27a0a557bc49467ebbc86c806cabbd3
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494478
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2022-01-13 15:53:27 +00:00
Robert Phillips
cc4d21f980 [graphite] Move ShaderCodeDictionary, SkPaintParamsKey, and UniquePaintParamsID to include/private
Since the SkShaders, etc will need access to SkPaintParamKeys and the SkShaderCodeDictionary they can't be buried in the skgpu namespace.

The currently planned signature for addToKey is:

void addToKey(SkShaderCodeDictionary*, SkBackend, SkPaintParamsKey*) const;

This CL doesn't modify the classes beyond what is needed to move them.

Bug: skia:12701
Change-Id: I18bbf6d6c3a768427112a3d19a9ccf2d46a23ad2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494237
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-13 14:22:11 +00:00
Jim Van Verth
db1d93f3b4 Stop timeout in api_mock_gpu_canvas.
Large paths can lead to large processing times for path effects and
hence timeouts.

Also re-enables ShrinkToFit test until that code is finally removed,
but using the PathPriv interface instead.

Bug: oss-fuzz:39040
Change-Id: If3aeac0e8b67cecc6e536cafda01ed6d583655d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494240
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-01-12 22:45:31 +00:00
Ethan Nicholas
8af1eebedb Converted SkSLSwitchCase to use ints rather than expressions
There was no reason to carry around the heavier expressions, as we only
support int literals or constants, and this not only fixes a bug but
simplifies some of the code.

Bug: skia:12811
Change-Id: I3f55d6974d77ce1907f90868775c0e4894243783
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494037
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-12 21:32:46 +00:00
Robert Phillips
00f71133a8 [graphite] Reduce maintainance issues wrt SkPaintParamKey dumping
Bug: skia:12701
Change-Id: I75afb5115743f59b0626d43c6ada4f5a3813422f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494137
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-12 20:16:49 +00:00
Robert Phillips
04e74196b0 [graphite] Replace Combination with SkPaintParamsKey
SkPaintParamsKey can be variable length and is thus the path forward for encapsulating/representing PaintParams.

Note: SkPaintParamsKey isn't in the skgpu namespace bc, ultimately, the individual SkShaders, etc will be responsible for adding their own information to the key.

Bug: skia:12701
Change-Id: I7472dc00706a4548bc3ffb4e287a941a2b8ffcae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492405
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-12 18:47:34 +00:00
Ethan Nicholas
704007f5ed Fixed error handling with DSL runtime effects
Bug: skia:11862
Change-Id: Ia21fad6acb82a03c1ba8663be548bf58f5067b85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493636
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-12 15:37:45 +00:00
Herb Derby
30fdea3d8f track glyph scaling hints in min/max pairs
Track the scaling hints as the minimum of the maximum dimension and
the maximum of the maximum dimension. Having the range will allow
for better scaling choices in the drawing of last resort.

The next CL will start using this range to calculate scaling factors.

Bug: chromium:1280180

Change-Id: I2c07303d3303c71ede2a0b1133ee2e218f7bd84e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493456
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-11 17:45:21 +00:00
Kevin Lubick
6e63f4925e [bazel] Use font manager in HelloWorld.
This documents the various factory settings (I kept getting
confused as to what each was doing).

Additionally, this makes setting the factory flag bring in
the dependent code as well (like our current GN rules do).

Change-Id: I93437651b078baac04433c14c573a95982b7bc15
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493396
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-01-11 16:22:52 +00:00
Robert Phillips
bf489abbf6 [graphite] Add SkTileModeToStr
This is to be used in the PaintParamKey's block dumping methods.

Bug: skia:12701
Change-Id: I14de21d2d8b30e0fa69ac2e33fa975dc20f6656c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493217
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-11 16:19:53 +00:00
Kevin Lubick
e3b935b0bf [bazel] Update files and fix circular dependency
//:skia_core
    //src/effects:srcs
    //src/effects/imagefilters:SkBlurImageFilter_src
    //src/gpu/v1:SurfaceDrawContext_v1_hdr
    //src/core:SkGlyphRunPainter_hdr
    //src/core:SkGlyphBuffer_hdr
.-> //src/core:SkGlyph_hdr
|   //src/core:SkStrikeForGPU_hdr
`-- //src/core:SkGlyph_hdr

This was found by running the following commands:
  cd bazel
  make generate
  make known_good_builds

Change-Id: I24e33124c4bb5217ac87a0ad2ab3dd8a590c53c3
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493376
Reviewed-by: Herb Derby <herb@google.com>
2022-01-11 14:43:27 +00:00
Kevin Lubick
7a14f783bd [bazel] Sketching out HelloWorld sk_app using GL
bazel run //example:hello_world --config=clang
causes a window to open and draws a circle and a square.
Text to follow in a future CL.

To make this work, I had to get rid of musl and use glibc.
All the shared libraries (.so files) that were pre-built
and available for download (e.g. from https://packages.debian.org/bullseye/amd64/libgl1/download)
were compiled against glibc. When I tried to run a
program statically linked with musl and dynamically linked
against things using glibc, I got a segmentation fault
on things like calloc().

Initial attempts to use glibc had failed because it was thought
that the libc.so.6 file could only be referred to by absolute
path (and thus Bazel would not be happy about it). As it turns out,
that was simply a misconfiguration of the builtin_sysroot
parameter to cc_common.create_cc_toolchain_config_info
(see //toolchain/clang_toolchain_config.bzl). By setting that
to `external/clang_linux_amd64` and not
`external/clang_linux_amd64/usr`, the libc binary which had
been extracted to `external/clang_linux_amd64/lib/x86_64-linux-gnu`
was perfectly reachable from
`external/clang_linux_amd64/usr/usr/lib/x86_64-linux-gnu/libc.so`

To bring in the shared libraries to link against (e.g. X11, GL)
I made build_toolchain.bzl easier to modify in that we simply need
to add a debian download url and sha256 hash to a list (rather than
having to plumb this through via arguments).

Recommended Review Order:
 - example/BUILD.bazel (not sure if we always want to set bare
   link arguments like that or if we want to use "features" to
   pass those along to the toolchain).
 - tools/sk_app/BUILD.bazel to see initial cc_library for
   wrapping sk_app code.
 - toolchain/build_toolchain.bzl to see removal of musl and
   new list of debs.
 - toolchain/clang_toolchain_config.bzl (where use of the
   no-canonical-prefixes was key to compilation success).
   Notice also that we statically linked libc++ (I did not
   have any shared libraries for it locally, so I guessed
   a typical developer might not either).
 - Rest of toolchain/ for trivial renames.
 - bazel/Makefile to see extra docs on those targets and
   a new target that compiles all the exes so far for a
   quick way to test the build.
 - third_party/BUILD.bazel and src/gpu/BUILD.bazel which have
   non-generated changes. (all other BUILD.bazel files do).
 - go.mod, which needed to update the infra repo version in
   order to pick up http://review.skia.org/491736).

Change-Id: I8687bd227353040eca2dffa9465798d8bd395027
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492117
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-11 13:06:19 +00:00
Brian Salomon
8a85ab0d96 Reland "drawVertices in GPU backend uses drawVustomMesh implementation."
This is a reland of 73657689b6

Original change's description:
> drawVertices in GPU backend uses drawVustomMesh implementation.
>
> This still allows batching across view matrix changes but does not batch
> across SkVertices that have different attributes.
>
> Bug: skia:12720
> Change-Id: I34b58e2ae3aa7330b1fe3280b9448197e2bb68b0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491047
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I24230e2a284b98ce71ccf034ff71d903896f1da1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492357
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-10 23:06:15 +00:00
Herb Derby
55b4dc3f7a use SkGlyphDigest for MaskSummary
Use SkGlyphDigest in the remote glyph cache. This allows future
CLs to use maximum glyph information for calculating scale factors.

Move SkGlyphDigest to a more central location in the code.

Bugs: chromium:1280180

Change-Id: Id916d39b8a46a29723bc9f244969c8d00162e5df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493197
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-10 20:53:16 +00:00
Jim Van Verth
2e6181cac4 Check sanitized data when fuzzing PolyUtils.
PolyUtils is only ever used when generating shadows, and the data there
is pre-clamped to 1/16th values, so we should be fuzzing on that.

Bug: oss-fuzz:39746
Change-Id: I609059ab14cd83f0dab2d40cb17e3cb7979cff8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493039
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-01-10 17:31:45 +00:00
Greg Daniel
ff837f8358 Fix origin in SkImage_Lazy for GrAhardwareBufferImageGenerator.
Change-Id: I238f7c5669856b7d29a175dfdc27e12f3141f49c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493016
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-10 16:09:20 +00:00
Herb Derby
93e0041c6c more direct glyph drawing
Allow direct glyph drawing to handle more cases. Instead of using
the approximate glyphs size to control using direct drawing, directly
measure each glyph. This will be useful in latter CL to better scale
*very* big emoji.

This is its own CL to check pixel problem in chrome layout and
google3. It's a simple revert.

Bug: chromium:1280180

Change-Id: Ic2e4aed7d401b99909ba2aceaf0f2f849070a80c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492402
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-07 19:50:35 +00:00
Julia Lavrova
a856f40086 Interface blocks no longer allow duplicate fields
bug: skia:12793
Change-Id: Idccdab5ee8f1c7792bdfe98efd379d0199a65377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492397
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-07 16:44:08 +00:00
Michael Ludwig
54d9447b6a Reland "Fill intermediate device image with clamped backdrop content"
This reverts commit 35ac48c715.

Reason for revert: guarded needs_subset

Original change's description:
> Revert "Fill intermediate device image with clamped backdrop content"
>
> This reverts commit 25f5e1f838.
>
> Reason for revert: needs_subset is unused for no-gpu+release builds
>
> Original change's description:
> > Fill intermediate device image with clamped backdrop content
> >
> > Adds asShader() to SkSpecialImage that accepts a local matrix and a
> > tilemode. It automatically handles the subsetting of the image data
> > (either by making a new bitmap view, or using GrTexturEffect), as well
> > as modifying the local matrix to account for the subset's offset within
> > the image data.
> >
> > By adding asShader(), SkCanvas can fill a device using drawPaint() to
> > apply the image's tilemode to the entire contents, ensuring that any
> > device bounds clipping from snapping of backdrop filters doesn't leave
> > the default transparent pixels around for later filtering.
> >
> > Additionally, making SkSpecialImage more like a shader will make it
> > easier down the road to continue refactoring the image filter pipeline
> > to be more backend agnostic and allow operations to be performed by
> > filling devices with shaders, instead of relying on FPs directly.
> >
> > Lastly, once SkImage::makeShader() can support subsets on the raster
> > backend, then SkSpecialImage may not be required at all in order to
> > implement the image filtering pipeline...
> >
> > Bug: b/197774543, skia:12784
> > Change-Id: I21dcb22b56b19ff58d246b3c0517bb8a265649bc
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491445
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> Bug: b/197774543, skia:12784
> Change-Id: Ia9adedaab9378d2679353ab94c7a9589c0ff9e02
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491978
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

Bug: b/197774543, skia:12784
Change-Id: I6034e4ddbe4f6da476d058a78f85f4e2bb6742fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492116
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-01-07 14:45:56 +00:00
Brian Osman
5bb80e1ee0 Revert "drawVertices in GPU backend uses drawVustomMesh implementation."
This reverts commit 73657689b6.

Reason for revert: Many bad GMs.

Original change's description:
> drawVertices in GPU backend uses drawVustomMesh implementation.
>
> This still allows batching across view matrix changes but does not batch
> across SkVertices that have different attributes.
>
> Bug: skia:12720
> Change-Id: I34b58e2ae3aa7330b1fe3280b9448197e2bb68b0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491047
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I2aa0a62323e54cb999cc89eccd72cf9b93dccba9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492356
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-01-07 14:12:16 +00:00
Julia Lavrova
2f3891bf76 Duplicate field names in struct
bug: skia:12712
Change-Id: I61a4512c10bf91d6396c38f148a714492669a9e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491820
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-06 22:44:16 +00:00
Herb Derby
72412a8672 remove drawingType simplifying code
Encapsulate the direct/SDFT decisions in the bool functions
isDirect() and isSDFT().

Encapsulate the notion of glyph approximations in:
approximateTransformedTextSize().

Use these to replace drawingType through the code.

Bug: chromium:1280180

Change-Id: I8de7ee8bc4a24e576e79eeb1ed8670179a860aa9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491448
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-06 21:35:40 +00:00
Brian Salomon
73657689b6 drawVertices in GPU backend uses drawVustomMesh implementation.
This still allows batching across view matrix changes but does not batch
across SkVertices that have different attributes.

Bug: skia:12720
Change-Id: I34b58e2ae3aa7330b1fe3280b9448197e2bb68b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491047
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-06 21:05:33 +00:00
Leon Scroggins III
98fbe5eb8d Convert RENDERENGINE_ABORTF to LOG_ALWAYS_FATAL
Bug: b/213293147
Bug: b/206415266

The intent of RENDERENGINE_ABORTF was for the error message to show as
part of the stack trace, as logs before the stack trace may not be
available. However, a closer reading of SK_ABORTF reveals that it's just
an SkDebugf followed by an abort, and a device hitting the abort still
doesn't show the debug statement.

Switch to LOG_ALWAYS_FATAL, which includes the message in the stack
trace.

Change-Id: I7b83805d946011f39fd43ac8efe742acf760c769
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491977
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2022-01-06 20:21:26 +00:00
Michael Ludwig
35ac48c715 Revert "Fill intermediate device image with clamped backdrop content"
This reverts commit 25f5e1f838.

Reason for revert: needs_subset is unused for no-gpu+release builds

Original change's description:
> Fill intermediate device image with clamped backdrop content
>
> Adds asShader() to SkSpecialImage that accepts a local matrix and a
> tilemode. It automatically handles the subsetting of the image data
> (either by making a new bitmap view, or using GrTexturEffect), as well
> as modifying the local matrix to account for the subset's offset within
> the image data.
>
> By adding asShader(), SkCanvas can fill a device using drawPaint() to
> apply the image's tilemode to the entire contents, ensuring that any
> device bounds clipping from snapping of backdrop filters doesn't leave
> the default transparent pixels around for later filtering.
>
> Additionally, making SkSpecialImage more like a shader will make it
> easier down the road to continue refactoring the image filter pipeline
> to be more backend agnostic and allow operations to be performed by
> filling devices with shaders, instead of relying on FPs directly.
>
> Lastly, once SkImage::makeShader() can support subsets on the raster
> backend, then SkSpecialImage may not be required at all in order to
> implement the image filtering pipeline...
>
> Bug: b/197774543, skia:12784
> Change-Id: I21dcb22b56b19ff58d246b3c0517bb8a265649bc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491445
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

Bug: b/197774543, skia:12784
Change-Id: Ia9adedaab9378d2679353ab94c7a9589c0ff9e02
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491978
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-01-06 19:57:23 +00:00
Michael Ludwig
25f5e1f838 Fill intermediate device image with clamped backdrop content
Adds asShader() to SkSpecialImage that accepts a local matrix and a
tilemode. It automatically handles the subsetting of the image data
(either by making a new bitmap view, or using GrTexturEffect), as well
as modifying the local matrix to account for the subset's offset within
the image data.

By adding asShader(), SkCanvas can fill a device using drawPaint() to
apply the image's tilemode to the entire contents, ensuring that any
device bounds clipping from snapping of backdrop filters doesn't leave
the default transparent pixels around for later filtering.

Additionally, making SkSpecialImage more like a shader will make it
easier down the road to continue refactoring the image filter pipeline
to be more backend agnostic and allow operations to be performed by
filling devices with shaders, instead of relying on FPs directly.

Lastly, once SkImage::makeShader() can support subsets on the raster
backend, then SkSpecialImage may not be required at all in order to
implement the image filtering pipeline...

Bug: b/197774543, skia:12784
Change-Id: I21dcb22b56b19ff58d246b3c0517bb8a265649bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491445
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-01-06 18:58:33 +00:00
Kevin Lubick
96e4053be7 Update Bazel files
- Use latest emscripten toolchain (3.1.0)
 - Autogenerate the atoms and manually fix some of the file lists.
 - Add a known_good_builds target to bazel/Makefile to help
   check the things we expect to work with Bazel.

Change-Id: Ia5f51e7b9eb5c108386820ad59180c8f862f5a70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491438
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-01-06 18:10:57 +00:00
Kevin Lubick
dc17673395 Add SKSL guard to SkCustomMesh APIs
The SkCustomMesh object requires SkSL, which Bazel noticed.

Change-Id: I11046d75ce0dd37ebdecc2dd2a24e7eb44e6149d
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491938
Reviewed-by: Brian Salomon <bsalomon@google.com>
2022-01-06 18:10:57 +00:00
Ethan Nicholas
4cd3ae4009 Revert "Fixed SkSL error reporting on array types"
This reverts commit 6e686b8b8b.

Reason for revert: After internal discussion, we established that nobody was actually sure why this had needed to be an error in the old parser in the first place, so there does not appear to be a reason to carry the behavior forward.

Original change's description:
> Fixed SkSL error reporting on array types
>
> The DSLParser was not reporting errors when the array type appeared
> before the variable name (float[2] x) as opposed to after (float x[2])
> in strict ES2 mode.
>
> Bug: skia:12410
>
> Change-Id: Ia388aa150f65916dc3ccc58f7680dbde0a636c5f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491819
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:12410
Change-Id: I355fd1ad89e2e64b0377be7672b7f3f824eebac8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491996
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-01-06 16:53:17 +00:00
Ethan Nicholas
6e686b8b8b Fixed SkSL error reporting on array types
The DSLParser was not reporting errors when the array type appeared
before the variable name (float[2] x) as opposed to after (float x[2])
in strict ES2 mode.

Bug: skia:12410

Change-Id: Ia388aa150f65916dc3ccc58f7680dbde0a636c5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491819
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-06 16:28:47 +00:00
Ethan Nicholas
c613e0d752 Revert "Revert "Removed SkSL SymbolTable aliases""
The previous land contained a stray reference to the now-absent
SkSLSymbolAlias.h in sksl.gni.

This reverts commit f5853ff652.

Change-Id: I911d99de3dd98bc91a3bbfd9a52634dd51a660f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491816
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-06 15:43:10 +00:00
Robert Phillips
f5853ff652 Revert "Removed SkSL SymbolTable aliases"
This reverts commit 84d6cf9b5b.

Reason for revert: Blocking Chrome roll

Original change's description:
> Removed SkSL SymbolTable aliases
>
> Now that we have first class Type aliases, we no longer need this
> obsolete SymbolTable mechanism.
>
> Change-Id: Ibfb21ed153d1cbca59679659254e4d58d18f5c7c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491441
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Change-Id: Ie4aadf49d83af2ad4a4e09061e92d27a4610d8fe
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491696
Auto-Submit: Robert Phillips <robertphillips@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-01-06 13:18:13 +00:00
Ethan Nicholas
eb12454f57 Re-added SkSL REHYDRATE flag
The REHYDRATE flag was removed at some point, but it was a useful means
of temporarily disabling rehydration for debugging and the like.

Change-Id: I28f7fbaed6003f384509f5848e8bbf4f06697bc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491440
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-05 20:15:40 +00:00
Brian Osman
576de89810 Add support for multiple child nodes to SkImageFilters::RuntimeShader
Bug: skia:12766
Change-Id: I9dfe07a71961ab952c1593b9cc68c61191fbc13c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489536
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-01-05 20:07:00 +00:00
Ethan Nicholas
84d6cf9b5b Removed SkSL SymbolTable aliases
Now that we have first class Type aliases, we no longer need this
obsolete SymbolTable mechanism.

Change-Id: Ibfb21ed153d1cbca59679659254e4d58d18f5c7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491441
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-05 18:59:14 +00:00
Herb Derby
44e712a6a9 simplify drawingType calculation
Simplify determining which method used to draw text. This will make
inlining it into the processGlyphRun code easier.

Bug: chromium:1280180

Change-Id: I69241a9c198904334c012ab301e80d0cf9fd45d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491437
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-05 18:05:54 +00:00
Ethan Nicholas
f393067c37 Made SkSL type aliases into first-class objects
Previously, type aliases ('vec2') were just an additional name which
could be used to refer to a type ('float2'). This was simple and worked,
except that error messages would be wrong - any type-related error
message would refer to the type as 'float2' rather than the 'vec2' that
the user actually typed.

This CL adds an AliasType class so that we can track which name was
used to refer to an aliased type and report messages using the correct
type name.

Bug: skia:12737

Change-Id: I40e234239ab47557033e0695e4fbbd5f01da354e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490256
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-05 16:20:19 +00:00
Herb Derby
61d0fbbca7 inline drawingType facilitating future refactoring
Inline the control back into this code to facilitate future refactoring
to make size calculation more precise.

Bug: chromium: 1280180

Change-Id: If66174ab1d28571a7b84d4ab4bd7fa09ce86c3af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491043
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-04 18:16:49 +00:00
Brian Salomon
c29454d1c9 Allow custom mesh to use positions for local coordinates.
This will make it possible for drawVertices and drawCustomMesh to share
implementation in Ganesh.

Bug: skia:12720
Change-Id: I8b84119a29b47071ef389879bb5287873629ed3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487978
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-04 18:01:47 +00:00
Brian Osman
735ff421bb Reject #extension in runtime-effect mode
Bug: oss-fuzz:43062
Change-Id: I10d8fa40c81c5b1595d30221d89c84f5cc3478fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490857
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-04 16:12:50 +00:00
Ethan Nicholas
c4b95b2dbe Renamed SkSLType operator== to 'matches'
This change is in anticipation of a followup CL which adds formal type
aliases. operator=='s behavior in the face of aliases would not be
obvious (does float4 == vec4?), whereas hopefully it is unsurprising
that float4.matches(vec4).

Change-Id: I23ad732a9a9084883a55be4e1d6f3529d567de89
Bug: skia:12737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489921
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-04 15:31:15 +00:00
Brian Salomon
5726d457cf Allow inlining of custom mesh code.
Also remove unnecessary scope block when using shared compiler.

Bug: skia:12720
Change-Id: I67f9579fbd273d5b5102b25576a2721ad9ef01df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490116
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-04 14:48:23 +00:00
Leon Scroggins III
13f244c95c Add more debugging info for backend texture failure
Print out information regarding the GrBackendTexture, along with the max
render target size, when we crash.

Add another crash in another file which may be responsible for the
failure.

Consolidate RENDERENGINE_ABORTF into a header file so it can be shared.

Bug: b/206415266
Change-Id: I2cceb847bc913a43c5341a26558e74ac13cc7b7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490277
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2021-12-30 22:30:27 +00:00
John Stiles
65aae8a51a Disable SkSL optimization when SkRuntimeEffect::MakeTraced is called.
SkRuntimeEffect::MakeForXxxxx compiles its shaders before MakeTraced()
is invoked, with optimizations enabled. When MakeTraced() is called,
we recompile the shader with optimizations disabled; this allows us to
present the user with a shader that is as close to the original as
possible. (This obviously costs time, but debug trace generation isn't
focused on speed.)

Note that in some rare instances, disabling optimizations can cause
compilation to fail (e.g. optimization can simplify control flow and
eliminate "unreachable" paths). In those cases, we fall back to the
existing behavior of debugging an optimized shader.

Change-Id: Iba0f31bc42374c7048694fde5415b122177a9a68
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489716
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-29 18:54:19 +00:00
John Stiles
d67f1f8f50 Provide bit-casted slot values from DebugTracePlayer.
Previously, the VariableData returned from a DebugTracePlayer contained
values in an int32_t, regardless of the slot's NumberKind. We had a
helper function which could stringize the bits, but otherwise the caller
was responsible for bit-casting the value manually.

Now, the DebugTracePlayer will automatically manage bit-casting for the
caller. The value returned in the VariableData is now a double (so it
is able to store an int32, uint32, or float at full precision).

This change was inspired by the recent Typescript port. (The value in
the Typescript VariableData uses a compound `number | boolean` type, so
it is able to fully represent any slot value natively.)

Change-Id: I5eec414236f76ad0ff51b0b19974e4a0025c4d62
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489896
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-29 18:30:19 +00:00