The no-op-arithmetic simplifier was written before we allowed casting a
mat2x2 to a float4, and did not expect a matrix inside a vector ctor.
The expression `float4(myMat2) * float4(anything)` would assert when we
tried to determine if `myMat2` was a constant zero or constant one.
The code has been rewritten to use getConstantSubexpression and now
allows matrices inside.
Change-Id: Id625141256bf89d816c57d2d21f16b0ec252c158
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440858
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Previously, it was assumed that the return type from any evaluated
intrinsic would be the same as the input type. This isn't always true;
in particular, this assumption doesn't hold true for the
`floatBitsToInt` family of intrinsics.
We did have the actual return type all along, but we weren't passing it
through to the evaluation helper functions until now.
Change-Id: Idee2bdfc548abd85461a13cdb7594a173b2d551c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440857
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This CL just moves the files and renames them. It doesn't move them into the skgpu::v1 namespace.
Bug: skia:11837
Change-Id: Iab322d0dc5b5d1cfd32436785081539dc85c18d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440776
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Acrobat Reader (and no other viewer) appears to have issues applying the
default advances of at least some Type3 fonts. After emitting a glyph
from a Type3 font mark the calculated position after applying the
advance as uncertain, forcing the next emitted glyph to be fully
positioned.
Bug: chromium:1226960
Change-Id: I4008a7ba388e981ba5abbe3aa6fb6cc0c14a0855
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439281
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This is a reland of a209ba17a1
Original change's description:
> Metal: update to using MTLGPUFamily for caps checks.
>
> MTLGPUFamily provides a cleaner interface, and allows us to detect
> Apple Silicon on Macs. MTLFeatureSet has been deprecated in newer OSes,
> but we fall back to it and programmatically set up the GPU family if
> running on an older OS.
>
> Also removes related code from GrMtlGpu and encapsulates it all in
> GrMtlCaps.
>
> Bug: skia:12086
> Change-Id: Ieb54bf2aca845ea809e86ccc72f34ef2211e1cfb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440517
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
Bug: skia:12086
Change-Id: If024803710fb3658420e1b18be3abbf285eef9bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440544
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reusing existing code should be smaller than implementing the same logic
in two different places (and two different ways).
Change-Id: I5ee7768c46d6c28ac163404e9efaf99441bba504
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440717
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This allows us to avoid constructing temporary string copies just to do
a lookup in the intrinsic map.
Change-Id: Id5a5f7640cdfa3ece8a6f08a7a3623c1aeb717b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440716
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
The prototype has been added sksl_public, compile-time optimization is
implemented, and test code has been improved.
Change-Id: I536d6bd7fcae437a03744941b008940bf2a3b1c1
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440524
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
These were declared as inline functions outside of the GrTest namespace
for some reason, but they are only used in test code and there doesn't
seem to be any reason for putting them in the header. (It doesn't seem
like they would benefit from being inlined.)
Change-Id: I4ba831168a0220d2eb550e08600159ba68220848
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440519
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This is more useful than a boolean true/false result. A zero return
value can be interpreted the same as a false result (non-invertible).
This will be used in a followup to implement compile-time optimization
of determinants.
Change-Id: I8ccb8c97096cdbceec2d1a47c95fe380fc6f3297
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440523
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Having this enum on GrTessellationPathRenderer forced it to be over-#included and was blocking making GrTessellationPathRenderer.h v1-only.
Bug: skia:11837
Change-Id: I80660ed659946d7aa555057c9f4fd1136b44cca0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440536
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This one slips past older versions of LLVM for some reason.
Change-Id: I86792b7fc9f66be6e40ed9f480f8750169b36bbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440522
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit a209ba17a1.
Reason for revert: Flutter roll.
Original change's description:
> Metal: update to using MTLGPUFamily for caps checks.
>
> MTLGPUFamily provides a cleaner interface, and allows us to detect
> Apple Silicon on Macs. MTLFeatureSet has been deprecated in newer OSes,
> but we fall back to it and programmatically set up the GPU family if
> running on an older OS.
>
> Also removes related code from GrMtlGpu and encapsulates it all in
> GrMtlCaps.
>
> Bug: skia:12086
> Change-Id: Ieb54bf2aca845ea809e86ccc72f34ef2211e1cfb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440517
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=jvanverth@google.com,bsalomon@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
Change-Id: I691f05bf58a386b4296fb5abed155d7852c57ada
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12086
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440543
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 69ae22db48.
Reason for revert: Flutter roll.
Original change's description:
> Remove maccatalyst available check.
>
> It's not strictly necessary and causes compile issues on early versions
> of Xcode 12.
>
> Change-Id: I39b0b25184bdeb978a31bbede59283b0836751c2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440521
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
TBR=jvanverth@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
Change-Id: Iac537784aaa4135b49b01dbc22e0936919ae222c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440542
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 282af12ae0.
draw_shader now has a `allowRasterFallback` option and returns an empty
bitmap if no surface can be made.
Original change's description:
> Revert "Add GM slide for ES3 trig intrinsics."
>
> This reverts commit 3cb09c0904.
>
> Reason for revert: Windows ANGLE can fall back to software
>
> Original change's description:
> > Add GM slide for ES3 trig intrinsics.
> >
> > Unlike the other Runtime Effects slides, this only works on GPU, as
> > the ES3 intrinsics aren't implemented in SkVM (today).
> >
> > Change-Id: Icf59e4ed7c1e89aa7b730b43c2fd0fa45d61e71a
> > Bug: skia:12202, skia:12352
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439777
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> TBR=brianosman@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ica2f7af9e479e5cf96603583c6803b646b8dcb4b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:12202, skia:12352
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440558
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:12202, skia:12352
Change-Id: I774635a8b1e526af0be3b68f771496f1cedce13a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440559
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
It's not strictly necessary and causes compile issues on early versions
of Xcode 12.
Change-Id: I39b0b25184bdeb978a31bbede59283b0836751c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440521
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
When compiling test shaders, we were setting SK_FRAGCOORD_BUILTIN on the
`coords` parameter to main() instead of SK_MAIN_COORDS_BUILTIN. These
two built-ins don't have the same type (float2 vs. float4) and don't
mean quite the same thing.
The SPIR-V code generator saw a variable with the SK_FRAGCOORD_BUILTIN
builtin value and assumed the presence of a global variable named
`sk_FragCoord`, which didn't exist (because it was never referenced in
the code, so it was never cloned in from the sksl_frag module).
This is only a concern when compiling test shaders with skslc; real
shaders don't hit these code paths. The generated code here is still
imperfect; if you look closely, you'll see the GLSL and Metal code is
referencing the `coords` variable but it's never declared anywhere.
Change-Id: I3ad249469927ff35eb1e75d6536f95317502708f
Bug: skia:12340
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440520
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Encapsulate the cpu gaussian blur as a class. This will allow further blur
strategies in the future.
Bug = skia:12338
Change-Id: I846571787e6600832a412ca1753c02c9b760e18c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440556
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This reverts commit 3cb09c0904.
Reason for revert: Windows ANGLE can fall back to software
Original change's description:
> Add GM slide for ES3 trig intrinsics.
>
> Unlike the other Runtime Effects slides, this only works on GPU, as
> the ES3 intrinsics aren't implemented in SkVM (today).
>
> Change-Id: Icf59e4ed7c1e89aa7b730b43c2fd0fa45d61e71a
> Bug: skia:12202, skia:12352
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439777
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
Change-Id: Ica2f7af9e479e5cf96603583c6803b646b8dcb4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12202, skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440558
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
MTLGPUFamily provides a cleaner interface, and allows us to detect
Apple Silicon on Macs. MTLFeatureSet has been deprecated in newer OSes,
but we fall back to it and programmatically set up the GPU family if
running on an older OS.
Also removes related code from GrMtlGpu and encapsulates it all in
GrMtlCaps.
Bug: skia:12086
Change-Id: Ieb54bf2aca845ea809e86ccc72f34ef2211e1cfb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440517
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This lets us set the minimum bar for SkSL ES3 support in one place,
rather than checking this set of bits in multiple spots.
Change-Id: Icba58d8b6a93626ce2ffbe3c4b846cad4749cab5
Bug: skia:12347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440518
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Unlike the other Runtime Effects slides, this only works on GPU, as
the ES3 intrinsics aren't implemented in SkVM (today).
Change-Id: Icf59e4ed7c1e89aa7b730b43c2fd0fa45d61e71a
Bug: skia:12202, skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439777
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This was previously a bit unclear, as ES2 supports the `intN` types but
had `integerSupport` returning false.
Change-Id: I148a00c70f7d251641c0571ab4c311ae974cd43d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440516
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:11837
Change-Id: I6aee4b5fcdb39a669f1ce9adb143b4562c206e57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440263
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12353
Change-Id: Ia4685f3f5e9e636d9b3b602140d23db6e375929c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440459
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
This centralizes the new color-space parsing into SkCommandLineConfig,
and then wires that up in DM, nanobench, and skpbench. It also removes
all of the old config names that encoded both color type and space.
Change-Id: I9a63a97f1d153e7636a1fb974cc4071f5ada3184
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438377
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:11837
Change-Id: I42dfaf795ec6afe9d648b0715457a3a38ef8c7a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439943
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Change-Id: I9ddb80b8886827250e243dc9174bb3679e70df9b
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440262
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit 03f17cd210.
Reason for revert: original CL modified 'filter', which was actually
the aggregate requested filter level (and 'netFilter' represented the
optimal filter up to a certain point). Once 'filter' was modified for
a quad, all subsequent entries in the batch would start with the wrong
filter (even if they should have remained bilerp).
Original change's description:
> Revert "Correctly downgrade per-entry filter/mm local variables"
>
> This reverts commit 628c91302d.
>
> Reason for revert: causing layout test failures?
>
> Original change's description:
> > Correctly downgrade per-entry filter/mm local variables
> >
> > If skia-renderer submitted a non-AA pixel-aligned rect with local coords
> > and identical texture domain, but with filter = bilerp, the batch
> > ctor would correctly identify that the netFilter could be dropped to NN,
> > but never updated the filter local var. Later, this value is used to
> > decide if the domain/subset is necessary and since it erroneously thinks
> > it's still bilerp, the subset is preserved.
> >
> > By changing filter to match the downgraded filter quality, these quads
> > will automatically become non-AA, non-clamped texture draws, meaning
> > that the varying texture coords are passed directly to sample(), so they
> > remain in high precision on devices like the Mali 400.
> >
> > Bug: chromium:1125298
> > Change-Id: I79f3d33246b6f897449c2a09015e1eb7a3e968b1
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439778
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Auto-Submit: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Iec686d90985e73f53a830a09ee675b6b8160ab85
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1125298
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440236
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
# Not skipping CQ checks because this is a reland.
Bug: chromium:1125298
Change-Id: Iab131bd256c828b633afd1c350eff099b23ab929
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440356
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This reverts commit fdde20d3ec.
Reason for revert: generation() can promise things that it can't deliver
Original change's description:
> Use generation() to detect ES3 support.
>
> Desktop GLSL 1.30 supports the things we currently consider as "ES3
> only"--nonsquare matrices, derivatives, and unsigned integers.
>
> Change-Id: I4b5a844cf3aabee6b6d2c562e78859a29efc36fc
> Bug: skia:12347
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439937
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
Change-Id: I118e08da078090f404a4fdf33c3a16a48c702753
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440457
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This is part of making everything in the gpu/ops directory be v1-only.
Bug: skia:11837
Change-Id: I9709ffc140a77d4d68f3838e3d30374df0913889
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
If the passed-in shader references RTFlip (i.e., sk_FragCoord is used),
the settings must contain RTFlip layout info; otherwise, an error
occurs. Originally, the fuzzer detected this as a problem because the
error was being delivered via SK_ABORT, but it's failing more cleanly
now that Ethan's new error handling code is in place (causing the fuzzer
to report that the bug was "fixed"). With this CL, the oss-fuzz shader
will actually compile successfully in SPIR-V instead of leading to an
error.
Change-Id: I3268e84bd8e01c95a25ed0845a37324e98033c4b
Bug: oss-fuzz:35916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439779
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:11837
Change-Id: Ifa1da88aafcaa96e0e885facaeb849cc9963bcfe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439938
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Optimization for inverse() uses some custom logic which neglected to
look up the value of a constant variable before assuming it was a
FloatLiteral; our tests were not exercising this case.
Change-Id: Idc8f2cc24f6a8df7234062f5f15e8c39a08457e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440260
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
We don't have compile-time optimization for this intrinsic yet, but
otherwise everything is working as expected.
Change-Id: Id9c678699baa1d9867848459bf680cc40f29b4bd
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440257
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>