Commit Graph

9944 Commits

Author SHA1 Message Date
Mike Reed
c43f2a0898 mark all exerimental (3d) apis as such
Bug: skia:9768
Change-Id: I10d8d3507df15ad45d827d2210d5bf2250ac1aaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-16 20:25:40 +00:00
Mike Reed
b18e74dcbd Expose camera matrix in SkCanvas
3 new getters:
- localToWorld
- localToCamera
- localToDevice (same as total-matrix)

The current tracking minimizes overhead, by using a computed inverse to
produce the localToWorld/Camera. This can be change as needed in the
future (more precision, but more memory/overhead), but for now is
sufficient to try out the new APIs.

Change-Id: I85440318f36dca935124b782e110fe9c0152ae7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264648
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-01-16 19:35:40 +00:00
Mike Reed
c4b8eefe56 move SkV3 into header
Change-Id: I20284b415bbfe5ecc15fe9fe47dcbb65850d4368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264682
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-16 11:34:32 +00:00
Mike Reed
ee0a03a3f3 experimental: saveCamera()
bug: skia:9768
Change-Id: I84b8f32933023d3376b51c2b93cc843863008828
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264476
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-15 19:27:34 +00:00
Mike Klein
d1b347ee05 add a note about P3 gamuts
Change-Id: I50322fff140f962a9b7cffb60cdef68e25715a5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264576
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-15 15:15:44 +00:00
Mike Klein
42032cb88f Revert "Pass in a SkColorType into SkImage_Gpu ctor."
This reverts commit 1d17543133.

Reason for revert: android bots

Original change's description:
> Pass in a SkColorType into SkImage_Gpu ctor.
> 
> This allows us to get rid of using the GrPixelConfig on proxy to create
> the SkColorType
> 
> Bug: skia:6718
> Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I449e6b0750d611346791beb1dd1346106ad01741
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264469
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-14 22:57:18 +00:00
Greg Daniel
1d17543133 Pass in a SkColorType into SkImage_Gpu ctor.
This allows us to get rid of using the GrPixelConfig on proxy to create
the SkColorType

