Commit Graph

9036 Commits

Author SHA1 Message Date
John Stiles
5a956ce54b Add more dm tests for the comma operator.
Change-Id: I37a95fd95c23a91c3510f922bab0569093e612a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364604
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-03 01:28:48 +00:00
John Stiles
d842feea48 Avoid comma usage in Operators test.
This works around a GLSL compilation bug on the Tecno Spark 3 Pro.

Change-Id: I516bd64745a8e99cccc87ee4bb2e1f5d5b26c130
Bug: skia:11255
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364116
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-02 14:34:24 +00:00
John Stiles
931cad1d74 Update function-type-matching tests to work as Runtime Effects.
Previously, our only test was invoking `sin(1)` which is a pretty
ineffective test. Now, we test args and return types for all the basic
scalars/vectors/matrices.

Change-Id: I7d335303eef8b9c9c6cfef2265a15bbd9bd73e0c
Bug: skia:11246
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363943
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-02 13:47:35 +00:00
John Stiles
9fc9b87540 Add bool2/bool3/bool4 to GrSLType.
These are basic vector types, required by GLSL ES2, but we could not
create helper functions using them because they were missing from our
GrSLType enum. (This also prevented Runtime Effects from using these
types in helper functions.)

Change-Id: I78c328499e8ed90cb29c641b90ee59460a5a45de
Bug: skia:11246
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364036
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-02 00:25:29 +00:00
Mike Reed
9223665316 Guard legacy matrixtransforms, and expose new one
Bug: skia:11236
Bug: skia:11235
Change-Id: I53fc0532a6067c5b30fc0345ded95d50d9955d38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363098
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-02-01 22:10:39 +00:00
John Stiles
c068a8f00b Update various shared/ tests to run in dm.
These tests have updated to return green on success, or red on failure.
Some tests were modified slightly to conform to ES2 limitations, or
split into separate ES2 and ES3 parts.

Change-Id: Ib47aeca217aef33f3c4b5999d93afed5d42a1e62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363876
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-01 22:06:59 +00:00
Robert Phillips
fde740c7f2 Revert "Remove deprecated SkImageFilter::MakeMatrixFilter"
This reverts commit ed63d4f177.

Reason for revert: Breaking G3 roll?

Original change's description:
> Remove deprecated SkImageFilter::MakeMatrixFilter
>
> The equivalent functionality is available in
> include/effects/SkImageFilters.h via SkImageFilters::MatrixTransform.
>
> Bug: skia:11230
> Change-Id: I77b78d508d653a32c913a7599f1004ab634e3e6d
> Docs-Preview: https://skia.org/?cl=361497
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361497
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=reed@google.com,michaelludwig@google.com

Change-Id: I60a98a1ca9a42db6bfc5796cf4df69042571161e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11230
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364097
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-02-01 21:51:10 +00:00
Greg Daniel
5ad5a37784 Pass sk_sps through the GrGpu transferPixels* calls.
Currently non of the backends are directly holding ownership of the new
sk_sp, but in follow on CLs will start having the buffers be tracked
on the command buffer via these refs.

Bug: skia:11232
Change-Id: I894f1672868061636286569d999dbe97456342a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364016
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-02-01 21:46:28 +00:00
Brian Osman
21d2b6a651 Use unsigned values when constant-folding integer vectors
We already had this trick for scalar integers, this extends it to
integer vectors. As with prior work in this area, it would be better to
detect this case and produce an error, but now we at least produce
consistent and well-defined results (rather than undefined signed
integer overflow).

Bug: skia:10932
Bug: oss-fuzz:29494
Change-Id: I45526fe96b6ea42c0e88b9862f6961b316810321
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363962
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-01 21:44:28 +00:00
Brian Salomon
c24c8ef7fc Consistently fail readPixels when rowbytes not a multiple of bpp
Previously this would report success but may have rounded the
rowbytes down to a multiple of bpp prior to writing the dst.
On GPU it could trigger an assert in a debug build.

