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>
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>
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>
Previously `number(boolean)` casts were converted to a ternary during
IR generation, and `boolean(number)` casts caused an error.
Metal and GLSL should support this cast as written. SPIR-V needed a
little bit of logic to handle converting the boolean to a number via
OpSelect.
Change-Id: I0069781e2b5a26a25c8625ab41c2392342bfd10d
Bug: skia:11131
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349066
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The new unit test demonstrates load/store reordering is error-prone.
At head we're allowing loads from a given pointer to reorder later than
a store to that same pointer, and boy, that's just not sound. In the
scenario constructed by the test we reorder this swap,
x = load32 X
y = load32 Y
store32 X y
store32 Y x
using schedule() (following Op argument data dependencies) into
y = load32 Y
store32 X y
x = load32 X
store32 Y x
which moves `x = load32 X` illegally past `store X y`.
We write `y` twice instead of swapping `x` and `y`.
It's not impossible to implement that extra reordering constraint: I
think it's easiest to think about by adding implicit use edges in
schedule() from stores to prior loads of the same pointer. But that'd
be a little complicated to implement, and doesn't handle aliasing at
all, so I decided to ponder on other approaches that handle a wider
range of programs or would have a simpler implementation to reason
about. I ended up walking through this rough chain of ideas:
0) reorder using only Op argument data dependencies (HEAD)
1) don't let load(ptr) pass store(ptr) (above)
2) don't let any load pass any store (allows aliasing)
3) don't reorder any Op that touches memory
4) don't reorder any Op, period.
This CL is 4). It's certainly the easiest and cheapest implementation.
It's not clear to me that we need this scheduling, and should we find we
really want it I'll come back and work back through the list until we
find something that meets our needs.
(Hoisting of uniforms is unaffected here.)
Change-Id: I7765b1d16202e0645b11295f7e30c5e09f2b7339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350256
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
The code didn't take into account that x and y might be different types.
(This bug was not actually harmful; type coercion allowed the code to
compile even with the wrong type. The float would be silently splatted
into a vec and the rest of the code would work as-is.)
Change-Id: Ib76bc733f76304e451ef9197421b4bc22e29e49c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348888
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This actually exposed a latent bug: we don't support bool(1.23) or
bool(1) casts, but these are valid in GLSL:
https://www.khronos.org/opengl/wiki/Data_Type_(GLSL)#Conversion_constructors
"to bool: A value equal to 0 or 0.0 becomes false; anything else is
true."
Change-Id: Ia929a09914ffc96f081d0402d7bb05b5428f8db6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349977
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: Ieb7698d357c9be05ca1f17de84215add54553f84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349065
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I2c39df532803d827d7cad876021f2ead81145f1d
Bug: skia:10902
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349064
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, the declaration didn't link back to function definition.
This makes the function appear to be undefined, which inhibits inlining
and also makes it difficult for us to validate the presence of a
definition for every called function.
Change-Id: I220ab502634cb3e1d337c23bac150af9aa6370b1
Bug: skia:10902
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349063
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>
Previously, we did very little to distinguish between a built-in
intrinsic and a user-defined function whose name matches an intrinsic.
This could lead to all sorts of surprising outcomes, as our intrinsic-
rewriting code is able to make assumptions that might not hold true for
arbitrary user-defined functions.
Change-Id: I4180e0c5becdeb6a0a162534eaecfc90dda3392c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349062
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: I6c0a6192a78ce60be60a71ed75350ca1bc256d57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348890
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I954af70f545a2258babd82af0d43d509201fdc59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348889
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I4798263318c504834f23900dbb3f5d167fd17e65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348887
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit 8f924ac0ce.
Reason for revert: suppressions landed for fuchsia images to rebaseline
Original change's description:
> Revert "Add new virts, hide old ones"
>
> This reverts commit c56e2e5aa6.
>
> Reason for revert: suspected of breaking chrome roll
>
> Original change's description:
> > Add new virts, hide old ones
> >
> > Add virtuals for the draw methods that now take sampling/filtermode.
> >
> > drawImage
> > drawImageRect
> > drawImageLattice
> > drawAtlas
> >
> > Add a flag that can remove the older virtuals, once each client has
> > stopped overriding them. In that situation, the older public methods
> > will simplify extract the sampling from the paint, and call the new
> > public methods.
> >
> > Bug: skia:11105, skia:7650
> > Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> > Commit-Queue: Mike Reed <reed@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,fmalita@chromium.org,reed@google.com
>
> Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11105
> Bug: skia:7650
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>
TBR=djsollen@google.com,bsalomon@google.com,fmalita@chromium.org,reed@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:11105
Bug: skia:7650
Change-Id: Ia2b4537a2d330460b7554278d2c05075cf27162a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348876
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Bug: skia:10913
Change-Id: I430e5eb3fecb0f15775db03699819194d44271b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347958
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This reverts commit c56e2e5aa6.
Reason for revert: suspected of breaking chrome roll
Original change's description:
> Add new virts, hide old ones
>
> Add virtuals for the draw methods that now take sampling/filtermode.
>
> drawImage
> drawImageRect
> drawImageLattice
> drawAtlas
>
> Add a flag that can remove the older virtuals, once each client has
> stopped overriding them. In that situation, the older public methods
> will simplify extract the sampling from the paint, and call the new
> public methods.
>
> Bug: skia:11105, skia:7650
> Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,fmalita@chromium.org,reed@google.com
Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11105
Bug: skia:7650
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Add virtuals for the draw methods that now take sampling/filtermode.
drawImage
drawImageRect
drawImageLattice
drawAtlas
Add a flag that can remove the older virtuals, once each client has
stopped overriding them. In that situation, the older public methods
will simplify extract the sampling from the paint, and call the new
public methods.
Bug: skia:11105, skia:7650
Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This code was not using typeName() to emit its types, inadvertently
generating Metal code containing the `half` type.
We didn't have any unit tests which synthesized a matrix-construct
helper with half types, so Matrices.sksl was cloned into two separate
test files--MatricesFloat and MatricesHalf. These should be equivalent
except for float vs half types.
Change-Id: I19ecea994b8bc45594bb3f69e596896a3bcefe4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348180
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
FrExp testing was moved to the intrinsic tests as part of
http://review.skia.org/341977, and the shared versions were removed from
sksl_tests.gni at that time.
Change-Id: Ife7f3622034d97a77b60d5a98c01f71630c161d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348183
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
In Metal, matrix *= matrix is not natively supported and needs to be
injected via a helper function. This helper function now properly
converts `halfNxM` types to `floatNxM` types (as Metal does not support
half types). It also returns the result by reference instead of by
value to avoid an unnecessary copy.
Matrices.sksl now includes tests for operators += -= *=. Previously we
did not have any coverage for `matrix *= matrix` at all.
Change-Id: I7dfe468ced67eaf7c2405960e8c5efe6f2acf9e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348178
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>
4x4 was dividing a matrix by a scalar - this isn't allowed, multiply by
the scalar's inverse instead.
The types in the signature were derived from type.name(), which wasn't
applying the half->float re-mapping.
Finally, use raw strings so the resulting shader code isn't all crammed
on one line.
Bug: skia:10913
Change-Id: Ie28373fc138445b8c195dbd37687e4ad4504e918
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348177
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change readPixels contract to allow unknown->unknown AT reads, but
fail if one side is unknown and the other isn't (and update GPU read
pixels test accordingly).
Also, ProxyUtils::MakeTextureProxyViewFromData takes GrPixmap.
Bug: skia:8862
Change-Id: I771c154833408e666f860413c1a711714696326d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347196
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Previously, SKSL_INT was limited to an int32_t, so we couldn't
differentiate between -1 and 4294967295. We could paper over the
difference in some cases by relying on the expression's type, but this
was imperfect and left us unable to differentiate between an overflow
and valid results. SKSL_INT is now an int64_t; the code has been
updated to fix bugs that shook out as a result of the change.
This isn't a complete solution for overflow handling. There are still
lots of obvious places for improvement--e.g. constant folding can
easily overflow, and statements like `byte x = 1000;` are still
happily accepted.
Change-Id: I30d1f56b6f264543f3aa83046f43c2eb56d5fce4
Bug: skia:10932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345173
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Bug: skia:10913
Change-Id: I59f5b0fb2d015f8543b4038c2c5b18ce24c194a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347956
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Also, add control over kMedium mapping
Seems like a loss that GrInterpret throws away the cubic coefficients...
A step towards https://skia-review.googlesource.com/c/skia/+/347022
Bug: skia:11105, skia:7650
Change-Id: I2564c29b0eeffd4df92c0baa78e2c04f6348d7d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347636
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Change SkTypeface::onCreateScalerContext to return std::unique_ptr
instead of a bare pointer. The public SkTypeface::createScalerContext
implementation already returns std::unique_ptr, so this is an internal
change only.
Move SkTypeface::createScalerContext implementation from
SkScalerContext.cpp to SkTypeface.cpp for consistency.
Also change the return type of SkScalerContext::MakeEmptyContext to
std::unique_ptr and rename to SkScalerContext::MakeEmpty.
Change-Id: I965308e8f9c78b887811e428f0de873dc6196479
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346658
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Previously, some types of overflow were detected, but most would assert
or silently generate invalid code. Now, the parser will properly report
an error if it encounters any integer that exceeds UINT_MAX or any float
that exceeds FLT_MAX.
This fixes test OverflowUintLiteral.sksl. Added a test for floats as
well, OverflowFloatLiteral.sksl.
OverflowIntLiteral.sksl does not fail yet, because its values are larger
than INT_MAX, not UINT_MAX. These are legal from the perspective of the
parser. This must be caught later at IR generation time.
Change-Id: Ia5a904d01427cdc9f2ab5f4174154418737835e6
Bug: skia:10932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347176
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This fix is overly conservative in some situations (identity conversions
among vectors with the same component type), but fixes errors in two
existing unit test cases.
Bug: skia:11116
Change-Id: If852f8591fb26817528fdc37191c49129e17d6b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347053
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This feature had devolved to just an assert, and one that isn't really
necessary - all of Ganesh is built to handle any child processor being
null. The next step is to remove nullable types entirely -- a large
amount of code.
Change-Id: I612a5867f8690400b405aa1f5c929e76cf5918fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347050
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This CL updates `compareConstant` to fail gracefully instead of
aborting if the passed-in types don't match. This lets us call
`compareConstant` without checking types first.
Change-Id: Id2acdbdf700e64bcb24825cdad2c0e000992e8cb
Bug: oss-fuzz:28904
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347038
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
'int' is the only integral type that exists in GLSL ES 1.0 (and it's not
really guaranteed to be an integer). This enforces the same restriction
on runtime effects - no unsigned integers, and no short or byte types.
Bug: skia:11093
Change-Id: I938f1e0e125dc8347507f428b46b51c66033c752
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347046
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
SkPaintPriv methods are just an internal stopgap
Change-Id: Ibe6e37c5871068d8cd67dc0948961444dfd2b62a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347041
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
These are GLSL-isms that weren't really implemented - each one was a
"generic" type that only resolved to a single underlying type. We've
got along just fine without them for years, so update our sample()
declarations to take the actual underlying type. (Note that we had
worked around this by declaring an integer version of sample where
necessary, so we can presumably keep doing that in the future).
Change-Id: I4c46a2fa0c1f19e6278298c8005a2760329e7abf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347040
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Nullable fragment processors still exist, but they're handled
transparently by sample() within C++, so there's no need for .fp files
to ever do these tests manually.
Change-Id: Idf2bc58505207560553066c0126a2a036c5d970b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347039
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Made it private and accessible internally via SkCanvasPriv.
Update SkGpuDevice methods/variables after rename of GrDrawSurfaceContext.
Cq-Include-Trybots: luci.skia.skia.primary:Canary-G3,Canary-Flutter,Canary-Android
Change-Id: I3da64cee1de03c201243ee6c7ccd4b4c44cad8c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346498
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
... and lots and lots of IWYU
Change-Id: Ie5157dcdd2e6d29b95c71b39153278ab48ef4eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Change-Id: I2d396907387de4a5f3407d81efb9d2cd80e430d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346265
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
I found myself updating these for another change and realized they
are very limited tests that are redundant with more thorough tests.
Change-Id: I935da4d1da7ff3825a4042556845a8eb659b6ba8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346856
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Opaque types can no longer be copied via assignment or construction, and
various restrictions originally applied to the "fragmentProcessor" type
have been extended to cover opaque types in general.
Change-Id: I55ab7aefd1e6ef277e56a9408b430e1de5ba12ca
Bug: skia:11027
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346264
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 intrinsic was previously lacking a unit test, and wasn't actually
implemented in Metal or SPIR-V. Fortunately it's trivial to add.
Change-Id: I68bbdc58376b579c7f3f0ae5f49323b389c2b8c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346263
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>
Updated Pair type in SkTHashMap to derive from std::pair to fix C++14
issues with structured bindings.
Original change's description:
> Add support for range-based for loops to SkTHashSet/Map.
>
> This allows loops over SkTHashes to break in the middle, and also
> removes the need to use lambda captures to bring variables inside the
> loop's scope.
>
> Change-Id: Ief55d776b2c57a44b24cfe1c94493a5d514791c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346496
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I2ac5b2c59e70ed0ec3b42b32e7994d6bcdf56b40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346502
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
These effectively compute width/2 or height/2, but switch operations
around so that it's less likely to overflow on finite rects that would
have overflows in width or height.
Bug: skia:1160678
Change-Id: Ic93ca0c1d12598163b3dd48a5e8ba0ac7903301f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344968
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Previously, a return statement inside a scoped Block would always result
in the return expression being assigned to a temporary variable instead
of replacing the function-call-expression directly. This was done
because there might be variables inside the Block; these would have
fallen out of scope when the expression is migrated to the call site,
resulting in an invalid expression.
We aren't actually examining the return expression so we don't know if
it uses variables from an inner scope at all. (Inspecting the return
expression for variable usage is certainly possible! But it's a fair
amount of code and complexity for a small payoff.)
However, we can very easily get most of the benefit here without paying
for the complexity. In this CL we now look for variable declarations
inside of scoped Blocks. If the code doesn't add any vardecls into
scoped Blocks, there's no risk of scope problems, and we don't need to
use a temp-var to store our return expressions. If any vardecls are
added, we go back to using a temp-var as before.
Change-Id: I4c81400dad2f33db06a1c18eb671ba2140232006
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346499
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
These don't exist in our minimum spec (GLSL ES 1.0)
Bug: skia:11093
Change-Id: Ia2d871199fff2a98dcd517c1eebe46decb0c2dfb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346657
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>