Commit Graph

873 Commits

Author SHA1 Message Date
Brian Salomon
967df200bd Deuninstantiate
Uninstantiated: a state of not being instantiated.

Deinstantiate: transition from instantiated to uninstantiated state.

Change-Id: Id7b6b295267674a9915f95105d73fabfcc3555de
Reviewed-on: https://skia-review.googlesource.com/c/175586
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-07 16:54:52 +00:00
Brian Salomon
246bc3d6cb Revert "Revert "Use unnormalized coords all the way through with GL_TEXTURE_RECTANGLE textures.""
This reverts commit 47be94abd1.

Change-Id: I37d3c727ded6501b143381d46d3b00faad3afd75
Reviewed-on: https://skia-review.googlesource.com/c/175421
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-06 21:12:09 +00:00
Brian Osman
d3e7130dc9 Add a hash of all vertex attributes to the GrProgramDesc key
Recent work to dynamically switch the CPU type of the color attribute
exposed this problem - we were ignoring the attribute types, and getting
cache hits on incorrect GrProgram objects with stale layout information.

This fixes GMs in configs that may use F16 colors (eg glenarrow).

Bug: skia:
Change-Id: Ic87c47601c26e53c2173713a6cf14d209af8e246
Reviewed-on: https://skia-review.googlesource.com/c/175243
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-12-06 17:28:37 +00:00
Brian Salomon
9cadc314b6 Reland "Bypass interval tracking and assignment of read-only texures in GrResourceAllocator."
This is a reland of 1b04794234

Original change's description:
> Bypass interval tracking and assignment of read-only texures in GrResourceAllocator.
> 
> Bug: skia:8509
> 
> Change-Id: Idecf3a5335945c9ff21f27cd3f7887125214d02d
> Reviewed-on: https://skia-review.googlesource.com/c/174592
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:8509
Change-Id: I26eaf9606e2b9c238e40a230a8eda15e97400515
Reviewed-on: https://skia-review.googlesource.com/c/175251
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-06 16:33:02 +00:00
Brian Salomon
47be94abd1 Revert "Use unnormalized coords all the way through with GL_TEXTURE_RECTANGLE textures."
This reverts commit 10273c1d5f.

Reason for revert: bad gms

Original change's description:
> Use unnormalized coords all the way through with GL_TEXTURE_RECTANGLE textures.
> 
> We used to unnormalize them in the shader via SkSL.
> 
> This allows us to support GL_TEXTURE_RECTANGLE without having textureSize()
> available in GLSL.
> 
> Change-Id: Ibe63a302228811933ef000251db4cad9aaf4f2ea
> Reviewed-on: https://skia-review.googlesource.com/c/174068
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I9bf38e1040578becba28ac8cccd81e2af2844278
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/175252
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-06 15:50:36 +00:00
Jim Van Verth
69e5785d9f Add RG_88 texture format
Bug: skia:7903
Change-Id: I69b65fc1cfcc2cc5045bb3b75395f9a256ade278
Reviewed-on: https://skia-review.googlesource.com/c/172979
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-12-06 15:36:31 +00:00
Brian Salomon
c67c31ced1 Revert "Revert "Mark wrapped textures imported into SkImages as "read only".""
This reverts commit ff4ccaa9fc.

Bug: skia:8509
Change-Id: If4a059d6e6e412ec1d6be2c70663d59c362e91d2
Reviewed-on: https://skia-review.googlesource.com/c/175249
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-06 15:34:31 +00:00
Brian Salomon
ff4ccaa9fc Revert "Mark wrapped textures imported into SkImages as "read only"."
This reverts commit 796693af3c.

Reason for revert: texture flags assertion in DDL config

Original change's description:
> Mark wrapped textures imported into SkImages as "read only".
> 
> Read only textures and proxies fail writePixels, as copy dsts, and mip
> regeneration.
> 
> Bug: skia:8509
> 
> Change-Id: Iaa0b473cc9a9930fde3ef0e91373d5040650de35
> Reviewed-on: https://skia-review.googlesource.com/c/174316
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: If5cb36e83795656185ff8d26e4ef2c52a2695a09
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8509
Reviewed-on: https://skia-review.googlesource.com/c/174846
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-05 21:35:40 +00:00
Brian Salomon
c60935369a Revert "Bypass interval tracking and assignment of read-only texures in GrResourceAllocator."
This reverts commit 1b04794234.

