Commit Graph

8141 Commits

Author SHA1 Message Date
Brian Osman
b5f0f52831 SkSL: Salt inline identifiers in PipelineStage and FragmentProcessor passes
Fixes a bug with name conflicts in the final SkSL.

Bug: skia:10526
Change-Id: Ic238f89dd778c186e775ecbaabfbaed9e426274f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305563
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-07-24 19:23:20 +00:00
Robert Phillips
58adb34cda Update more tests to use the GrDirectContext/GrRecordingContext pair
Change-Id: I66011fef006398a95c9f54af97c5c1092b8b7415
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305497
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-24 18:05:30 +00:00
John Stiles
f743d4eb53 Rename Xfermode fragment processor to Blend.
Change-Id: Iaa0829d72d0da1469df2da23102ff0e3572b641b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305556
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-24 13:34:00 +00:00
Brian Salomon
4cfae3bc24 Remove GrTexturePriv
This existed because GrTexture used to be public.

Change-Id: I5e507084ae12058a20481b517b9130b41c793d29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305521
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-24 13:26:07 +00:00
Herb Derby
13e3faebc6 reduce mutex use and switch to spinlock
* Combine find and makeMRU.
* Switch from SkMutex to SkSpinLock

In the gm 'paragraph_$' this reduces acquiring the lock from 1.2% to 0.7%
as measured by instruments and nanobench.

Change-Id: I33e3af31825f175c9de42f001acf68ffe3623a8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305564
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-24 13:26:06 +00:00
Robert Phillips
b25e0650dd Convert more tests to GrDirectContext/GrRecordingContext pair
TBR=bsalomon@google.com
Change-Id: I5bb78f4e36c4037669e7907cbe818da743480ef4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305009
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-23 12:49:06 +00:00
Michael Ludwig
cc848b59f8 Rename GrTAllocator to GrTBlockList
GrTAllocator implies relatively limited use cases, while GrTBlockLinkedList
helps clarify the underlying data structure (and its associated advantages
and disadvantages). I am not beholden to the name, so am happy to have
a discussion on alternatives like GrTLinkedList or GrTBlockList or
GrTBlockArray.

Change-Id: I5b10801d8593991d5e804c4074a81efb1dd110ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304396
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-22 21:58:31 +00:00
Mike Reed
3d30ca6d21 Add CubicResampler to makeShader
Only works on raster backend for the now.

Bug: skia:10344
Change-Id: I2c82d5345ae83a2bb2744ab27e3d971c57ea989e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303271
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 21:50:11 +00:00
Brian Osman
6241961a32 Add several more unit tests of runtime effects
Did some cleanup to remove repetition that was distracting from the
thing being tested.

Change-Id: Ie385c6ec2d1325a1bd0ba5c2270e7f2ddd1d24b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305076
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2020-07-22 21:12:21 +00:00
Mike Klein
184f601346 JIT load64_{lo,hi}
vpermps (added here) makes this very easy,
with an index controlling what 32-bit values go where.

A index of the form {0,2,4,6|?,?,?,?} will put the 4 low 32-bit halves
of 4 64-bit values in lanes 0,1,2,3.  We can use that twice to get all 8
low halves, then our new vperm2f128 to put them together.  Conveniently
vpermps can also load directly from memory:

    vpermps   (%rdi), {0,2,4,6|?,?,?,?}, lo
    vpermps 32(%rdi), {0,2,4,6|?,?,?,?}, hi
    vperm2f128 0x20, lo,hi, dst

We don't care what those top four indices are for load64_lo, so we'll
use them as the indices for load64_hi. That makes the full index
{0,2,4,6|1,3,5,7}, and load64_hi will just vpermf128 the other 128-bits
of lo/hi:

    vpermps   (%rdi), {?,?,?,?|1,3,5,7}, lo
    vpermps 32(%rdi), {?,?,?,?|1,3,5,7}, hi
    vperm2f128 0x31, lo,hi, dst

vpermps needs its index in a register, so we use a temporary for that.
Our logical lo can alias dst, and hi can alias that index, so it's just
one extra temporary register in the end.

Change-Id: Ie6a4efbf12ddada45dd09c0f580fa7350cf3019e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305171
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-22 19:33:00 +00:00
Mike Klein
d8194dcc3e JIT store64
Add some packing instructions to make it possible.