Bug: skia:6718
Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-14 21:13:09 +00:00
Robert Phillips
e4720c6864 Expand SkImage::MakeFromCompressed to support mipMapping
Bug: skia:9680
Change-Id: I41357439cdc087e4cc98d5d1659ae2ee19f49004
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264398
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-14 20:57:28 +00:00
Mike Reed
7543587ee2 clean-up 3d sample's use of matrices
Propose a standard way to talk about the camera (etc) in SkCanvas:
- client provides 3 matrices: viewport, projection, camera
- canvas->concat(viewport * projection * camera * invert(viewport)
- camera and projection are taken straight from the textbook for 3D
- "viewport" means a matrix that transforms +-1 square about the origin
  to the clients working canvas. A simple way to describe it is:
  "specify the area-of-interest with a rectangle and z_scale"

Expose the ctm as a 44 from canvas for now. Likely we will add these
3 new matrices to canvas, and each may have a getter.

Bug: skia:
Change-Id: I6fa79c56956e060c17569848a81e13c13cb0981a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264221
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-14 15:56:12 +00:00
Robert Phillips
c558f72165 Compressed texture API cleanup
Change-Id: I020bf6e79b5511adbd89931120feb76f359d83aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264056
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-13 21:11:21 +00:00
Mike Reed
9403c3897f Revert "Reland "Revert "allow clients to opt into new didTranslate/didScale"""
This reverts commit f66bba6018.

Reason for revert: sheriff thinks it may be the bot, so landing

Original change's description:
> Reland "Revert "allow clients to opt into new didTranslate/didScale""
> 
> This reverts commit d7ce7ac8d1.
> 
> Reason for revert: breaks Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker
> 
> Original change's description:
> > Revert "Revert "allow clients to opt into new didTranslate/didScale""
> > 
> > This reverts commit 4a46758db8.
> > 
> > Add guard to Flutter
> > 
> > Change-Id: Ief0e5cb36af13c8f00a36a617d0384622012d644
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263937
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
> 
> TBR=reed@google.com
> 
> Change-Id: I3291c4dfe18d6e751e61f55ed9b22a01f0c8ad72
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263860
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I3111a034291c2320e5ff33f8c2072354f836440f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263939
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-13 14:41:12 +00:00
Mike Reed
f66bba6018 Reland "Revert "allow clients to opt into new didTranslate/didScale""
This reverts commit d7ce7ac8d1.

Reason for revert: breaks Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker

Original change's description:
> Revert "Revert "allow clients to opt into new didTranslate/didScale""
> 
> This reverts commit 4a46758db8.
> 
> Add guard to Flutter
> 
> Change-Id: Ief0e5cb36af13c8f00a36a617d0384622012d644
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263937
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I3291c4dfe18d6e751e61f55ed9b22a01f0c8ad72
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263860
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-12 20:06:08 +00:00
Mike Reed
d7ce7ac8d1 Revert "Revert "allow clients to opt into new didTranslate/didScale""
This reverts commit 4a46758db8.

Add guard to Flutter

Change-Id: Ief0e5cb36af13c8f00a36a617d0384622012d644
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263937
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-12 19:53:18 +00:00
Mike Reed
4a46758db8 Revert "allow clients to opt into new didTranslate/didScale"
This reverts commit cb6b9e3c35.

Reason for revert: flutter-roll, and possibly Debian10?

Original change's description:
> allow clients to opt into new didTranslate/didScale
> 
> Before
>     148.97  	canvas_matrix_4x4	8888
>     139.96  	canvas_matrix_3x3	8888
>     139.81  	canvas_matrix_2x3	8888
>     183.13  	canvas_matrix_scale	8888
>     153.72  	canvas_matrix_trans	8888
> 
> After
>     ...
>     114.68  	canvas_matrix_scale	8888
>     112.96  	canvas_matrix_trans	8888
> 
> Change-Id: I79d20ea6ab6aa9609143c7abf4acaa8ca08dd58f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263818
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I49f6c7af4917cf268fa2ed009677748b7d4a3bbc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-12 10:56:38 +00:00
Mike Reed
cb6b9e3c35 allow clients to opt into new didTranslate/didScale
Before
    148.97  	canvas_matrix_4x4	8888
    139.96  	canvas_matrix_3x3	8888
    139.81  	canvas_matrix_2x3	8888
    183.13  	canvas_matrix_scale	8888
    153.72  	canvas_matrix_trans	8888

After
    ...
    114.68  	canvas_matrix_scale	8888
    112.96  	canvas_matrix_trans	8888

Change-Id: I79d20ea6ab6aa9609143c7abf4acaa8ca08dd58f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263818
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-12 01:40:57 +00:00
Mike Reed
a3a704afa3 Override didTranslate, and add virtual for didScale
This completes pushing through the new virtual didConcat44() to our
subclasses, and introduces didScale() for future optimizations. We
don't call didScale yet, until external subclasses are also updated.

This was derived from https://skia-review.googlesource.com/c/skia/+/263349

bug: skia: 9768
Change-Id: Ia26b48e76e323037082e8f2ee83673c26b99ebed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263702
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-11 02:11:26 +00:00
Mike Reed
f6d70a8e3f Revert "Revert "forward concat44 in nway canvas""
This reverts commit 3723fb7e85.

Fix: don't call the inherited methods on canvas

bug: skia: 9768
Change-Id: Ifb913bd30452ba8389399f709d40c7b58d6157d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263776
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-10 22:01:41 +00:00
Mike Reed
3723fb7e85 Revert "forward concat44 in nway canvas"
This reverts commit 8964bc13da.

Reason for revert: break flutter unittest?

Original change's description:
> forward concat44 in nway canvas
> 
> Change-Id: If4eb791c0701fb7055283e721308bd3c633576d7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263572
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I0c8e3b3d0df05948f935ffa6d72ea84ef420b7cc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263714
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-10 20:27:12 +00:00
Mike Reed
8964bc13da forward concat44 in nway canvas
Change-Id: If4eb791c0701fb7055283e721308bd3c633576d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263572
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-10 17:23:51 +00:00
Brian Osman
504032e575 SkRuntimeEffect: Fix 'in' variables in CPU backend
We were never calling specialize() to bake in the values of ins,
so do that. Add uniformSize() to get the size of just the uniform
values. (The interpreter asserts that the size of the uniforms
being passed in matches the expected size from the ByteCode,
so these need to match up).

Added a unit test that uses both 'in' and 'uniform'.

Change-Id: I595822171211d35a17d5977fa790de0d1bbd6c78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263519
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-10 15:46:22 +00:00
Mike Reed
a092028439 Revert "new virtuals for canvas ctm"
This reverts commit 2076b04d15.

Reason for revert: speculative: breaking google3 flutter scuba?

Original change's description:
> new virtuals for canvas ctm
> 
> 1. Feature: Clients need to override didConcat44() (new data)
> 2. Perf: Clients need to override didTranslate (and now didScale) so our
>          default impls can be empty.
> 
> Need SK_SUPPORT_LEGACY_CANVAS_MATRIX_VIRTUALS flag to stage this in
> clients (anyone who subclasses SkCanvas)
> 
> Before (with flag)
>     120.87  	canvas_matrix_4x4	8888
>     108.10 ?	canvas_matrix_3x3	8888
>     108.13 ?	canvas_matrix_2x3	8888
>     141.54  	canvas_matrix_scale	8888
>     128.04  	canvas_matrix_trans	8888
> 
> After (without the flag)
>     ...
>      90.79  	canvas_matrix_scale	8888
>      94.51  	canvas_matrix_trans	8888
> 
> bug: skia:9768
> 
> Change-Id: I6f500138dd6b2b24754dc065c650d0bd3c341540
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263349
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I9c2e39ea0aa2b19d40eb6454c233258ab7f35829
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263564
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-10 14:26:41 +00:00
Mike Reed
2076b04d15 new virtuals for canvas ctm
1. Feature: Clients need to override didConcat44() (new data)
2. Perf: Clients need to override didTranslate (and now didScale) so our
         default impls can be empty.

Need SK_SUPPORT_LEGACY_CANVAS_MATRIX_VIRTUALS flag to stage this in
clients (anyone who subclasses SkCanvas)

Before (with flag)
    120.87  	canvas_matrix_4x4	8888
    108.10 ?	canvas_matrix_3x3	8888
    108.13 ?	canvas_matrix_2x3	8888
    141.54  	canvas_matrix_scale	8888
    128.04  	canvas_matrix_trans	8888

After (without the flag)
    ...
     90.79  	canvas_matrix_scale	8888
     94.51  	canvas_matrix_trans	8888

bug: skia:9768

Change-Id: I6f500138dd6b2b24754dc065c650d0bd3c341540
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263349
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-01-10 13:30:11 +00:00
Mike Reed
6f48542252 remove cruft bools from canvas
Change-Id: Ic035e2ba24a9c1f8b5b9af56471c130c9efc158c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263562
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-09 22:24:54 +00:00
Jim Van Verth
06184a22c0 Hide MakeFromMTKView behind an availability flag
MTKView is only available on iOS 9.0 and later, so this method can't
be used on earlier OSes.

Change-Id: I3ba8786953c990ded771c856c8c54b9ae1e2b3cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263520
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-09 20:04:45 +00:00
Brian Salomon
ccb6142956 Allow implicit conversion from GrSamplerState::Filter to GrSamplerState
constexprify GrSamplerState

pass/return GrSamplerState by value (it's 3 bytes).

Remove unused function from GrTexturePriv

Change-Id: Iffecd941500acf5653f01cc88b42ff1d45678b54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263346
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-09 17:29:54 +00:00
Brian Osman
a88cab1ad9 Add CachingHint to makeRasterImage, default to kDisallow
When a client calls makeRasterImage, they're likely to hold on to that
image, and throw away the source (GPU or Lazy). In that situation, it
makes no sense to leave the buffer in the resource cache.

Change-Id: Ic0be8ceb643ed9196526469516be0d200bea42fd
Bug: b/144232910
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263347
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-09 15:51:24 +00:00
Mike Reed
620cedaa5e Remove legacy canvas-matrix impl
Chrome (the only user of the flag) is now updated.

Change-Id: I137f471588238f2b1cd4bc6013affb8075d0c561
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263341
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-09 14:49:43 +00:00
Mike Reed
064c7f9f1c Optimize concat44 on canvas
- allow clients to pass in raw-array at public level
- rewrite m44 concat to take raw-array for 2nd input

Extended canvas_matrix bench to also time 44 concats:

Before
    207.51  	canvas_matrix_4x4	8888
    100.75 ?	canvas_matrix_3x3	8888
    100.79  	canvas_matrix_2x3	8888
    140.93  	canvas_matrix_scale	8888
    133.35  	canvas_matrix_trans	8888

After
    120.80  	canvas_matrix_4x4	8888
    ...

bug: skia:9768

Change-Id: Iaa361b9897a183d930fd31aa67327caed25cd51d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263209
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-09 13:39:17 +00:00
Kevin Lubick
f5bc8fba95 [canvaskit] Create an SkImage from a frame of an SkAnimatedImage
Flutter on the web wants to be able to extract arbitrary frames from
an animated image and pass those into functions like:
drawAtlas, drawImage, drawImageRect

This should allow that to happen w/o having to add lots of variants like
drawAnimatedImage. If this sticks, is drawAnimatedImage still useful?
(maybe it saves a copy?)

Change-Id: I99d7045c5dea61d0a1bd6d335c88e7517f2c4fc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263020
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-09 13:25:43 +00:00
Brian Osman
f72deddb89 Expose the Input variable and Child name collections in SkRuntimeEffect
Add framework for unit tests that draw (CPU and GPU) with a runtime
shader, as well as couple example tests.

Change-Id: I43b3b39e86634ec55521a2689a4c55c21939dce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262809
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-08 19:23:13 +00:00
Greg Daniel
e20fcad156 Reland "Move makeDeferredRenderTargetContext calls to factory on RTC."
This reverts commit a4f207eb67.

Reason for revert: Landing with fix

Original change's description:
> Revert "Move makeDeferredRenderTargetContext calls to factory on RTC."
>
> This reverts commit 1c16b43033.
>
> Reason for revert: Red on tree
> Original change's description:
> > Move makeDeferredRenderTargetContext calls to factory on RTC.
> >
> > Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com
>
> Change-Id: I9e3c9d13c66b5437c87ad7136d283fa4ac81df1f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263019
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

Change-Id: If4ec8316a952fb482471c22273f4724f9b30a998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263022
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-08 19:13:14 +00:00
Jim Van Verth
e27670172b Add method to delay drawable acquisition from MTKView
Change-Id: Iad9fadd113d0c97e8ece51df19c7824252d7eb9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263197
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-08 18:28:13 +00:00
Mike Reed
403c807971 Revert "Revert "Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.""
The reason for the assert was breaking an assert, that if the CTM was scale/translate, that after
a preTranslate, it should still be that.

This is true... unless the new translate values are non-finite. In that case, we might turn a zero
into a NaN, (0 * non_finite --> nan), so we either have to require finite args (which we don't
at the moment) or we can't make this assert. This re-land removes that assert.

This reverts commit 268ed57d71.

Change-Id: I3c48a0aa17649351a246c1fbab5449f2d59aaf84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263023
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-08 16:13:51 +00:00
Brian Osman
268ed57d71 Revert "Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API."
This reverts commit 98bfcc7ff3.

Reason for revert: Flutter hitting assert:
../../third_party/skia/src/core/SkCanvas.cpp:1432: fatal error: "assert(fIsScaleTranslate == fMCRec->fMatrix.isScaleTranslate())"

Original change's description:
> Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.
> 
> Devices receive the 4x4, but by default they simply downsample it to SkMatrix.
> 
> New SkM44 matrix for the impl. It differs from SkMatrix44 in a few ways
> - no tracking of "type"
> - faster for concat, as it does not use doubles for intermediates
> - much simpler API
> 
> There are some low-bit differences in some gms, so adding a flag for clients to
> stage this change. (due to faster but lower-precision in SkM44::concat)
> 
> Performance: running canvas_matrix bench
> 
> 3x3 version:
> 
>     167.93  	canvas_matrix_3x3	8888
>     209.97  	canvas_matrix_2x3	8888
>     174.87  	canvas_matrix_scale	8888
>     135.30  	canvas_matrix_trans	8888
> 
> 4x4 version:
> 
>     116.59  	canvas_matrix_3x3	8888
>     105.40  	canvas_matrix_2x3	8888
>     159.83 ?	canvas_matrix_scale	8888
>     113.47  	canvas_matrix_trans	8888
> 
> Why faster?
> - not tracking matrix_type helps a lot it seems
> - faster full concat (no doubles)
> 
> Before adding the specialized preConcats...
> 
>     318.11 ?	canvas_matrix_3x3	8888
>     339.38  	canvas_matrix_2x3	8888
>     383.28  	canvas_matrix_scale	8888
>     251.67  	canvas_matrix_trans	8888
> 
> Change-Id: I68eac942919fa5418081e789f31710a1e2a752da
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262056
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,bsalomon@google.com,herb@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,michaelludwig@google.com

Change-Id: I28c3d69c19ba44ab65ca7c059221b64c7dffef22
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263021
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-08 14:28:11 +00:00
Jim Van Verth
a4f207eb67 Revert "Move makeDeferredRenderTargetContext calls to factory on RTC."
This reverts commit 1c16b43033.

Reason for revert: Red on tree
Original change's description:
> Move makeDeferredRenderTargetContext calls to factory on RTC.
> 
> Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: I9e3c9d13c66b5437c87ad7136d283fa4ac81df1f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263019
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-08 13:31:21 +00:00
Greg Daniel
1c16b43033 Move makeDeferredRenderTargetContext calls to factory on RTC.
Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-07 21:14:13 +00:00
Chris Dalton
b832ce61ee Add a path renderer that uses GPU tessellation
Implements a simple first pass for a path renderer that uses the
classic Red Book "stencil then cover" method, and linearizes curves
with GPU tessellation shaders.

The new path renderer is disabled by default, and can only be enabled
in the viewer UI or by passing the "--pr gtess" flag.

Change-Id: Ic9354952e93c8b108577961760b4f0daa82d35aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261715
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-01-07 20:00:22 +00:00
Mike Reed
98bfcc7ff3 Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.
Devices receive the 4x4, but by default they simply downsample it to SkMatrix.

New SkM44 matrix for the impl. It differs from SkMatrix44 in a few ways
- no tracking of "type"
- faster for concat, as it does not use doubles for intermediates
- much simpler API

There are some low-bit differences in some gms, so adding a flag for clients to
stage this change. (due to faster but lower-precision in SkM44::concat)

Performance: running canvas_matrix bench

3x3 version:

    167.93  	canvas_matrix_3x3	8888
    209.97  	canvas_matrix_2x3	8888
    174.87  	canvas_matrix_scale	8888
    135.30  	canvas_matrix_trans	8888

4x4 version:

    116.59  	canvas_matrix_3x3	8888
    105.40  	canvas_matrix_2x3	8888
    159.83 ?	canvas_matrix_scale	8888
    113.47  	canvas_matrix_trans	8888

Why faster?
- not tracking matrix_type helps a lot it seems
- faster full concat (no doubles)

Before adding the specialized preConcats...

    318.11 ?	canvas_matrix_3x3	8888
    339.38  	canvas_matrix_2x3	8888
    383.28  	canvas_matrix_scale	8888
    251.67  	canvas_matrix_trans	8888

Change-Id: I68eac942919fa5418081e789f31710a1e2a752da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262056
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-07 18:23:04 +00:00
Brian Salomon
44207f34ea Remove SkIRect::EmptyIRect
Replace with SkIRect::MakeEmpty.

Docs-Preview: https://skia.org/?cl=262382
Change-Id: I001cc76f4af223490be3734bb461ab4fca36d710
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262382
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-06 20:57:56 +00:00
Brian Salomon
e994380d00 Some GrTypes cleanup.
Remove some unused functions/macros.

Move two functions only used by GrBufferAllocPool there.

We only ever used GrSizeAlignUp with pow 2 alignments. Require that,
rename, move to GrTypesPriv.h (along with GrSizeDivRoundUp).

Change-Id: I1a7248952d1905f16f02de2028d65768b186acee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262061
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-03 19:49:07 +00:00
Brian Osman
ee426f223f Move SkRuntimeEffect.h to include/effects
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 17:37:46 +00:00
Chris Dalton
37ae4b06e2 Rename GpuPathRenderers::kAll to kDefault
There was never a need to distinguish between "all" and "default".
We can just use kDefalut everywhere. And as we add new path renderers,
we can exclude them from kDefault until they are ready to ship.

Change-Id: I378aa1e195d40daef6a2c54f9c8e829208780ebe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261714
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-31 01:01:17 +00:00
Chris Dalton
e1196c5d01 Add a mechanism to insert framebuffer barriers for NVIDIA tessellation
Bug: skia:9739
Change-Id: I4f13110c30af796edded1d0e18860bcb4a6ef925
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261673
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-12-31 00:18:36 +00:00
Mike Reed
1fb6aed9ba simplify normalizePerspective -- don't compute type, precheck corner value
Before
min	median	mean	max	bench
163µs	167µs	169µs	183µs	canvas_matrix_3x3
250µs	265µs	261µs	280µs	canvas_matrix_2x3
227µs	264µs	250µs	269µs	canvas_matrix_scale
187µs	190µs	190µs	194µs	canvas_matrix_trans

After
min	median	mean	max	bench
168µs	177µs	180µs	207µs	canvas_matrix_3x3
200µs	220µs	222µs	245µs	canvas_matrix_2x3
173µs	182µs	179µs	186µs	canvas_matrix_scale
138µs	148µs	147µs	166µs	canvas_matrix_trans

Change-Id: Iba884c64a53c4c6d4a53a72fe9de783ebef21bf4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261741
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-12-30 16:49:56 +00:00
Chris Dalton
5a2f962313 Add back door support for GLSL tessellation shaders
Implements tessellation support at the Ganesh level, and adds back
door methods for supplying raw GLSL strings directly to the OpenGL
driver. Adds a new gm to verify tessellation is works in GL.

Change-Id: Idfc285b955cbe5e8e6bf0475be8b518b0cc6ed2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261196
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-12-27 22:34:10 +00:00
Khushal Sagar
988db63351 gpu: Disable dual source blending support on buggy driver versions.
R=bsalomon@google.com

Bug:1027981
Change-Id: I1f0704451fadcd845a0f8845d728f4b8986d88ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261211
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
2019-12-20 22:56:19 +00:00
Robert Phillips
8f259a0329 Add BC1_RGB8_UNORM support
This is working in the GL and Vulkan back ends. MacOS only supports the RGBA8 variants.
For mobile devices, probably only nVidia GPUs will support this.

Bug: skia:9680
Change-Id: I9d886b72232a031603e93e46059a97a8aa288b3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261093
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-20 21:41:09 +00:00
Michael Ludwig
2c316bdbfe Arenas struct for GrRecordingContext
Change-Id: If05370b0970af5daf976d60e1fc97f2fab3c213e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261082
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-20 19:26:36 +00:00
Robert Phillips
9f744f7ece Change GrGpu::onCreateCompressedTexture signature
In the previous form there was some duplication between the backend format and the SkImage::CompressionType being passed around.

Bug: skia:9680
Change-Id: I04455b7a4289bec83d87be17b75b4e9d4d6ef2e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261184
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-20 15:37:26 +00:00
Greg Daniel
bfa19c4e76 Add factories to GrSurfaceContext and clean up creation flow.
This CL updates all callers that ending up in GrDrawingManager::makeSurfaceContext
to use the new factory or directly call ctors.

A follow on change will get the rest of the calls which go to
GrDrawingManager::makeRenderTargetContext

Change-Id: I662da654a1ec8b8972c50fe9ce45a9185d4c3dc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260901
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-20 15:05:56 +00:00