Reason for revert: Reverting to revert another CL

Original change's description:
> Bypass interval tracking and assignment of read-only texures in GrResourceAllocator.
> 
> Bug: skia:8509
> 
> Change-Id: Idecf3a5335945c9ff21f27cd3f7887125214d02d
> Reviewed-on: https://skia-review.googlesource.com/c/174592
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I4a6d0a88f2b817435b09e1b690aaa651ed8f3dd8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8509
Reviewed-on: https://skia-review.googlesource.com/c/174845
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-05 21:34:41 +00:00
Brian Salomon
1b04794234 Bypass interval tracking and assignment of read-only texures in GrResourceAllocator.
Bug: skia:8509

Change-Id: Idecf3a5335945c9ff21f27cd3f7887125214d02d
Reviewed-on: https://skia-review.googlesource.com/c/174592
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-12-05 20:37:58 +00:00
Brian Salomon
796693af3c Mark wrapped textures imported into SkImages as "read only".
Read only textures and proxies fail writePixels, as copy dsts, and mip
regeneration.

Bug: skia:8509

Change-Id: Iaa0b473cc9a9930fde3ef0e91373d5040650de35
Reviewed-on: https://skia-review.googlesource.com/c/174316
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-12-05 20:12:42 +00:00
Brian Salomon
10273c1d5f Use unnormalized coords all the way through with GL_TEXTURE_RECTANGLE textures.
We used to unnormalize them in the shader via SkSL.

This allows us to support GL_TEXTURE_RECTANGLE without having textureSize()
available in GLSL.

Change-Id: Ibe63a302228811933ef000251db4cad9aaf4f2ea
Reviewed-on: https://skia-review.googlesource.com/c/174068
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-12-05 20:08:06 +00:00
Mike Klein
0ec1c571c8 remove sk_atomic_inc
Change-Id: I4960b1cd055daf44637e95825f82cb7fe2ce134a
Reviewed-on: https://skia-review.googlesource.com/c/174285
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-12-04 19:01:47 +00:00
Mike Klein
de2244cbda remove sk_atomic_dec
This turns out to be mostly deleting dead debugging code.

Change-Id: I4969ea380e6125e8b557d430c6720edc0a337a79
Reviewed-on: https://skia-review.googlesource.com/c/174284
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-12-04 17:58:35 +00:00
Mike Klein
8912a5d240 remove sk_atomic_fetch_add
Change-Id: Ia400db2b73a8061668e62f8e961538a060b216a1
Reviewed-on: https://skia-review.googlesource.com/c/174282
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-12-04 15:53:16 +00:00
Mike Klein
820e79b86c remove sk_atomic_load and sk_atomic_store
Change-Id: I6eb4469df0315283f96631ff6023170fa80aaa8a
Reviewed-on: https://skia-review.googlesource.com/c/174281
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-12-04 15:42:01 +00:00
Mike Klein
b24f7f45c2 remove sk_atomic_compare_exchange
Whatever nonsense SkPicture::uniqueID() was doing, it doesn't
need to do it.  It can just get its unique ID normally.

I've ported SkEventTracer in the straightforward way.

Change-Id: I103e7e05258ad49e1e3f333fc907f039cef3f8c9
Reviewed-on: https://skia-review.googlesource.com/c/174280
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-12-04 15:14:20 +00:00
Mike Klein
2d9e543a58 some SkAtomics cleanup
- Replace sk_memory_order with std::memory_order.
 - Remove SkAtomic<T>.

SkPath was the only user of SkAtomic<T>, for its fConvexity and
fFirstDirection fields.  I've replaced them with std::atomic types, and
funneled access to them through methods that enforce the relaxed memory
order like SkAtomic<T> did.

For fConvexity, we can use the exisiting setConvexity() and
getConvexityOrUnknown() methods, adding a private const setConvexity()
to mutate convexity from const methods.  For fFirstDirection I've added
private setFirstDirection() and getFirstDirection() methods.