The gist is that we've got

    r(x) = {a,b,c,d|e,f,g,h}
    r(y) = {i,j,k,l|m,n,o,p}

where r(x) holds each low 32-bit half of a 64-bit value,
and r(y) holds the high halves.  We want to write

    a,i,b,j,c,k,d,l,e,m,...

So first the vpunpck[lh]dq instructions produce

    L = {a,i,b,j|e,m,f,n}
    H = {c,k,d,l|g,o,h,p}

which gets us halfway there.  The vperm2f128s select the low (0x20) or
high (0x31) 128-bit halves of L/H, so we end up writing to memory

    dst+0:  a,i,b,j,c,k,d,l
    dst+32: e,m,f,n,g,o,h,p

Existing tests cover that store64 works.

Change-Id: Ic00ad9bdb448b79867584c27cf0114a42ed32379
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305156
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-22 16:54:55 +00:00
Greg Daniel
95afafb2b0 Reland "Add GrContext api to update compressed backend textures."
This reverts commit ceebe424b1.

Reason for revert: relanding with fix

Original change's description:
> Revert "Add GrContext api to update compressed backend textures."
> 
> This reverts commit 2c180304dc.
> 
> Reason for revert: attempted workaround did not fix techno spark so needs further investigation
> 
> Original change's description:
> > Add GrContext api to update compressed backend textures.
> > 
> > Bug: chromium:1099255
> > Change-Id: I0c3f25ddb037e47e3b910fa89c3d8b3aa27b3114
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302265
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> 
> Change-Id: Ib5433def02dc5dad97dcdbd4476ced6de2361e6a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1099255
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302576
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1099255
Change-Id: Ie238a56b7f12fea8b6e251a050e5e2f4b20d2ede
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304741
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-22 16:46:55 +00:00
Brian Salomon
e69b9efcb3 Separate MIP filtering from min/mag filtering.
Does not add kNearest as a mip map mode yet.

Bug: skia:10344

Change-Id: Ida80cbf19e2b1eed5209d0680837fb45e54b4261
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303481
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-07-22 16:05:05 +00:00
Adlai Holler
247835b6c8 Reland "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit d13b97f94c.

Reason for revert: Fixed chromium canary

Original change's description:
> Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
>
> This reverts commit 7f0129d424.
>
> Reason for revert: Broke Chrome roll
>
> Original change's description:
> > Migrate SkImage::makeWithFilter to GrRecordingContext
> >
> > The staging flag landed in Chrome CL 2307531.
> >
> > Bug: skia:104662
> > Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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


Bug: skia:104662
Change-Id: I815677659f776966b1c7e362ce3df444834dd482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304803
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-07-22 12:58:23 +00:00
Brian Salomon
d007281c9a Fix clang 12 Wsuggest-override and Wsuggest-destructor-override
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 01:11:36 +00:00
Adlai Holler
d13b97f94c Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit 7f0129d424.

Reason for revert: Broke Chrome roll

Original change's description:
> Migrate SkImage::makeWithFilter to GrRecordingContext
> 
> The staging flag landed in Chrome CL 2307531.
> 
> Bug: skia:104662
> Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 20:02:10 +00:00
John Stiles
41d91b68b5 Remove support for multiple coverage processors from GrPaint API.
Change-Id: I82276e38ea4a5524127176eb5a34066b6cb06d88
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304799
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-21 19:44:38 +00:00
Michael Ludwig
1d4c08f615 Reland "Support moving blocks from one allocator to another"
This reverts commit 423dd689df.

Reason for revert: had missed corner case when tail block was empty

Original change's description:
> Revert "Support moving blocks from one allocator to another"
>
> This reverts commit 0f064041bf.
>
> Reason for revert: unit test failures on some windows bots
>
> Original change's description:
> > Support moving blocks from one allocator to another
> >
> > Uses this new capability and the previously implemented reserve()
> > feature to implement efficient concatenation of GrTAllocators.
> >
> > Change-Id: I2aff42eaf75e74e3b595d3069b6a271fa7329465
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303665
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I931f2462ecf6e04d40a671336d0de7d80efd313d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304604
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: Ia793c2f0e7ab2f3fd437871fa7fb4f56979f9ceb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304739
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-07-21 19:41:38 +00:00
Brian Salomon
8c82a87a6b Rename GrTexture/Proxy/Priv mip map members/functions
Change-Id: Ib55cab0ef76ced165d1936e7d084edc7fa579c55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304737
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-21 17:43:17 +00:00
Adlai Holler
7f0129d424 Migrate SkImage::makeWithFilter to GrRecordingContext
The staging flag landed in Chrome CL 2307531.