Bug: chromium:1163061
Change-Id: I19709f4cdb71139732998a4dd2e14476099f0ba8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363782
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-02-01 21:31:58 +00:00
Brian Salomon
490f192c22 Reland "Remove SkImage_Base::refPinnedImage(), use refView() instead."
This reverts commit 864465765b.

Reason for revert: fix: check tiling before call refView()

Original change's description:
> Revert "Remove SkImage_Base::refPinnedImage(), use refView() instead."
>
> This reverts commit 9f899ac9ed.
>
> Reason for revert: broke ios bot?
>
> Original change's description:
> > Remove SkImage_Base::refPinnedImage(), use refView() instead.
> >
> > Also use refView() for lazy/raster images as well rather than creating
> > a GrTextureProducer class outside the image.
> >
> > Bug: skia:11208
> >
> > Change-Id: Iee628c337bc1b4cfcccd78eaba98589757bb55ab
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360980
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: Iab4851f5cefdca853e16c030ec67238c55c69aa2
> Cq-Include-Trybots: luci.skia.skia.primary:Test-iOS-Clang-iPhone6-GPU-PowerVRGX6450-arm64-Release-All-Metal
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361838
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: Ib0405bd99a3875a40f6f75b9e785e073ba48605d
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362036
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-02-01 21:06:26 +00:00
Michael Ludwig
ed63d4f177 Remove deprecated SkImageFilter::MakeMatrixFilter
The equivalent functionality is available in
include/effects/SkImageFilters.h via SkImageFilters::MatrixTransform.

Bug: skia:11230
Change-Id: I77b78d508d653a32c913a7599f1004ab634e3e6d
Docs-Preview: https://skia.org/?cl=361497
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361497
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-02-01 18:48:28 +00:00
Mike Reed
543266aaa0 Simplify isconvex
Trying to make its results scale-independent. Otherwise we can propagate
convexity in path.transform() but (if measured) actually have a
different result.


Bug: skia:11227
Change-Id: I874597a58c8c4d670e9d4a357a6a92b60a164291
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360597
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-02-01 18:28:09 +00:00
John Stiles
2ff8f86205 Run the SkSL Operators test as a Runtime Effect.
The test has been split into an ES2 version and ES3 version; the ES2
side omits unsupported integer ops like << >> & | ^ %.

Change-Id: Iba16d469a477809b17a823b1c68ae8937624c68e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362616
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-01 17:21:33 +00:00
John Stiles
94e72b90b8 Add test to verify side effects from the comma operator.
SkVMCodeGenerator was lacking support for the comma operator entirely;
this has now been implemented.

Change-Id: I9350f54e6ee52764c620116e6dbfe4ca3e9cd47e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363096
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-01 16:16:58 +00:00
Brian Salomon
759217eb94 Reland "Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes."
This is a reland of 07d8c0d11c

Original change's description:
> Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes.
>
> Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
> copy the src data to a pixmap with tight row bytes.
>
> Bug: chromium:1170392
>
> Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:1170392
Change-Id: I6fb759c35f86d816b16694b00edaa1116a446d15
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363099
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-31 19:34:51 +00:00
Mike Klein
0928963d9d Revert "Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes."
This reverts commit 07d8c0d11c.

Reason for revert: Looks like failures on PowerVR?  (Test-Android-Clang-TecnoSpark3Pro-GPU-PowerVRGE8320-arm-Release-All-Android)

Original change's description:
> Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes.
>
> Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
> copy the src data to a pixmap with tight row bytes.
>
> Bug: chromium:1170392
>
> Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: Ie5791bf19b993d46383c5b837b948584487c0496
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1170392
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363037
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-30 17:44:50 +00:00
Mike Reed
1de89c48c3 Don't use filter-quality
Bug: skia:11235
Change-Id: I184402f1c9d0f707ccfce761e3c5dbc3084e6c14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362837
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-30 16:09:23 +00:00
Mike Klein
6eee6b2736 Revert "Add intrinsic tests for mod() and fract()."
This reverts commit f06aeedcf1.

