This was originally designated for 2x2 matrices only, but this was not
right--all matrix comparisons actually need to be rewritten to fully
work around the bug.
Change-Id: I743d16a65bc55e93361a3dd8753653384583f063
Bug: skia:11308
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411416
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 is allowed by GLSL, so we allow it too.
GLSL ES 1.0, Section 6.1: "The idiom “(void)” as a parameter list is
provided for convenience."
Change-Id: I551c505d3de518a75acd5e306f09f0f0767e43f2
Bug: skia:12025
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411300
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit 814c6db4c0.
Reason for revert: Pending investigatoin of what's going on with Chrome issue 1211203.
Original change's description:
> Reland "Use SkImage_Raster's unique ID to cache textures."
>
> This is a reland of 8005007e98
>
> Original change's description:
> > Use SkImage_Raster's unique ID to cache textures.
> >
> > SkImages can share SkBitmaps and have different unique IDs/mipmap
> > status. Currently we cache the texture version using the bitmap's
> > unique ID. Instead use the image's ID so different images produce
> > different textures (e.g. mipped and nonmipped).
> >
> > Bug: skia:11983
> > Change-Id: Ic37564186f675277e5a9de1bcf36b40a19c3a3de
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407356
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> Bug: skia:11983
> Change-Id: I63e9d15ffdf6b6769c9b0b97d9aa30f353e1a3a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409376
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:11983
Change-Id: I4fb2875c2a62d409c3f6ddd41344e83f4e68a375
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411240
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: Ib286933a1c2c82efbb87799016550086bcbc584f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410817
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This will allow us to rewrite `mat == mat` on Adreno 5xx/6xx GPUs when
running in GLSL.
Change-Id: I621e918a545a49b7ecb9c944ae59b1e7a7594bae
Bug: skia:11308
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410996
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This is a reland of c6260f9742
Problematic DeadReturn.sksl test cases have been moved to DeadReturnES3.
Original change's description:
> Eliminate unreachable code during optimization.
>
> The Adreno 5xx and 6xx previously failed the SkSLStaticSwitchInline
> test; the driver struggled to interpret code with multiple return
> statements in a row. We now detect unreachable statements and eliminate
> them.
>
> Change-Id: I344d632f2488ca65b0635b37bebffe6e4fb607c5
> Bug: skia:12012
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410256
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:12012
Change-Id: I748e8761cbc71c811b5ad8fe49186f980261d8b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410793
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 is a reland of 9c7e04cd6f
The DeadReturnES3 test isn't enabled yet due to crashes in Radeon, but
the PipelineStage fixes need to be landed now.
Original change's description:
> Add support for do-while loops in PipelineStage.
>
> This allows us to run tests which use do-while loops (like
> DeadReturnES3) within dm.
>
> Change-Id: If8ecb6b3fcd23d79451a43edf8e1ee8a182de984
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410459
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I73715f09defd950156cc252be9a52a36620d6d5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410936
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
These tests were written earlier but not enabled due to the absence of
ES3 support in Runtime Effects.
Change-Id: Idaf81926271e5b2e483a7c5cfce824a0056f5595
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410460
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This adds a new SkGpuDevice factory function that absorbs the
creation of the GrSurfaceDrawContext and updates a second factory
function to handle more cases.
Change-Id: If7bd33aa18d1ed5dd72288e7b4db3b97302640cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410077
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
MetalCodeGen would incorrectly identify `(someMatrix, someScalar)` as a
math operation between `someMatrix` and `someScalar` and attempt to
convert `someScalar` to a matrix. If `someScalar` was a Boolean type,
this would lead to an assertion.
The binary expression is now checked more thoroughly before converting
the scalar into a matrix.
Change-Id: Id7e104d5533d8c43375927d4815b83e1a3c36be1
Bug: skia:11125
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410682
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reverts commit c6260f9742.
Reason for revert: Nexus 7 is grumpy, fails SkSLDeadReturn_GPU
https://ci.chromium.org/raw/build/logs.chromium.org/skia/539fff50ff093c11/+/annotations
Original change's description:
> Eliminate unreachable code during optimization.
>
> The Adreno 5xx and 6xx previously failed the SkSLStaticSwitchInline
> test; the driver struggled to interpret code with multiple return
> statements in a row. We now detect unreachable statements and eliminate
> them.
>
> Change-Id: I344d632f2488ca65b0635b37bebffe6e4fb607c5
> Bug: skia:12012
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410256
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: Ia3db1f1b28417e479e2d71a4a6ed94a007e47cf9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12012
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 9c7e04cd6f.
Reason for revert: ANGLE bots don't like it:
https://logs.chromium.org/logs/skia/53a05ed157eb6c11/+/steps/dm/0/stdout
Exception in SkSLDeadReturnES3_GPU
Original change's description:
> Add support for do-while loops in PipelineStage.
>
> This allows us to run tests which use do-while loops (like
> DeadReturnES3) within dm.
>
> Change-Id: If8ecb6b3fcd23d79451a43edf8e1ee8a182de984
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410459
> 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,ethannicholas@google.com,johnstiles@google.com
Change-Id: Ib8ca1fd28b49c5e7d72290132336252218caac18
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410779
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This allows us to run tests which use do-while loops (like
DeadReturnES3) within dm.
Change-Id: If8ecb6b3fcd23d79451a43edf8e1ee8a182de984
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410459
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
The Adreno 5xx and 6xx previously failed the SkSLStaticSwitchInline
test; the driver struggled to interpret code with multiple return
statements in a row. We now detect unreachable statements and eliminate
them.
Change-Id: I344d632f2488ca65b0635b37bebffe6e4fb607c5
Bug: skia:12012
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410256
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This is a reland of 8005007e98
Original change's description:
> Use SkImage_Raster's unique ID to cache textures.
>
> SkImages can share SkBitmaps and have different unique IDs/mipmap
> status. Currently we cache the texture version using the bitmap's
> unique ID. Instead use the image's ID so different images produce
> different textures (e.g. mipped and nonmipped).
>
> Bug: skia:11983
> Change-Id: Ic37564186f675277e5a9de1bcf36b40a19c3a3de
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407356
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:11983
Change-Id: I63e9d15ffdf6b6769c9b0b97d9aa30f353e1a3a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409376
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
GLSL now emits 4x2 diagonal matrices as:
`(mat4x2(1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0) * n)`
instead of
`mat4x2(n)`.
This works around a long-standing GLSL bug in both Mesa and glslang that
affects several drivers:
https://github.com/KhronosGroup/glslang/issues/2645
Change-Id: If529d5cd150ce720f436cb3634a2fd3423919278
Bug: skia:12003
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410137
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
- Arrays were unused
- Each ctype was used with exactly one mapper - remove the SkSL type
list
- After that, the mapper was just a key + value, so make it just a value
and use a map (rather than vector)
Change-Id: Ibc150ecc9ac9724ecd1e7056614ca5836ce99d5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409998
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: Id41287668971d464e517e28757736d7d3b019666
Bug: skia:11977
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406356
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This was only used in the context of sk_SampleMask, which was removed
recently.
Change-Id: Id70d7af8b3a100ff157c2984bad4131f1b92f317
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410056
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I6019418526def09c6c9f4b22567a2c76542d043c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409876
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The DSL would not previously function within the compiler, because it
expected to be in charge of everything itself. The compiler and DSL also
disagreed about how to handle some things, such as the DSL not
respecting the compiler's override flags.
This CL moves responsibility for much of the setup process into
DSL::Start(), which the compiler now invokes. DSL::Start() now also
takes a ProgramSettings instead of DSL-specific flags, and the
externalFunctions vector has been moved into ProgramSettings.
Change-Id: I283ed8366e25d67f02c43833743c5f8afdedaefc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408136
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Splits the instanced and tessellation implementations into their own
separate files and merges their common code into a shared base class.
Renames GrStrokeTessellateShader to GrStrokeShader.
Bug: skia:10419
Change-Id: Ia731509858e682a605ee65c9ced1fd163e4c03f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409036
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Although these tests are simple, it ended up uncovering a legitimate
SPIR-V bug (skia:12009).
Change-Id: Ie89235157256b97626aa6ada4d9d6ba62abc57fa
Bug: skia:12009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409299
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
If we encounter code like `return 1; return 2;` we need to synthesize a
label, even though the second return statement isn't actually reachable.
This is harmless and satisfies the SPIR-V validator.
Ideally we'd eliminate the dead code entirely, but this case is rare and
isn't likely to cause any problems as-is.
Change-Id: I2d6219dff6868011353e19a662301bec44a015d6
Bug: skia:12009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409402
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Now that the various Metal and SPIR-V bugs have been shaken out, we can
enable these tests. Knock on wood.
Change-Id: If4b4e302cfdd91464aaf00bc9639989de5e49aac
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408640
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This reverts commit 8005007e98.
Reason for revert: text drop outs on D3D???
https://gold.skia.org/diff?test=xfermodes&left=1521937fb71ceb0615e8d369096ac180&right=b262b21be69db7b55b46106c0f60e9d7
Original change's description:
> Use SkImage_Raster's unique ID to cache textures.
>
> SkImages can share SkBitmaps and have different unique IDs/mipmap
> status. Currently we cache the texture version using the bitmap's
> unique ID. Instead use the image's ID so different images produce
> different textures (e.g. mipped and nonmipped).
>
> Bug: skia:11983
> Change-Id: Ic37564186f675277e5a9de1bcf36b40a19c3a3de
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407356
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: I39422295840ecdf363d3541380e7a25ab91a198b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11983
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409298
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
All the pieces of the puzzle were already here to support componentwise
addition and subtraction of matrices. Division was just a forgotten gap
in the implementation and is now patched up to match + and -.
NOTE: if you read the SPIR-V output very closely, you may be surprised
that there are fewer FDiv operations than you'd expect from reading the
input SkSL. As it turns out, a preexisting optimization is rewriting
`mat / 4` into `mat * 0.25` (see line 2689), and this rewritten form can
use the dedicated MatrixTimesScalar op. So we only get componentwise
FDivs for the `4 / mat` lines in the source.
Change-Id: I011c859f5b3a031fbb95a2956f1194a5f3b3794b
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408639
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Previously, these tests were commented out because Runtime Effects could
not compile ES3. More recently, the `enforceES2Restrictions` option flag
was added, which allows these tests to work inside a Runtime Effect.
Most of our commented-out tests can be supported this way; enabling them
a few at a time will make the inevitable debugging simpler when a driver
runs into issues with a test.
Change-Id: I1a7a377d392151df4b4789ed5062706717c5a41b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409280
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>
SkImages can share SkBitmaps and have different unique IDs/mipmap
status. Currently we cache the texture version using the bitmap's
unique ID. Instead use the image's ID so different images produce
different textures (e.g. mipped and nonmipped).
Bug: skia:11983
Change-Id: Ic37564186f675277e5a9de1bcf36b40a19c3a3de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407356
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Multiplication is handled just as before. Ops other than multiplication
are handled by splatting the scalar into a matrix, then performing the
op as a componentwise matrix-op-matrix binary expression.
Change-Id: I654715c45bf5c91b8e9660fdf1c1c6d6818b621a
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408637
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
The mat4x2 portion of the test no longer checks its results, as there
are bugs in the Intel and Radeon GPU drivers that prevent mat4x2s
from being constructed properly.
The SkSL optimizer ends up eliminating the 4x2 matrix entirely because
it is unused by the rest of the code, as well at the 4x4 matrix which is
calculated from the 4x2. At this point, I'm OK with this.
Change-Id: If1464f9e4938b0a37b2ec180c686972389d94e83
Bug: skia:12003
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408900
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
When a stroke is zoomed in, it can require an exponential number of
chops. This CL updates the tessellators to stop recursing once a curve
is no longer in the viewport.
Bug: skia:10419
Bug: skia:11268
Bug: skia:9795
Change-Id: I6aad5355618462e88ce6ccccb57c500ae6310f22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408576
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This test causes issues on a handful of drivers still.
Change-Id: I7dd0df95d174c53cfc05df83d848a90a169ba3d1
Bug: skia:12003
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408897
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Previously, it was structured like Matrices.sksl and had no verification
of its results. Now it double-checks that its outputs match our
expectations. The test is still quite simple for now, however.
Change-Id: Iaa45fe58beb497a63801833f8ba5a493a61139d9
Bug: skia:11985, skia:12003
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408646
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>
Reviewed-by: Brian Osman <brianosman@google.com>
This will allow us to write tests that verify the behavior of non-square
matrix ops.
Change-Id: I1490c4675778cbdc8428ac7a6c9de16083179fc8
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408645
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 reverts commit 5d61cc2f87.
Reason for revert: break Vk bots
Original change's description:
> Vectorize scalars in SPIR-V using ConstructorSplat.
>
> This avoids redundant code, and has a small side benefit of
> deduplicating constant vectors which appear more than once in the code,
> since `writeConstructorSplat` already supports this.
>
> Change-Id: I2972ee922ac92adeb40bc765da3b490a59b957b3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408360
> 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,ethannicholas@google.com,johnstiles@google.com
Change-Id: I9fc0b896c0cfccc348d510a02df47d5ad74a0e90
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408644
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This test was generating invalid code in Metal
(http://review.skia.org/408356), but we didn't catch it because the code
wasn't actually being run.
Change-Id: I649034593a566f9e835b1cf7b0702c64952d31ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408641
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Support for constant-expression function calls in SkSL now exists, and
support for abs() was added at http://review.skia.org/405676.
Change-Id: I3144af993db93a3d640971734d4cb03e0cfb8589
Bug: skia:10835
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408642
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This avoids redundant code, and has a small side benefit of
deduplicating constant vectors which appear more than once in the code,
since `writeConstructorSplat` already supports this.
Change-Id: I2972ee922ac92adeb40bc765da3b490a59b957b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408360
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This is a clone of the Metal test. (This can be moved into shared/ and
enabled as a real test once the codegen is fixed.)
At present, this test generates broken code; everything is writing an
SpvOpMatrixTimesScalar opcode regardless of the actual operation being
performed.
Change-Id: If06b4196e7d9be36e41c5c60c006b2a713cc25d8
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408297
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
We were emitting this at global scope (not in Globals). That would lead
to errors about the variable needing to be in the constant address
space. (You can see the result in ConstArray.metal - the old code was
invalid). Also, we were already making references use _globals, so the
code was double-wrong (or half-right, depending on your perspective).
After the core change, writeVarDeclaration was only used for local
scope, and writeModifiers never used the 'globalContext' parameter.
The removal of finishLine() changed every test output, unfortunately.
Change-Id: Icc1356ba2cc3c339b2f5759b3d18523fd39395bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408356
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
There were two issues leading to the corruption seen in the linked
chromium issue.
1. The draw's bounds were calculated based on the quad being clipped
to w>= epsilon, which is what happens when the AA inset/outset is done.
But for non-aa quads, the fillrect and texture ops did no clipping,
assuming that the GPU would be sufficient. However, this can produce
non-aa draws that exceed the calculated bounds, misleading the clip
stack into incorrectly removing the scissor, etc.
2. Precision issues within CropToRect meant some perspective quads'
barycentric coordinates would become degenerate and compute to (0,0,1),
making it appear as if the render target/scissor were contained within
it. This meant we'd turn it into a rectangular clear.
These changes appear to address the corruption on Linux and Windows, but
there are still rendering artifacts from poor aa inset/outset
calculations. These artifacts are at least limited to the clip properly.
A better rendering method that does not rely on line intersections
will address these artifacts, but this CL is a reasonable temporary
mitigation.
Bug: chromium:1204347
Change-Id: I3c67d4efe70313ae7c98abc0a57b5b047c83890d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407821
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This CL adds a polyfill for componentwise matrix/matrix division to
Metal, as well as matrix/=matrix. Matrix/scalar and scalar/matrix
division work by splatting the scalar out to a matrix (handled in the
prior CL, http://review.skia.org/407616) and then performing
componentwise matrix/matrix division.
Working demonstration (copy-pasted from the Metal output file):
http://screen/BrqyPcbPrB7Dy4m
Change-Id: I6a8b97783be3485f7ffee551b669d14bc58e7568
Bug: skia:11125
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407796
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
GrCullTest quickly determines whether a set of points will be visible
or not. It will be used to guard against exponential recursion when
chopping paths at an extreme zoom level.
Bug: skia:10419
Change-Id: I85183826d820bbca0349a1e794b0696f776b134b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407297
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This reverts commit 90508f02dc.
Reason for revert: avoiding driver bugs this time
Original change's description:
> Revert "The Matrices test now verifies its results."
>
> This reverts commit 86121f6c0e.
>
> Reason for revert: tree sad
>
> Original change's description:
> > The Matrices test now verifies its results.
> >
> > Previously, this test did a bunch of matrix math but never actually
> > checked its results for correctness.
> >
> > Change-Id: I353be58049286266c2d561b0939b3874d2684403
> > Bug: skia:11985
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360
> > 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>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11985
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:11985
Change-Id: I214375d74977f324973da72c440d7ff5ff179016
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
The Metal code generator will now detect matrix-op-scalar expressions
and splat the scalar across a matrix. This allows a scalar to be added
to, or subtracted from, a matrix. (It does not fix division because
Metal also does not natively support componentwise division on
matrices.)
Change-Id: I7d5b0c5bd35393475c524e34cad789bf4f72a103
Bug: skia:11125
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407616
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
- most of the small diffs are because I moved GrWangsFormula.h out
of the tessellate/ directory and into the geometry/ directory since
it's more general than HW tessellation.
The previous implementation was based on the heuristic that the distance
from the true curve to the line segment would be divided by 4 every time
the curve was recursively subdivided. This was a reasonable
approximation if the curve had balanced curvature on both sides of the
split. However, in the case of the new GM's curve, the left half was
already very linear and the right half had much higher curves.
This lead to the approximation reporting fewer points than required.
Theoretically, those few points that weren't utilized by the left half
of the curve could have been made available to the right half, but the
implementation of that would be tricky.
Instead, it now uses Wang's formula to compute the number of points.
Since recursive subdivision leads to linearly spaced samples assuming it
can't stop early, this point count represents a valid upper bound on
what's needed. It also then ensures both left and right halves of a
curve have the point counts they might need w/o updating the
generation implementations. However, since the recursive point
generation exits once each section has reached the error tolerance, in
scenarios where the prior approximation was reasonable, we'll end up
using fewer points than reported by Wang's. Hopefully that means there
is negligible performance regression since we won't be increasing
vertex counts by that much (except where needed for correctness).
Bug: skia:11886
Change-Id: Iba39dbe4de82011775524583efd461b10c9259fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405197
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit 86121f6c0e.
Reason for revert: tree sad
Original change's description:
> The Matrices test now verifies its results.
>
> Previously, this test did a bunch of matrix math but never actually
> checked its results for correctness.
>
> Change-Id: I353be58049286266c2d561b0939b3874d2684403
> Bug: skia:11985
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360
> 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>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Previously, this test did a bunch of matrix math but never actually
checked its results for correctness.
Change-Id: I353be58049286266c2d561b0939b3874d2684403
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360
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>