Removing SkAtomic<T> means SkAtomics.h no longer needs SkNoncopyable.h.
I've had to update a bunch of other headers that were depending on
transitive inclusion.

Change-Id: Ib238be71a121519db6e970a9a8955834e1298c87
Reviewed-on: https://skia-review.googlesource.com/c/174220
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-04 13:53:39 +00:00
Greg Daniel
45723ac931 Take into accout the GrBackendFormat when deciding if we can chain textures together.
Bug: skia:
Change-Id: I8c26bed1bb18318f96d248c227e3b33b190d2a05
Reviewed-on: https://skia-review.googlesource.com/c/173320
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-03 16:54:40 +00:00
Mike Reed
07105bbcbe don't trust convexity after a transform
In theory, a convex shape is still convex if transformed by an affine
matrix. However, SkPath segments are specified using floats, and attributes
like collinearity can break under some transforms due to finite precision.

Computing convexity is non-trivial, so there is value in SkPath caching this
calculation. Convexity is useful, as both the CPU and GPU backends can draw
convex shapes faster than non-convex.

To balance these two (fragile float math and value of caching convexity),
this CL invalidates this cached state if the transform could change convexity.
In the general case, it is assumed that convexity could change. Special cases
where it is safe to keep the cached state after transform are:
- identity transform
- scale/translate transform if the path is known to be axis-aligned
All other combinations invalidate the cached state, forcing it to be
recomputed.

"axis-aligned" means the segments in the path are all axis-aligned, horizontal
or vertical (e.g. a rect or rrect)

Bug: 899689
Change-Id: I1381273eaff61d6b7134ae94b4f251c69991081a
Reviewed-on: https://skia-review.googlesource.com/c/173226
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
2018-12-01 21:17:34 +00:00
Brian Salomon
2335644771 Fix occurrences of "-Wextra-semi-stmt"
Docs-Preview: https://skia.org/?cl=173761
Change-Id: Iefdb91cd28eabb4b01b7b42a4f300b0b4caf05d9
Reviewed-on: https://skia-review.googlesource.com/c/173761
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-11-30 23:23:09 +00:00
Herb Derby
df246b9c1b Add explicit to ctor
Change-Id: I4232d23e0c2dfe46695e948c46f2745c8e7e555c
Reviewed-on: https://skia-review.googlesource.com/c/172945
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2018-11-27 18:11:30 +00:00
Brian Salomon
52a6ed3d4c Fix audit trail when ops merge after chaining change.
This fixes a crash in skiaserve when running in GPU mode.

Remove GR_AUDIT_TRAIL_OP_RESULT_NEW. This macro doesn't do anything and
is non-trivial to know when to call if a new op gets chained.

Change-Id: Ic2a9c09e3d15541a566534654b2393cb740fa302
Reviewed-on: https://skia-review.googlesource.com/c/172864
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-11-26 15:59:07 +00:00
Brian Osman
cfec9d567b Use GrVertexWriter for GrAAStrokeRectOp
Bug: skia:
Change-Id: I2d166ed6c1cb1c13a91526e2f0340623e0436003
Reviewed-on: https://skia-review.googlesource.com/c/171782
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-20 17:09:07 +00:00
Greg Daniel
4065d45d2d Reland "Reland "Have a GrBackendFormat be stored on gpu proxies.""
This is a reland of 2f9a5ea639