Reason for revert: fract failing on Tegra3

Original change's description:
> Add intrinsic tests for mod() and fract().
>
> These are fully supported by ES2 and will be covered by dm tests.
>
> Change-Id: Iebf4effe8ab928662b55c0bb5b09e8b2a61487ca
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362460
> Commit-Queue: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: Ib2071c90addd01e3b299553e020950a89eb01e4d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363036
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-30 13:38:31 +00:00
John Stiles
f06aeedcf1 Add intrinsic tests for mod() and fract().
These are fully supported by ES2 and will be covered by dm tests.

Change-Id: Iebf4effe8ab928662b55c0bb5b09e8b2a61487ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362460
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-01-29 21:51:54 +00:00
Brian Salomon
07d8c0d11c Make GrDirectContext::updateBackendTexture handle pixmaps with non-type row bytes.
Some GL contexts don't support GL_UNPACK_ROW_LENGTH and we must
copy the src data to a pixmap with tight row bytes.

Bug: chromium:1170392

Change-Id: I4590f20dbc80cb792f30f0059536716cf106f6c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361717
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-29 19:11:18 +00:00
Mike Reed
99da77ae93 Pass sampling to drawImage
Bug: skia:7650
Change-Id: Ia0e02023ab65267e0be17ee1509c8562fe55d75a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362180
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-29 18:53:48 +00:00
John Stiles
9c9f60cdb4 Implement additional Runtime Effect intrinsic tests.
Tested in dm:
- max(halfN, halfN)
- max(halfN, half)
- min(halfN, halfN)
- min(halfN, half)
- clamp(halfN, halfN, halfN)
- clamp(halfN, half, half)
- mix(halfN, halfN, halfN)
- mix(halfN, halfN, half)

Compiled outputs only (not in ES2):
- max(intN, intN)
- max(intN, int)
- min(intN, intN)
- min(intN, int)
- clamp(intN, intN, intN)
- clamp(intN, int, int)
- mix(halfN, halfN, boolN)  - broken in Metal/SPIR-V (skia:11222)
- mix(intN, intN, boolN)    - broken in Metal/SPIR-V (skia:11222)

Change-Id: Iaafc5429b16d2a8710b9d171ae281c268c0fd70d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361438
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 18:23:48 +00:00
John Stiles
e1658b5977 Reland "Add some SkSL intrinsics to our dm tests."
This reverts commit b576168c8c.

Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures

Original change's description:
> Revert "Add some SkSL intrinsics to our dm tests."
>
> This reverts commit 0492a744a5.
>
> Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test.
>
> Original change's description:
> > Add some SkSL intrinsics to our dm tests.
> >
> > This CL adds dm coverage for:
> > - abs(half)
> > - sign(half)
> > - floor
> > - ceil
> >
> > And creates test output for abs(int) and sign(int); these aren't covered
> > by dm because they don't exist in ES2 and so are unsupported by Runtime
> > Effects.
> >
> > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 17:58:18 +00:00
Mike Reed
0ab283aaf2 Revert "Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag"
This reverts commit 5817fe1069.

Reason for revert: broke GifTest

Original change's description:
> Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag
>
> Bug: skia:7650
> Change-Id: I7924efdbbb957c0453c5444796dc31f0b0f7459b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361437
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

TBR=kjlubick@google.com,reed@google.com

Change-Id: I1e6dc844b8780b332ef94234bed2e8fbdf60f8cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7650
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362179
Reviewed-by: Mike Reed <reed@google.com>
2021-01-29 17:25:45 +00:00
Mike Reed
5817fe1069 Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag
Bug: skia:7650
Change-Id: I7924efdbbb957c0453c5444796dc31f0b0f7459b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361437
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-01-29 17:06:48 +00:00
John Stiles
e40d166477 Reland "Add support for top-level uniforms in SPIR-V."
This reverts commit 0de76f72cd.

Reason for revert: fixes ASAN use-after-scope-end issue