Bug: skia:104662
Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 17:37:27 +00:00
John Stiles
5933d7d54f Update GrPaint APIs to reflect lack of multiple color processors.
Change-Id: Ic7799b3c5f4294cba9ff72f8c11a2ad285ab189f
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304738
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-21 17:09:58 +00:00
John Stiles
6c452a50e9 Remove support for multiple color processors from GrPaint.
Change-Id: Ia92dc2be9a25f334bdbc098564cf2332496677fa
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304296
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-21 16:48:57 +00:00
Mike Klein
e942b8cac6 some small SkVM TODOs
Three TODOs, all basically the same idea: divide-by-zero is not the only
way to produce non-finite results from a division.  You can also divide
by very-near-zero, and maybe some other ways.

Added is_finite() to make this clear.  is_finite() is almost as cheap as
the comparisons it replaces, so performance shouldn't be affected.

Change-Id: I0a803e9ab4e3286f4e10a13d3aacee370eaaa803
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304669
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-21 16:30:37 +00:00
Brian Salomon
69100f05bb Rename GrCaps fields and methods from MipMap to Mipmap
Change-Id: I44d151dc80aca8fc6426735ee17224cb5b8aa576
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304603
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:56:21 +00:00
Greg Daniel
373d7dd0ed Add new GrContext::updateBackendTexture call that takes an SkColorType.
Change-Id: Iba71698f52eba3e7a99e0712a51ce48953b995db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304601
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:47:27 +00:00
Brian Salomon
40a40623c8 Rename GrBackendTexture::fMipMapped -> fMipmapped
Also mipMapped params to GrBackendTexture functions to mipmapped
GrBackendTexture::hasMipMaps -> GrBackendTexture::hasMipmaps

Misc test vars fMipMapped -> fMipmapped

Change-Id: Ic0651d14fc106c21b0ab45529875b95ed8dc2dfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304598
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-07-21 15:29:06 +00:00
Michael Ludwig
423dd689df Revert "Support moving blocks from one allocator to another"
This reverts commit 0f064041bf.

Reason for revert: unit test failures on some windows bots

Original change's description:
> Support moving blocks from one allocator to another
> 
> Uses this new capability and the previously implemented reserve()
> feature to implement efficient concatenation of GrTAllocators.
> 
> Change-Id: I2aff42eaf75e74e3b595d3069b6a271fa7329465
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303665
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I931f2462ecf6e04d40a671336d0de7d80efd313d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304604
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-07-21 15:23:02 +00:00
Brian Salomon
a6db510563 Rename GrMipMapsStatus GrMipmapStatus
For consistency with other enums and public APIs.

Change-Id: I026da5529f11051693cae5691c7ad92fad5ed446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304597
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-21 15:12:30 +00:00
Michael Ludwig
0f064041bf Support moving blocks from one allocator to another
Uses this new capability and the previously implemented reserve()
feature to implement efficient concatenation of GrTAllocators.

Change-Id: I2aff42eaf75e74e3b595d3069b6a271fa7329465
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303665
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:04:05 +00:00
Brian Salomon
7e67dcaea6 Rename GrMipMapped GrMipmapped
Change-Id: Ia2cfbca8982b57399b6681cbb4501c2933ab4df7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304576
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-21 14:06:35 +00:00
Mike Reed
c1eb58de32 MallocPixelRef should always allocate as large as computeByteSize() says
Bug: 1103827
Change-Id: I837f92cf10a1a389fe1b0ba55ae1323e7e68f741
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304416
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-21 12:59:25 +00:00
Robert Phillips
effd13f945 Convert more tests to GrRecordingContext/GrDirectContext
Change-Id: I30388793e1b9e14026a587cd248832abc283a301
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304093
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-21 12:28:25 +00:00
Adlai Holler
2940538ecd Reland "Remove more GrContext imports & usage"
This reverts commit 75c5168b41.