Original change's description:
> Reland "Have a GrBackendFormat be stored on gpu proxies."
> 
> This reverts commit 919c9e77c3.
> 
> Reason for revert: Flutter change has landed and fixed memory issue.
> 
> Original change's description:
> > Revert "Have a GrBackendFormat be stored on gpu proxies."
> >
> > This reverts commit 51b1c12bbc.
> >
> > Reason for revert: reverting till flutter gets to 1.1 to fix build issues.
> >
> > Original change's description:
> > > Have a GrBackendFormat be stored on gpu proxies.
> > >
> > > Bug: skia:
> > > Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90
> > > Reviewed-on: https://skia-review.googlesource.com/c/168021
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
> >
> > Change-Id: I574fdc084ef5994596c51fb0d60423b5dc01b885
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: chromium:903701 chromium:903756
> > Reviewed-on: https://skia-review.googlesource.com/c/169835
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
> 
> Change-Id: Ifd9b6b8e194af9fb9258fa626644e76e6ecf090d
> Bug: chromium:903701 chromium:903756
> Reviewed-on: https://skia-review.googlesource.com/c/170104
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: chromium:903701 chromium:903756
Change-Id: Id1360067d8e928b0a4e1848dae8bc1e7f1994403
Reviewed-on: https://skia-review.googlesource.com/c/171660
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2018-11-19 18:51:07 +00:00
Brian Osman
3d139a4e02 Use half floats for non-normalized color in GrTextureOp
Bug: skia:
Change-Id: Ie681369ef4b1d3d43c326da684afde9ce6d08486
Reviewed-on: https://skia-review.googlesource.com/c/171726
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-19 18:20:57 +00:00
Brian Osman
5c8a6b3238 Add helpers to deal with byte vs. half-float vertex colors
GrVertexColor stores either kind of color, and GrVertexWriter does the
right thing. SkColor4fPrepForDst helps to automate the conversion and
pinning. This ensures that colors are already pinned if the device has
no support for half-floats. This way, ops never need to worry about caps,
they can just check if all colors they're batching are normalized.

Bug: skia:
Change-Id: Ie0c15d3b16c6fc93a7f11d284029d77d482a6283
Reviewed-on: https://skia-review.googlesource.com/c/171725
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-19 17:32:39 +00:00
Brian Osman
a89316d822 Add SkPMColor4fFitsInBytes
Used in upcoming changes to decide between byte and half-float
vertex attributes for Ops that store paint colors in vertices.

Bug: skia:
Change-Id: Idbcc801b15c1d99c604fc393cde18032ae5702c6
Reviewed-on: https://skia-review.googlesource.com/c/170262
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-16 16:41:30 +00:00
Brian Osman
4013913f83 Do CCPR hairline coverage scaling in floats, rather than bytes
This is going to be faster, and it's the last usage of GrColorMul

Bug: skia:
Change-Id: I2ecbed55ec401792f8d8f8ab9dc91a14182094b4
Reviewed-on: https://skia-review.googlesource.com/c/171520
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-16 15:58:17 +00:00
Greg Daniel
d7157b2ccf Revert "Reland "Have a GrBackendFormat be stored on gpu proxies.""
This reverts commit 2f9a5ea639.

Reason for revert: breaking fuchsia

Original change's description:
> Reland "Have a GrBackendFormat be stored on gpu proxies."
> 
> This reverts commit 919c9e77c3.
> 
> Reason for revert: Flutter change has landed and fixed memory issue.
> 
> Original change's description:
> > Revert "Have a GrBackendFormat be stored on gpu proxies."
> >
> > This reverts commit 51b1c12bbc.
> >
> > Reason for revert: reverting till flutter gets to 1.1 to fix build issues.
> >
> > Original change's description:
> > > Have a GrBackendFormat be stored on gpu proxies.
> > >
> > > Bug: skia:
> > > Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90
> > > Reviewed-on: https://skia-review.googlesource.com/c/168021
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> >
> > TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
> >
> > Change-Id: I574fdc084ef5994596c51fb0d60423b5dc01b885
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: chromium:903701 chromium:903756
> > Reviewed-on: https://skia-review.googlesource.com/c/169835
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
> 
> Change-Id: Ifd9b6b8e194af9fb9258fa626644e76e6ecf090d
> Bug: chromium:903701 chromium:903756
> Reviewed-on: https://skia-review.googlesource.com/c/170104
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: Ia0556355e5775b2100901b7bfa37f97bb6ccd90f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:903701 chromium:903756
Reviewed-on: https://skia-review.googlesource.com/c/171002
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2018-11-14 15:28:15 +00:00
Greg Daniel
2f9a5ea639 Reland "Have a GrBackendFormat be stored on gpu proxies."
This reverts commit 919c9e77c3.

Reason for revert: Flutter change has landed and fixed memory issue.