Original change's description:
> Revert "Add support for top-level uniforms in SPIR-V."
>
> This reverts commit acba30420c.
>
> Reason for revert: ASAN breakage on tree for
> Perf-Win2019-Clang-GCE-CPU-AVX2-x86_64-(Debug|Release)-All-ASAN
>
>  Address 0x009af69fda78 is located in stack of thread T0 at offset 1272 in frame
>      #0 0x7ff75c069ddf in _asan_wrap_RtlReAllocateHeap+0x44014f (c:\b\s\w\ir\build\nanobench.exe+0x1413a9ddf)
>    This frame has 35 object(s):
>      [32, 104) 'body' (line 3363)
>      [144, 152) 'main' (line 3365)
>      [176, 184) 'ref.tmp' (line 3366)
>      [208, 240) '__begin1' (line 3366)
>      [272, 304) '__end1' (line 3366)
>      [336, 344) 'ref.tmp27' (line 3370)
>      [368, 384) 'ref.tmp31' (line 3371)
>      [400, 416) 'interfaceVars' (line 3382)
>      [432, 440) 'ref.tmp48' (line 3383)
>      [464, 496) '__begin151' (line 3383)
>      [528, 560) '__end154' (line 3383)
>      [592, 596) 'id' (line 3386)
>      [608, 624) 'tmp' (line 3393)
>      [640, 648) 'ref.tmp114' (line 3398)
>      [672, 704) '__begin1117' (line 3398)
>      [736, 768) '__end1120' (line 3398)
>      [800, 1008) 'uniformBuffer' (line 3405)
>      [1072, 1280) 'ref.tmp159' (line 3407) <== Memory access at offset 1272 is inside this variable
>      [1344, 1360) 'agg.tmp'
>      [1376, 1576) 'adapter' (line 3411)
>      [1648, 1848) 'ref.tmp179' (line 3413)
>      [1920, 1928) 'ref.tmp191' (line 3415)
>      [1952, 1960) 'ref.tmp210' (line 3421)
>      [1984, 2016) '__begin1213' (line 3421)
>      [2048, 2080) '__end1216' (line 3421)
>      [2112, 2120) '__begin1242' (line 3427)
>      [2144, 2152) '__end1247' (line 3427)
>      [2176, 2192) 'entry256' (line 3427)
>      [2208, 2224) 'tmp298' (line 3433)
>      [2240, 2256) 'agg.tmp307'
>      [2272, 2280) '__begin1365' (line 3457)
>      [2304, 2312) 'ref.tmp415' (line 3469)
>      [2336, 2368) '__begin1418' (line 3469)
>      [2400, 2432) '__end1421' (line 3469)
>      [2464, 2480) 'agg.tmp436'
>
> Original change's description:
> > Add support for top-level uniforms in SPIR-V.
> >
> > Previously, a uniform not wrapped in an interface block would report a
> > SPIR-V error:
> >
> > "Variables identified with the Uniform storage class are
> > used to access transparent buffer backed resources. Such variables must
> > be typed as OpTypeStruct, or an array of this type..."
> >
> > Now, the SPIR-V code generator automatically detects such global
> > variables and synthesizes a struct named _UniformBuffer to hold them.
> > When these variables are accessed, an OpAccessChain instruction is added
> > to grab the variable out of the struct.
> >
> > Change-Id: I5e852d4de01b866c291506cc8cf6eb547f097d66
> > Bug: skia:11225
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360776
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: Ib72e33dbd662a245c20bc9d45d1397454c9588a3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11225
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362057
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Bug: skia:11225
Change-Id: I10501c30a701301f6487ea154047ad1c1d0e8c70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362076
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:12:03 +00:00
John Stiles
0de76f72cd Revert "Add support for top-level uniforms in SPIR-V."
This reverts commit acba30420c.