Reason for revert: Reverted image-cacherator test, for now

Original change's description:
> Revert "Remove more GrContext imports & usage"
>
> This reverts commit dd1395526d.
>
> Reason for revert: Broke chrome roll
>
> Original change's description:
> > Remove more GrContext imports & usage
> >
> > Sanity is coming soon!
> >
> > Change-Id: I109ebeef9efd7dbf4d76a13e1c05df36d59affbc
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303661
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: I20d770058d4b54193b6cd2fdc9ca5a1e09f84309
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304056
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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


Change-Id: I940b9f74f7caaa8b4201c241f2a6242b7a24d2a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304062
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 11:36:05 +00:00
Michael Ludwig
68e5f29d84 Keep a scratch block around for reuse in GrBlockAllocator
This can optimize cases in a allocate-release loop that moves back
and forth across the end of one block and the start of another. Before
this would malloc a new block and then delete it.

It also enables reserve() in higher-level data collections w/o blocking
bytes left in the current tail block.

Change-Id: Ide16e9038384fcb188164fc9620a8295f6880b9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303268
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-07-20 21:41:44 +00:00
Brian Osman
182c92ebb3 Catch SkRuntimeEffects w/o "main" earlier
Previously, these would produce a "valid" effect object, but it wouldn't
draw anything.

Bug: oss-fuzz:24070
Change-Id: I17d0ed1710196853da0694cac9f4c260312700a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304064
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-07-20 20:48:04 +00:00
John Stiles
fe7aed63ea Reduce number of trials needed by ProcessorOptimizationValidationTest.
The current algorithm runs an exponentially-increasing number of trials
based on the number of children supported by the fragment processor and
has become a large drag on test times. This version runs a fixed number
of trials to determine which optimization bits are able to appear, and
then continues running trials until each potential optimization has been
demonstrated successfully five times.

The algorithm doesn't attempt to check interactions between the various
optimization bits (e.g. a hypothetical bug that might only occur when
two optimizations interact with one another) but hopefully the minimum
of 100 successful trials is enough to shake out most issues.

Change-Id: I4eba7ace84739027a5aea8f8f895b44c4532b816
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304059
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-20 19:42:53 +00:00
Brian Osman
e64ae86d27 Rearrange logic in SkRuntimeEffect::Make
To extract metadata and validate the shader, we've added several
iterations over all program elements. This CL rearranges things
to iterate once (*). Variable conversion is moved to a separate
loop later, to help with nesting and readability.

Removes hard-to-read asserts. These were validating things enforced
by both the IR generator and unit tests.

*: Technically, there are additional implicit iterations when we call
   SkSL::Analysis functions. Folding all of this into a single pass
   would be even better, but much more complicated.

Change-Id: I4f5aa649e74094e94c365ad20ef2ac96082285cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303924
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-07-20 19:33:33 +00:00
Greg Daniel
426274b880 Add support for holding onto refs for input buffers from bindBuffer calls.
Mostly this is a lot of plumbing of sk_sp around instead of const*.

This does allow the d3d and vk backends to hold refs to the GrBuffers that
are bound on a command buffer. This means that our buffer alloc pools will
not try to reuse this buffers until the gpu is done with them. Previously
vk and d3d will sniff out if one of these buffers was being used again
while still active on the gpu and rip out the internal backend buffer and
allocate a new one which is not cheap. We see a lot of perf wins from
not doing this.

Change-Id: I9ffe649151ee43066dce620bd3e2763b029a9811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303583
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-20 18:29:43 +00:00
Robert Phillips
c8ae494401 Clean up more tests wrt GrContext
Change-Id: I70189e316be19f28d70c2fae832a868101fd3329
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303998
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-20 17:52:33 +00:00
John Stiles
0dee9b0c41 Use input FPs as the base layer for processor tests.
Previously, this test layered its paints by calling
`addColorFragmentProcessor` multiple times. We intend to remove support
for multiple color FPs on a GrPaint in the near future, so we use input
fragment processors instead to generate the same result.