Original change's description:
> Revert "Have a GrBackendFormat be stored on gpu proxies."
>
> This reverts commit 51b1c12bbc.
>
> Reason for revert: reverting till flutter gets to 1.1 to fix build issues.
>
> Original change's description:
> > Have a GrBackendFormat be stored on gpu proxies.
> >
> > Bug: skia:
> > Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90
> > Reviewed-on: https://skia-review.googlesource.com/c/168021
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com
>
> Change-Id: I574fdc084ef5994596c51fb0d60423b5dc01b885
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:903701 chromium:903756
> Reviewed-on: https://skia-review.googlesource.com/c/169835
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

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

Change-Id: Ifd9b6b8e194af9fb9258fa626644e76e6ecf090d
Bug: chromium:903701 chromium:903756
Reviewed-on: https://skia-review.googlesource.com/c/170104
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-11-14 14:52:44 +00:00
Mike Klein
32828eb006 move LCD blits to SkBlitter_ARGB32.cpp
They're only specialized up to SSE2 or NEON,
both of which are typical baseline builds now.

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: If2b2bbd5b002038c68c0064ee78d75911a33b988
Reviewed-on: https://skia-review.googlesource.com/c/170064
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-09 17:03:06 +00:00
Greg Daniel
919c9e77c3 Revert "Have a GrBackendFormat be stored on gpu proxies."
This reverts commit 51b1c12bbc.

Reason for revert: reverting till flutter gets to 1.1 to fix build issues.

Original change's description:
> Have a GrBackendFormat be stored on gpu proxies.
>
> Bug: skia:
> Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90
> Reviewed-on: https://skia-review.googlesource.com/c/168021
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: I574fdc084ef5994596c51fb0d60423b5dc01b885
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:903701 chromium:903756
Reviewed-on: https://skia-review.googlesource.com/c/169835
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-11-09 15:33:23 +00:00
Greg Daniel
51b1c12bbc Have a GrBackendFormat be stored on gpu proxies.
Bug: skia:
Change-Id: Iaf1fb24ab29a61d44e5fa59a5e0867ed02dcda90
Reviewed-on: https://skia-review.googlesource.com/c/168021
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2018-11-08 19:44:55 +00:00
Mike Klein
a4c277b07f make float divide-by-zero fatal
Change-Id: I9ba1caa4862bdf9ffc9c0e637bd69cce91fd8468
Reviewed-on: https://skia-review.googlesource.com/c/168740
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-06 21:56:27 +00:00
Mike Klein
3674336c33 Reland "make enum santizer fatal"
This is a reland of 166dbd3135

Since last attempt,
   - update SkPath::Direction docs
   - kIllegal is not an advanced blend mode

Original change's description:
> make enum santizer fatal
>
> This enum sanitizer checks that all the values of the enum we use fall
> within the range of the enumerated values.
>
> The main thing this helps point out is that the size of enum types in
> C++ need only be large enough to hold the largest declared value; larger
> values are undefined.  In practice, most enums are implemented as ints
> for compatibility with C, so while this hasn't pointed out anything
> egregiously broken, the sanitizer has found a couple possibly dangerous
> situations in our codebase.
>
> For most types using values outside the enum range, we can just
> explicitly size them to int.  This makes their de facto size de jure.
>
> But we need to actually make GrBlendEquation and GrBlendCoeff not store
> values outside their enumerated range.  They're packed into bitfields
> that really can't represent those (negative) values.  So for these I've
> added new kIllegal values to the enums, forcing us to deal with our
> once-silent illegal values a bit more explicitly.
>
> Change-Id: Ib617694cf1aaa83ae99289e9e760f49cb6393a2f
> Reviewed-on: https://skia-review.googlesource.com/c/168484
> Reviewed-by: Brian Osman <brianosman@google.com>

Cq-Include-Trybots: skia.primary:Housekeeper-PerCommit-Bookmaker,Test-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Debug-All-Android
Change-Id: Id93b80bbeae11872542c9b76715e3c3cb10609fd
Reviewed-on: https://skia-review.googlesource.com/c/168582
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-06 17:31:00 +00:00
Mike Klein
f2b35e4fb8 Revert "make enum santizer fatal"
This reverts commit 166dbd3135.

Reason for revert: illegal is not advanced, docs