Reason for revert: ASAN breakage on tree for
Perf-Win2019-Clang-GCE-CPU-AVX2-x86_64-(Debug|Release)-All-ASAN

 Address 0x009af69fda78 is located in stack of thread T0 at offset 1272 in frame
     #0 0x7ff75c069ddf in _asan_wrap_RtlReAllocateHeap+0x44014f (c:\b\s\w\ir\build\nanobench.exe+0x1413a9ddf)
   This frame has 35 object(s):
     [32, 104) 'body' (line 3363)
     [144, 152) 'main' (line 3365)
     [176, 184) 'ref.tmp' (line 3366)
     [208, 240) '__begin1' (line 3366)
     [272, 304) '__end1' (line 3366)
     [336, 344) 'ref.tmp27' (line 3370)
     [368, 384) 'ref.tmp31' (line 3371)
     [400, 416) 'interfaceVars' (line 3382)
     [432, 440) 'ref.tmp48' (line 3383)
     [464, 496) '__begin151' (line 3383)
     [528, 560) '__end154' (line 3383)
     [592, 596) 'id' (line 3386)
     [608, 624) 'tmp' (line 3393)
     [640, 648) 'ref.tmp114' (line 3398)
     [672, 704) '__begin1117' (line 3398)
     [736, 768) '__end1120' (line 3398)
     [800, 1008) 'uniformBuffer' (line 3405)
     [1072, 1280) 'ref.tmp159' (line 3407) <== Memory access at offset 1272 is inside this variable
     [1344, 1360) 'agg.tmp'
     [1376, 1576) 'adapter' (line 3411)
     [1648, 1848) 'ref.tmp179' (line 3413)
     [1920, 1928) 'ref.tmp191' (line 3415)
     [1952, 1960) 'ref.tmp210' (line 3421)
     [1984, 2016) '__begin1213' (line 3421)
     [2048, 2080) '__end1216' (line 3421)
     [2112, 2120) '__begin1242' (line 3427)
     [2144, 2152) '__end1247' (line 3427)
     [2176, 2192) 'entry256' (line 3427)
     [2208, 2224) 'tmp298' (line 3433)
     [2240, 2256) 'agg.tmp307'
     [2272, 2280) '__begin1365' (line 3457)
     [2304, 2312) 'ref.tmp415' (line 3469)
     [2336, 2368) '__begin1418' (line 3469)
     [2400, 2432) '__end1421' (line 3469)
     [2464, 2480) 'agg.tmp436'

Original change's description:
> Add support for top-level uniforms in SPIR-V.
>
> Previously, a uniform not wrapped in an interface block would report a
> SPIR-V error:
>
> "Variables identified with the Uniform storage class are
> used to access transparent buffer backed resources. Such variables must
> be typed as OpTypeStruct, or an array of this type..."
>
> Now, the SPIR-V code generator automatically detects such global
> variables and synthesizes a struct named _UniformBuffer to hold them.
> When these variables are accessed, an OpAccessChain instruction is added
> to grab the variable out of the struct.
>
> Change-Id: I5e852d4de01b866c291506cc8cf6eb547f097d66
> Bug: skia:11225
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360776
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: Ib72e33dbd662a245c20bc9d45d1397454c9588a3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11225
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362057
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 14:20:16 +00:00
John Stiles
b576168c8c Revert "Add some SkSL intrinsics to our dm tests."
This reverts commit 0492a744a5.

Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test.

Original change's description:
> Add some SkSL intrinsics to our dm tests.
>
> This CL adds dm coverage for:
> - abs(half)
> - sign(half)
> - floor
> - ceil
>
> And creates test output for abs(int) and sign(int); these aren't covered
> by dm because they don't exist in ES2 and so are unsupported by Runtime
> Effects.
>
> Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-01-29 14:03:36 +00:00
Adlai Holler
b5dda505cb Fix write-after-read in clustering
This fixes the `discard` gm that demonstrates the write-after-read.

Bug: skia:10877
Change-Id: I631b7626a47d046bb5f842e997f50dfec50649b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360606
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2021-01-28 22:46:00 +00:00
John Stiles
0492a744a5 Add some SkSL intrinsics to our dm tests.
This CL adds dm coverage for:
- abs(half)
- sign(half)
- floor
- ceil