Change-Id: I33e82ce0067183189e69b2af0fe0c228d1d60f14
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303479
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-20 16:44:08 +00:00
John Stiles
af1103040e Factor out random fragment-processor generation into a helper class.
The helper class allows us to regenerate a "random" fragment processor
with the same seed as many times as desired. This lets us check the
`compatibleWithCoverageAsAlpha` optimization without needing to clone
the input FP; instead, we can actually generate the FP under test three
times in a row, with the same random seed.

In a followup CL (http://review.skia.org/303479/) we will also leverage
this helper class to regenerate the FP under test with the same random
seed, but with a different input.

Change-Id: I1cd83082a949d555f7898970c8a1cc3002818286
Bug: skia:10384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303657
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-20 16:22:58 +00:00
Adlai Holler
75c5168b41 Revert "Remove more GrContext imports & usage"
This reverts commit dd1395526d.

Reason for revert: Broke chrome roll

Original change's description:
> Remove more GrContext imports & usage
> 
> Sanity is coming soon!
> 
> Change-Id: I109ebeef9efd7dbf4d76a13e1c05df36d59affbc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303661
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I20d770058d4b54193b6cd2fdc9ca5a1e09f84309
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304056
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-20 16:18:04 +00:00
Adlai Holler
dd1395526d Remove more GrContext imports & usage
Sanity is coming soon!

Change-Id: I109ebeef9efd7dbf4d76a13e1c05df36d59affbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303661
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-20 15:17:21 +00:00
Robert Phillips
0c5bb2f776 Clean up some GrContext in tests
Change-Id: I58372d0691fe6a348288a6076d78d3455288192a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303660
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-20 13:09:51 +00:00
Mike Klein
6732da0b21 add 64-bit load/store ops
This adds load/store ops for 64-bit values, with two load64 instructions
returning the low and high 32-bits each, and store64 taking both.

These are implemented in the interpreter and tested but not yet JIT'd
or hooked up for loading and storing 64-bit PixelFormats.  Hopefully
those two CLs to follow shortly.

Change-Id: I7e5fc3f0ee5a421adc9fb355d0b6b661f424b505
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303380
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-17 21:26:53 +00:00
Mike Klein
d58e01b6fc support 16161616 in fm
Everything was pretty much already plumbed through using
SkRasterPipeline, with a few key connections made here.

This support is mostly useful for differentially debugging my CLs
stacked on top of it.

Change-Id: I9c2f2ea6cd8890c057890409f21c7698857c599a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303651
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-17 20:35:33 +00:00
Robert Phillips
fe4b481324 Clean up some uses of GrContext in tests
Change-Id: Ic1f2f4edb8bfa27fa28f5da22575e1280a51d37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303641
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-07-17 19:55:23 +00:00
Michael Ludwig
c97ebe06dc Sneak per-GrBlockAllocator user-controlled metadata into head block
Previously, the blocks owned by a GrBlockAllocator provided block-level
metadata that users could control to track within a block. For types
like GrTAllocator (and a collection coming down the pipe), they need
to store a total count of allocations.

Since GrBlockAllocator is max-aligned, having them hold on to a single
extra int adds 4 to 12 bytes of padding for 8 and 16byte aligned
platforms. But, the old Block size already has 4 bytes of extra padding
since it was 28 bytes packed. This had been allowed to be allocation
data, for requests that were 4-byte aligned or less.

In practice, I think it's better to use that space for allocator-level
metadata so that a total count, or other high-level data, can be
packed into the data already held by GrBlockAllocator. Now GrTAllocator
instances should be 8-16 bytes smaller on those same platforms. Also
no longer writing into the struct-padded nether-realm, which is probably
just a good thing on principle.

Also cleans up how GrTAllocator's push_back() and emplace_back() are
tested to make sure all options are clearly covered.

Change-Id: If1da29132f3ec8df7a4056fcd834f760eb4693f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303267
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-17 13:31:10 +00:00
Michael Ludwig
a291b37c74 Fix GrTAllocator tests
Change-Id: I5bf9470a3d7822ea1edee7abf693037322e5d4e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303265
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-16 19:35:14 +00:00
Greg Daniel
cffb062092 Use staging buffers in d3d for texture uploads.
Change-Id: I00a00e62dfb2021a2c380ef4217c1acec1f07672
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303258
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-07-16 18:16:34 +00:00