Original change's description:
> make enum santizer fatal
> 
> This enum sanitizer checks that all the values of the enum we use fall
> within the range of the enumerated values.
> 
> The main thing this helps point out is that the size of enum types in
> C++ need only be large enough to hold the largest declared value; larger
> values are undefined.  In practice, most enums are implemented as ints
> for compatibility with C, so while this hasn't pointed out anything
> egregiously broken, the sanitizer has found a couple possibly dangerous
> situations in our codebase.
> 
> For most types using values outside the enum range, we can just
> explicitly size them to int.  This makes their de facto size de jure.
> 
> But we need to actually make GrBlendEquation and GrBlendCoeff not store
> values outside their enumerated range.  They're packed into bitfields
> that really can't represent those (negative) values.  So for these I've
> added new kIllegal values to the enums, forcing us to deal with our
> once-silent illegal values a bit more explicitly.
> 
> Change-Id: Ib617694cf1aaa83ae99289e9e760f49cb6393a2f
> Reviewed-on: https://skia-review.googlesource.com/c/168484
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=mtklein@chromium.org,mtklein@google.com,brianosman@google.com

Change-Id: I691c08092340a6273e442c0f098b844f7d0363ba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/168581
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-06 16:30:19 +00:00
Mike Klein
166dbd3135 make enum santizer fatal
This enum sanitizer checks that all the values of the enum we use fall
within the range of the enumerated values.

The main thing this helps point out is that the size of enum types in
C++ need only be large enough to hold the largest declared value; larger
values are undefined.  In practice, most enums are implemented as ints
for compatibility with C, so while this hasn't pointed out anything
egregiously broken, the sanitizer has found a couple possibly dangerous
situations in our codebase.

For most types using values outside the enum range, we can just
explicitly size them to int.  This makes their de facto size de jure.

But we need to actually make GrBlendEquation and GrBlendCoeff not store
values outside their enumerated range.  They're packed into bitfields
that really can't represent those (negative) values.  So for these I've
added new kIllegal values to the enums, forcing us to deal with our
once-silent illegal values a bit more explicitly.

Change-Id: Ib617694cf1aaa83ae99289e9e760f49cb6393a2f
Reviewed-on: https://skia-review.googlesource.com/c/168484
Reviewed-by: Brian Osman <brianosman@google.com>
2018-11-06 15:39:50 +00:00
Brian Osman
00b2939890 Remove some more GrColor references
Bug: skia:
Change-Id: I395395b1cd81a1d45ca779b2273015c8ed9fb882
Reviewed-on: https://skia-review.googlesource.com/c/168361
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-06 13:34:25 +00:00
Brian Osman
422f95bce8 Revert "Revert "Use float colors for blend constant""
This reverts commit 5a4f2a341a.

Bug: skia:
Change-Id: I706009343dc1976311a88d57800a140efd776861
Reviewed-on: https://skia-review.googlesource.com/c/168363
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-05 23:46:20 +00:00
Brian Osman
5a4f2a341a Revert "Use float colors for blend constant"
This reverts commit 52065473ee.

Reason for revert: Typo messed up LCD blending

Original change's description:
> Use float colors for blend constant
> 
> Bug: skia:
> Change-Id: Ie2a4b341a5e7762c3e8031fbd0f0d8b1ebae27f1
> Reviewed-on: https://skia-review.googlesource.com/c/168268
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

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

Change-Id: Ieaad5724099e18727296ce312d728a1a9ed45c4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/168362
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-05 21:35:26 +00:00
Brian Osman
52065473ee Use float colors for blend constant
Bug: skia:
Change-Id: Ie2a4b341a5e7762c3e8031fbd0f0d8b1ebae27f1
Reviewed-on: https://skia-review.googlesource.com/c/168268
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-05 20:59:15 +00:00
Brian Osman
9a9baae125 Use SkPMColor4f throughout clear APIs
Bug: skia:
Change-Id: I5386e27edbcf39233880d869841a6632ecb9416c
Reviewed-on: https://skia-review.googlesource.com/c/168261
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-05 20:36:24 +00:00
Brian Osman
e3f543c04e Remove SkPM4f.h, fold contents into SkColorData.h
Bug: skia:
Change-Id: I942e46c2b680714cdd10f7393c6a4d206df645a8
Reviewed-on: https://skia-review.googlesource.com/c/167394
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-02 17:17:16 +00:00
Mike Klein
ff0e8409e1 clean up some odd SkRefCnt features
SkRefCntBase is an implementation detail of SkRefCnt, so let's not
mention it in SkContext_Compute.h.  While I'm here, I notice SkNVRefCnt
would work fine too.