And creates test output for abs(int) and sign(int); these aren't covered
by dm because they don't exist in ES2 and so are unsupported by Runtime
Effects.

Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-28 21:20:00 +00:00
John Stiles
acba30420c Add support for top-level uniforms in SPIR-V.
Previously, a uniform not wrapped in an interface block would report a
SPIR-V error:

"Variables identified with the Uniform storage class are
used to access transparent buffer backed resources. Such variables must
be typed as OpTypeStruct, or an array of this type..."

Now, the SPIR-V code generator automatically detects such global
variables and synthesizes a struct named _UniformBuffer to hold them.
When these variables are accessed, an OpAccessChain instruction is added
to grab the variable out of the struct.

Change-Id: I5e852d4de01b866c291506cc8cf6eb547f097d66
Bug: skia:11225
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360776
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-28 21:19:26 +00:00
Brian Osman
02bc52284d Emit top-level StructDefinition for every struct
Previously, structs that were defined as part of a variable declaration
would end up declared similarly in the generated code. Now, global
variable declarations that include a struct definition generate two
separate program elements.

Bug: skia:11228
Change-Id: Id7ddde6931fe07a250c2c9c46153879005535fb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361359
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-28 19:50:09 +00:00
Mike Reed
98afb4f368 drawBitmap is deprecated
Change-Id: I0720bb18065e0bce2416c5adef4866064485ff7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361517
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-28 19:37:45 +00:00
John Stiles
da5cdf6a70 Add default uniform binding value for Metal/SPIR-V.
This allows interface blocks in Metal to compile even if
`layout(binding=...)` is not specified. It will also be used in SPIR-V
in the followup CL, when an interface block is automatically synthesized
for top-level uniforms.

This CL also reorganizes the unit tests around uniforms a bit.

Change-Id: Ia898c536b454dda6f51677e232a8f6e6c3606022
Bug: skia:11225
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360778
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-28 19:23:49 +00:00
Mike Reed
993e92dc31 Update bad_bitmap test
Change-Id: I1b4bcb3aff254099e8aa3467bbe38662107db834
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361357
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-28 17:10:19 +00:00
Brian Osman
bf7b4b8890 Add SkSL test for functions that operate on structs
This is a known deficiency of runtime effects, next step is to fix how
they manage function signatures to solve the problem.

Bug: skia:10939
Change-Id: Id934e0acdf774b03bd6edce78d7b2c077bdeae00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360603
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-28 17:01:59 +00:00
Brian Osman
00fea5b41f Remove ASTNode::TypeData
Pre-cleanup as I start looking at how structs are parsed and handled in
the IR.

Bug: skia:11228
Change-Id: I6334d1073211cbbdf69ddffa8df420c45fd59fcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361059
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-28 16:56:59 +00:00
Ethan Nicholas
1ff760981d Added SkSL DSLFunction
Change-Id: Ibc995e908e5b4f8d1516e13d56854a4fcf5cc809
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360556
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-28 16:13:19 +00:00
Mike Reed
039f1367ae filter-quality is deprecated, pass sampling to drawImage
Bug: skia:7650
Change-Id: Ifd92705bd042db74a6c2527858239b0b8e5a4def
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360981
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-28 03:22:51 +00:00
Chris Dalton
330cfa44ac Make GrTriangulator immutable
Marks its methods const and lifts the breadcrumb list out into
function arguments. This is one more step toward the final vision
where GrTriangulator just has an allocator and control knobs, and
everything else is functional.

Bug: skia:10419
Change-Id: I77341c045d481da49ebfee06de5dfc7a2a8a07be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360956
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-01-28 02:38:51 +00:00
Michael Ludwig
ed552f8702 Move deprecated image filter headers out of include/ and into src/
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>
2021-01-28 00:41:21 +00:00
Adlai Holler
9a77795a56 Update mock render task & cluster test
Switch away from views, and add support for simulating
used-proxies. The latter will be used in an upcoming CL.

