This will be used in a followup CL to implement getBVecComponent. At
present it's not called.
Change-Id: Idd6f18314d0835af3946ea7458e6650384f505ea
Bug: skia:11141
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350703
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Previously ExternalValues were flexible, and could be used as raw values
(with the ability to chain access via dot notation), or they could be
callable. The only non-test use-case has been for functions (in
particles) for a long time. With the push towards SkVM, limiting
ourselves to this interface simplifies things: external functions are
basically custom intrinsics (and with the SkVM backend, they'll just get
access to the builder, and be able to do any math, as well as
loads/stores, etc).
By narrowing the feature set, we can rename everything to reflect that,
and it's overall clearer (the SkSL types now mirror FunctionReference
and FunctionCall directly, particularly in how they're handled by the
CFG and inliner).
Change-Id: Ib5dd34158ff85aae6c297408a92ace5485a08190
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350704
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This reverts commit bef02dca9d.
Reason for revert: PreAbandonGpuContext failing on tree
Original change's description:
> Fix GPU improved noise impl and add to perlinnoise GM.
>
> GPU was recently busted when switching alpha-color type swizzles from
> aaaa to 000a.
>
> There was no GM that exercised SkPerlinNoiseShader::MakeImprovedNoise.
>
> It draws wrong before and after this change with the CPU backend.
>
> Bug: skia:10536
> Change-Id: I514e304d022fcccae80699a99facafa8ce947e9f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350916
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: Iac635028b402e6008e3a8050bdfa66052d94fd10
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10536
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350956
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
GPU was recently busted when switching alpha-color type swizzles from
aaaa to 000a.
There was no GM that exercised SkPerlinNoiseShader::MakeImprovedNoise.
It draws wrong before and after this change with the CPU backend.
Bug: skia:10536
Change-Id: I514e304d022fcccae80699a99facafa8ce947e9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350916
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Continue to test everything with the ByteCode interpreter, and run most
tests with the new SkSL-to-SkVM utilities, as well. A few tests rely on
features that aren't yet implemented (function calls, looping), and some
of the bespoke tests (that don't use the test() helpers) use even more
exotic features that need to be implemented or disallowed in the IR
generator. This is getting us closer to not needing ByteCode at all,
though.
Refactored a bunch of the helper code to reduce copy-paste among the
many different 'test' functions.
Change-Id: I138d4a24266f2d862742245c5ee895d86c01018e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350560
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Bug: skia:11134
Change-Id: I0b0a3f530452d5bb5c08da7f247728298c234dd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350583
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Avoids the polyfill that uses looping instanced draws. This has led to
perf regressions on android.
Bug: skia:11138 skia:11139 chromium:1163441
Change-Id: I129bf96c6d8a3eaadc79bfca496c7d50189f737e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350738
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
We've been assuming that all Ops with the same arguments produce the
same value and deduplicating them, which results in a simple common
subexpression eliminator.
But we can't soundly dedup two identical loads with a store between;
that store could change the memory those loads read, producing different
values, as demonstrated by the first new unit test.
Then, by similar reasoning, it may first seem fine to deduplicate
stores, e.g.
store32 arg(0), v1
store32 arg(0), v1
That second store certainly does look redundant. But if we slot a
different store between, it's no longer redundant:
store32 arg(0), v1
store32 arg(0), v2
store32 arg(0), v1
If we dedup those two v1 stores, we'll skip the second and be left with
v2 in our buffer instead of v1. This is the second new unit test.
Now, uniform32 and gather ops also touch memory... are they safe to
dedup? Surprisingly, yes! Uniforms are easy: they're read-only. No
way to store to uniforms, so no intervening store can invalidate them.
Gathers are a little fuzzier, in that the buffer we gather from is
uniform in practice, but not strictly required to be... it's not
impossible to construct a program that gathers from a buffer that the
program also stores to, but you'd have to go out of your way to do it,
and it's not a pattern we use today, and SkVM does not provide the
synchronization primitives you'd need to make attempting that even
vaguely sensible. So gathers in practice can also be deduplicated.
In general it's safe to dedup an operation unless it touches _varying
memory_, i.e. loads and stores. uniform32 and gathers touch
non-varying memory, so they're safe, and while index is varying, it
doesn't touch memory.
Change-Id: Ia275f0ab2708d3f71e783164b419436b90f103a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350608
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
I noticed is_always_varying() is a little wrong, and this new test demos
how. This isn't terribly important: in most practical situations
gathers will indeed be varying.
Change-Id: I456d4c7287147726c49ebb5af5af347c65cd21d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350602
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Many of our shaders generate the same vector constant dozens of times,
e.g. Gaussian blur uses float4(1) repeatedly. This change avoids
re-emitting redundant vector constants.
Change-Id: I22a71cd8b2783fb997f52d485b49031f64ca6d96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350701
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This was needed (transitively) by Dawn previously, but no longer
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn,Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-Dawn
Change-Id: I15089298a295be41d7564fe53779e3fafd01229c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350702
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Also explicitly default all special methods of SkStrikeCache to get
nicer warnings.
Change-Id: I8856a905c6075ca52d4ad900ccd0dacc581cd485
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350637
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This makes them reusable for the edge-AA code when we move it.
Bug: skia:10419
Change-Id: I20042a419617717214535d45fc92a8cae986fb33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349356
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
and update GrGLGpu::flushScissorRect's signature to match it.
Change-Id: I9082003934168306833f86d310b942a8d7527384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350612
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Previously, we had constant-value deduplication, based on the SkSL type
of the constant. However, we were still generating redundant constants,
because we would emit a separate constant for Float(n) and Half(n), or
Int(n) and Short(n), even though we generate the exact same instruction
for these constants. We now deduplicate based on the type's number-kind,
separating constant literals into three categories: floats, signed ints,
and unsigned ints. This better matches our type-handling in
getActualType.
Change-Id: I5777d4b3d567839b7aa72dc8de76908c18fc387e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350031
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This CL adds additional variants of some IRGenerator functions to enable
them to be more easily called from upcoming DSL code. This should not
change functionality (other than a slightly different error message in
one case).
Change-Id: Ic727c194fca5111d4283007f4ec23653598a853b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350017
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
I plan to add at least one more gr_* class, so I figure it makes sense
to just keep all this similar things in one place.
Bug: skia:11136
Change-Id: I96d24dd094731e9694201e012fec37926cce564d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350639
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
The pattern appears to be that the variable that stores the uploaded
value has a "Prev" suffix.
Change-Id: I78ea449d75f5fd091c113cf08af919331467eb8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350638
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:10979
Change-Id: I81b8692b0bb1582b60a9324492a782d04a09538f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344963
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
IntLiteral and FloatLiteral each had a pair of public constructors: one
which takes a Type (what type of Int/Float is this?), and another
constructor which takes a Context (assume the generic Float/Int type).
BoolLiteral had a public Context-based constructor, but its Type-based
constructor was private. The Type-based constructor is now public to
match its siblings. This allows us to create Booleans without needing
a Context&, if we have an fBool_Type, and fixes make_unique (which
doesn't like private constructors).
Change-Id: Iffb4980947a73b3a89aa1452cc90dce63620bd67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350636
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>
Change-Id: Ia4a1c38161046b94dc56a1a76704766f1e14aab7
Bug: skia:11131
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350019
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Previously, the IR generator had code which could simplify conversion
constructors like `int(1.23)`. Separately, the optimizer's constant
propagation pass had its own separate implementation of these
simplifications as well.
This CL unifies the two implementations. Previously, the constant-
propagation pass version of the code only supported integer literals, so
this change also improves our code generation slightly.
Change-Id: I32c70a5f2aed210d03bef3166b1178a2d40cdabd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350024
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
new unit tests is crashing like many others.
Bug: skia:10869
Change-Id: Ic9418468cb4720a52aebf2486cc359dc456c9983
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350558
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This reverts commit 237911a4d8.
Reason for revert: timeouts
Original change's description:
> Add more comprehensive test for GPU write pixels.
>
> Similar to existing SurfaceContextReadPixels but for writes. Tries all
> combinations of src/dst color type and alpha type for write pixels.
> Always reads back pixels for verification using the ImageInfo of the
> tested surface context.
>
> Bug: skia:8862
> Bug: skia:11130
>
> Change-Id: Id01f6aa511f00c4be47c32746dca872368cd5d82
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348886
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I5498be0b20604e520ad887898695a81ca82936ca
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8862
Bug: skia:11130
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350559
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
If using discardable msaa surfaces in vulkan, when we break up a
render pass for an inline upload, we must do a load msaa subpass for
the second render pass. However, if the original render pass did not
have this load subpass (e.g. clear or discard load op), then all the
GrProgramInfos for draws that end up in the second render pass will
have been recorded thinking they will be in a render pass with only 1
subpass. Thus we add an override flag to the makeDesc call to force
the actually VkPipeline that gets created to be created using a render
pass with 2 subpasses. We do lose the pre-compile abilities with this
approach, but inline uploads are very rare and already slow.
Ideally we would find a way to pull inline uploads into their own
GrRenderTasks so all this could be known ahead of time. But currently
we allow uploads to happen between draws of the same Op so it makes it
difficult to break up and even know when they'll occur at record time.
Bug: skia:10979
Change-Id: I247b007813dd0be280ce8a72fc6af70fe21f082d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344962
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
We rely on exact output from SkStringAppendScalar in our
Housekeeper "Generated Files" bot. However, we can't trust snprintf(%g)
to emit the same string for infinite and NaN values on every platform.
For instance, the bits 0xFFFFFFFF as a float are `-nan` on Linux and
`nan` on OS X. Infinity is represented as `inf` on Linux/Mac and
`1.#INF00` in Visual C++.
This CL standardizes on the strings `inf`, `-inf` and `nan` across all
platforms. This solves a GeneratedFiles issue in the followup CL:
http://screen/5RVdSnLmBupzpja
Change-Id: I648fd32571f8300998ec427dcb3d1e7d7215dbdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350496
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
026a067c38..b590fd1b9a
2021-01-06 ynovikov@chromium.org Roll chromium_revision b5dfde1f4d..481852c5d8 (840075:840387)
2021-01-05 jmadill@chromium.org Vulkan: Clean up "actual"/"intended" naming.
2021-01-05 syoussefi@chromium.org Complete I/O block GLSL tests
2021-01-05 syoussefi@chromium.org Vulkan: Directly capture non-gl_Postion builtins
2021-01-05 jdarpinian@chromium.org Remove tabs from volk.c/h
2021-01-05 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Chromium from 094b96f7f336 to b5dfde1f4de5 (71 revisions)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/angle-skia-autoroll
Please CC johnstiles@google.com on the revert to ensure that a human
is aware of the problem.
To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md
Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Release-ANGLE;skia/skia.primary:Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Debug-All-ANGLE
Tbr: johnstiles@google.com
Change-Id: Ib79f626be58ba3de626044f5470f5fe4634d18f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350486
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Similar to existing SurfaceContextReadPixels but for writes. Tries all
combinations of src/dst color type and alpha type for write pixels.
Always reads back pixels for verification using the ImageInfo of the
tested surface context.
Bug: skia:8862
Bug: skia:11130
Change-Id: Id01f6aa511f00c4be47c32746dca872368cd5d82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348886
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This simplifies the argument lists for functions and will also allow us
to extract the AA logic into its own subclass.
Bug: skia:10419
Change-Id: If51e86a7633da7a3ee9352c0236258a0a21f2ebe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347976
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Bug: oss-fuzz:29183
Change-Id: I60475e2bda42e98b79a4291839249158d2738c9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350028
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>