No one else calls internal_dispose_restore_refcnt_to_1(), so we can
inline it.  While here, I notice it's resetting the ref count to 1 even
in release builds.  I'm not sure if that is/can be optimized away, but
in any case I think we can wrap with #ifdef SK_DEBUG, if only to make it
clear that it's only there to support the assert in the destructor.

I've removed validate().  Most of the places it's called read pretty
weird, and I think suggest some sort of class-specific validation than
just checking that we're holding a ref.  SkWeakRefCnt::validate() isn't
called anywhere.

There were few users of getRefCnt() outside SkRefCnt itself, so I
removed the rest and made it private.

I've added a few this-> to self calls while at it.

Change-Id: I98be06677a6e8b8e66f44cbb17d14e38b0f39d38
Reviewed-on: https://skia-review.googlesource.com/c/167160
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-10-31 20:47:16 +00:00
Brian Osman
cf86085583 Replace GrColor4h with SkPMColor4f
- Mechanical replacement of GrColor4h (used throughout Ops) with
  SkPMColor4f.
- API adaptation (to/FromGrColor -> to/From_BytesRGBA).
- Complete removal of FromFloats (source was already SkPMColor4f),
  and toFloats (setting uniforms can directly access .vec()).

Bug: skia:
Change-Id: I37eece1fa7ed2545dc6843e840d4cc3c60f19747
Reviewed-on: https://skia-review.googlesource.com/c/166620
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-10-31 19:25:20 +00:00
Brian Osman
06768fc14b Use std::numeric_limits for SK_FloatNaN and Infinity
The Windows header definitions of NAN and INFINITY involve overflowing
math, making clang treat them as not being constexpr. Now they're
constexpr everywhere.

Bug: skia:
Change-Id: I84c05aae2952a152fed4eceb55cd2680d6fd5b05
Reviewed-on: https://skia-review.googlesource.com/c/166840
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-10-31 18:02:00 +00:00
Brian Salomon
1986f88dd5 Remove unused GrOpList::numOps()
This function was misleading because GrRenderTargetOpList::forwardCombine
can leave holes in the array which were still counted.

It would be harder to track this in op chaining redux.

Change-Id: Ib9619839012cb7dd2d0e4ccac31a231787f90f2d
Reviewed-on: https://skia-review.googlesource.com/c/166442
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-10-30 18:26:54 +00:00
Brian Osman
78252fedaa Switch GrColor4h to use float storage
This is a test CL to measure perf impact on the bots

Bug: skia:
Change-Id: I8aae0ac1373921d4d1b5f92e1f6b2318e66f0032
Reviewed-on: https://skia-review.googlesource.com/c/166283
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-10-30 17:27:27 +00:00
Mike Klein
408ef21c79 Revert "replace SkNVRefCnt with SkRefCnt"
This reverts commit 0fb1ee98cf.

Reason for revert: looks like this increased size by ~8K.

Original change's description:
> replace SkNVRefCnt with SkRefCnt
> 
> SkNVRefCnt trades a small amount of code size (vtable) and runtime
> (vptr) memory usage for a larger amount of code size (templating).  It
> was written back in a time when all we were really thinking about was
> runtime memory usage, so I'm curious to see where performance, code
> size, and memory usage all move if it's removed.
> 
> Looking at the types I've changed here, my guess is that performance and
> memory usage will be basically unchanged, and that code size will drop a
> bit.  Nothing else it's nicer to have only one ref-counting base class.
> 
> Change-Id: I7d56a2b9e2b9fb000ff97792159ea1ff4f5e6f13
> Reviewed-on: https://skia-review.googlesource.com/c/166203
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,bsalomon@google.com,mtklein@chromium.org

Change-Id: Ibcfcc4b523c466a535bea5ffa30d0fe2574c5bd7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/166360
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-30 15:23:06 +00:00