Bug: skia:10877
Change-Id: I7897516dc53c075a286cce8f31075d8cc93abccf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360604
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-01-27 22:37:20 +00:00
Mike Klein
f988bb53d0 add single-lane ld2.4s and ld4.4s
These have a kind of neat way of encoding the lane index, using the Q
bit to pick the lower or upper 64 bits of the register, then the S bit
to pick the 32-bit lane within those 64 bits.  Usually Q=1 distinguishes
a 128-bit op from a Q=0 64-bit op, so its repurposing here is at first
surprising, but actually very fitting.

I'd eventually like load64/128 to use these like this:

    Reg tmp0 = alloc_tmp(2),
        tmp1 = (Reg)(tmp0+1);

    if (scalar) { a->ld24s(tmp0, arg[immA], 0); }
    else        { a->ld24s(tmp0, arg[immA]   ); }

    mark_tmp_as_dst(tmp0, tmp1);

where the mechanism to track up to four registers per value and
implement mark_tmp_as_dst(...) for more than one argument is what I'm
still working on.

Change-Id: I944e571de19f65d41f462406ce35f0f2a35bb381
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360700
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-27 21:38:40 +00:00
Brian Salomon
9e8e2aa9c3 Remove SkImage_GpuBase::getTexture().
Part of effort to consolidate access to GPU SkImage texture proxies.

Bug: skia:11208
Change-Id: Icfcf6fea6be6f05220a5ddd1482f88dafe1cbd9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359836
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-01-27 19:19:20 +00:00
Brian Osman
21f570769e Fix complex lvalues in SkSL-to-SkVM
The old code only handled swizzles as the outermost expression(s) in an
lvalue. The new code removes that restriction, and puts all the logic in
writeStore, which is the only place it needs to exist.

The newly added test asserted before, and now passes.

Bug: skia:11178
Change-Id: I8083d9d478ad4dc993cb963d34a97c10965831b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358956
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-27 16:51:20 +00:00
Brian Salomon
7d2757fc6d Implement SkImage::hasMipmaps() for GPU images
Step towards consolidating texture-backed SkImage proxy access.

Bug: skia:11208
Bug: skia:9570
Bug: skia:10411

Change-Id: Ica18a61bf59e6977addf58a9b4522859bc467ca2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359917
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-01-27 16:40:19 +00:00
John Stiles
7b92897d62 Reland "Add SkSL for-loop control flow test to dm."
This reverts commit 578f1acbe8.

Reason for revert: updated test to pass on Mac Intel 5100/6000

Original change's description:
> Revert "Add SkSL for-loop control flow test to dm."
>
> This reverts commit a0c266283a.
>
> Reason for revert: failing on Mac Intel
>
> Original change's description:
> > Add SkSL for-loop control flow test to dm.
> >
> > While loops and do-while loops remain untested in dm, as they are not
> > supported in ES2 (and therefore not available in Runtime Effects).
> >
> > Change-Id: I2f1bfccccd571cc4ced096bc18ebbb9ecc9f9b4a
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359556
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I45335d16a695644eaeb8a535298c0efcc616c1ce
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359840
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I2dc6e870393708a12286658001b723f25a6aec4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359856
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-27 15:46:39 +00:00
Ethan Nicholas
d6b26e5f06 added DSL Modifiers
Change-Id: Ie1b0b8068b487905691b20e318c7898653763a25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359757
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-27 14:28:29 +00:00
Brian Osman
fa71ffaedb Reland "Fix field access and indexing of complex expressions"
Evaluating either kind of expression now works like all other
expressions - evaluate the inner part, then work with the resulting
values. Added unit tests for both of these that previously failed.

With this change, writeVariableExpression is only used for
VariableReference expressions, so adjust that, too.

Reland now safe, after fix to Value::operator[]

This reverts commit 1ea6d6051e.

Bug: skia:11178
Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker
Change-Id: I14782fcdfef33a47a46334447c5847976721b21f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359564
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-27 14:05:39 +00:00