Commit Graph

8102 Commits

Author SHA1 Message Date
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
Adlai Holler
4caa935bfe Migrate MakeTextureImage to take GrDirectContext
This is part of a larger effort to force SkImage users to specify
the direct context they want to use when manipulating GPU images.

Chrome CL 2299194 (landed) enables the staging flag.

bug: skia:10466
Change-Id: I959db57dd8dca5c2622eb5ffaa7de161c4d6d8f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302643
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-16 16:17:28 +00:00
Robert Phillips
4e105e2e06 Clean up GrContext references in the src/gpu
This CL tries to remove all uses of GrContext - replacing them with
either GrDirectContext or GrRecordingContext. Preferring the recording
context wherever possible.

Change-Id: I61af94928aa37bc82ff9923acffd57586610f695
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302904
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-07-16 14:14:08 +00:00
Greg Daniel
9d02a4c0a9 Using staging buffers for vulkan texture uploads.
Change-Id: I166755b3e385fcea919a6daad8cc8407fda8c27a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303016
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-16 13:10:18 +00:00
Brian Salomon
a3b02f5278 Rename GrSamplerState::Filter::kBilerp to kLinear
Aligning with SkSamplingMode.

Bug: skia:10344

Change-Id: Ie303c3ca1d664d4c23f779b84c9a661076bd74d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303022
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-15 23:14:14 +00:00
Mike Klein
4d680cdf07 a bunch of half-related stuff
- add f32<->f16 functions to skvx
  - add f32<->f16 x86 instructions to skvm::Assembler
  - add f32<->f16 ops to skvm,
    using the skvx functions in the interpreter

Still TODO:
    use the new x86 instructions in the JIT

(For now like in many other ways, the aarch64 JIT
continues to languish.  Will pick that back up one day.)

Change-Id: Ib8dc1ccdc75ecb23769ea4947d66d3ab22520f23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302942
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-15 20:47:31 +00:00
Ben Wagner
e80a595401 Implement SkFontMgr::onMakeFromFontData in subclasses.
The current serialization format for variations stores only the values
(without the axis names) and relies on the order of the axes for
deserialization. Even after this deficiency is corrected, it will still
be needed for legacy skps.

Add a real test which ensures variable font printing works correctly
in Chromium. The old test was essentially testing MakeFromFontData
against itself instead of creating a font with variations as a user
would.

Bug: chromium:1070089
Change-Id: Ia6eaac91b2ac58795b7ba61c2b52b2f22ef079bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299457
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-15 18:29:23 +00:00
Michael Ludwig
0e15cfb585 Support releasing blocks while iterating them
This makes reset() a little easier to follow, and enables more complex
use cases on top of GrBlockAllocator down the road.

Change-Id: Id79d20e2b394248c997259d6d5b5494fc1456acc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302678
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-07-15 18:27:53 +00:00
Michael Ludwig
26b4ffd362 Generalize iterator in GrTAllocator to be useful for other data types
This allows the iterator type/boilerplate to be reused for any other
data collection that sits above GrBlockAllocator, as long as its a fixed
"type" with indices into a block.

Also adds reverse iteration (which is useful for stack-like use cases).

Change-Id: Id9a205e8fb396a8558e360439240fd20c92c9700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302665
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-15 17:30:43 +00:00
Adlai Holler
3a22017402 Reland "Add a direct context arg to makeColorTypeAndColorSpace"
This reverts commit 779813a239.

Reason for revert: Avoid null dereference in DDL test case

Original change's description:
> Revert "Add a direct context arg to makeColorTypeAndColorSpace"
>
> This reverts commit a56da9ee92.
>
> Reason for revert: UBSAN complains in Vulkan OOPRDDL mode
>
> Original change's description:
> > Add a direct context arg to makeColorTypeAndColorSpace
> >
> > This is part of a larger effort to de-power SkImage and force users to
> > specify the GPU context for all new images.
> >
> > Staging flag landed in Chrome CL 2296632.
> >
> > Bug: skia:10466
> > Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10466
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

Bug: skia:10466
Change-Id: I59de0bd2b33989b1af08e8af2f8a52542b6b5db0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302829
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-15 17:21:44 +00:00
Mike Klein
b2290d7a8b minor skvm cleanup
This is just minor little stuff I've been meaning to do,
with essentially no impact anywhere.

   - Add an easy-to-flip switch to disable the JIT.

   - Stop checking so carefully whether we hasJIT()
     in test_jit_and_interpreter().  This was helpful
     for making progress but now just gets in the way.

Change-Id: I08065ba1f42700f9d7d63f8303af357ec5fe11ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302944
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-15 17:10:03 +00:00
Greg Daniel
a58db7f87e Add GrStagingBufferManager and use GrGpuBuffers to manage caching.
With this change if a backend Gr*Gpu wants to using staging buffers
they just add a generic GrStagingBufferManager member object. This
object can be used to get slices of upload buffers. Then they just need
to implement the virtual for taking ownership of buffers during submit.

We rely on our GrResourceCache to handle caching and reuse of these
buffers.

This change allows us to remove all other virtuals on GrGpu around
managing staging buffers.

Change-Id: I5db9a3c52133978ea89d6c0de440f434fbf91a51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300226
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Stephen White <senorblanco@google.com>
2020-07-15 14:17:50 +00:00
Mike Reed
13711ebe68 rename SkMipMap to SkMipmap
Change-Id: I1fa8a0482a717847236a30b4851061f4074b7755
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302644
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-15 13:26:13 +00:00
Adlai Holler
779813a239 Revert "Add a direct context arg to makeColorTypeAndColorSpace"
This reverts commit a56da9ee92.

Reason for revert: UBSAN complains in Vulkan OOPRDDL mode

Original change's description:
> Add a direct context arg to makeColorTypeAndColorSpace
> 
> This is part of a larger effort to de-power SkImage and force users to
> specify the GPU context for all new images.
> 
> Staging flag landed in Chrome CL 2296632.
> 
> Bug: skia:10466
> Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-15 13:02:55 +00:00
Adlai Holler
a56da9ee92 Add a direct context arg to makeColorTypeAndColorSpace
This is part of a larger effort to de-power SkImage and force users to
specify the GPU context for all new images.

Staging flag landed in Chrome CL 2296632.

Bug: skia:10466
Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-14 22:36:49 +00:00
John Stiles
886a904595 Update SkTQSort to use half-open ranges.
C++ algorithms have largely standardized on a [begin, end) half-open
range, as seen in standard library containers. SkTQSort now adheres to
this model, and takes vec.begin() and vec.end() as its inputs.

To avoid confusion between inclusive and half-open ranges inside the
implementation, internal helper functions now take "left" and "count"
arguments instead of "left"/"right" or "begin"/"end". This avoids any
ambiguity.

(Although performance was not the main goal, this CL appears to
slightly improve our sorting benchmark on my machine.)

Change-Id: I5e96b6730be96cf23d001ee0915c69764b2c024a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302579
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-14 22:13:59 +00:00
Brian Salomon
f990b6ab4a Remove GrTextureProducer::DetermineDomainMode.
We now rely on GrTextureEffect and GrBicbicEffect
to determine if shader-based tiling is required.

GrTextureProducer is still responsible for noticing that
the proxy is approximate because GrTextureEffect doesn't
consider that in its basic Make() factory (as opposed to
MakeSubset()).

Change-Id: I8e1aeb9edbcfa73ea0bf80b5256ee1ca21fe9c81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301985
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-14 16:48:46 +00:00
Mike Reed
2fe1569298 Create mipmaps when creating images
Follow-on CLs:
- add serialization for mips to pictures
- implement for other image types (e.g. lazy(?), gpu)
- improve generated mip quality

Bug: skia:10411
Change-Id: Id874f170e9cb8ae4405dc4f6249e1ea6274f20aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297739
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-14 16:02:26 +00:00
Brian Osman
12c5d29ba6 In FPs, store pointers for all child slots, even nullptr
This simplifies things like ConstantOutputForConstantInput and
invokeChild. It also removes the need for child indices: generated
FPs now directly refer to their children by slot number.

Change-Id: I69bbb042d5d72d21b999256f969c467702d0774d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302436
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-07-14 15:43:56 +00:00
Greg Daniel
ceebe424b1 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>
2020-07-14 15:05:58 +00:00
John Stiles
df07800f95 Include the SkTSort header only where it is used.
Change-Id: If51be35205b40c4a22979a4b49b031126af1dde7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302500
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-14 14:19:06 +00:00
Robert Phillips
f4f8011aef Add Context factories to GrDirectContext
In order to stage the transition from GrContext to GrDirectContext, both
of them will have to have the factories for a while.

This CL also removes all internal uses of the old (GrContext) factories.

Change-Id: Ibe1edd0818ea23a0d54257c55f35f12526047ef3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302263
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-14 12:40:46 +00:00
John Stiles
6e9ead9166 Revert "Remove custom SkSort algorithms."
This reverts commit 70474c1cb0.

Reason for revert: bot build failure

Original change's description:
> Remove custom SkSort algorithms.
> 
> SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
> The difference is small on randomized inputs, but quite significant for
> semi-ordered inputs (forward/backward/repeated). There doesn't seem to
> to be any compelling advantage to SkTQSort.
> 
> Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u
> 
> (These performance numbers are from an optimized build my local machine;
> it's possible that we might see different results on the test bots.)
> 
> Change-Id: Iaf19563041547eae7de2953be249129108f093b1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com

Change-Id: I1126dd4cda95716dac225ad32d5b0e5cf3f09421
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302447
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-14 00:25:05 +00:00
John Stiles
70474c1cb0 Remove custom SkSort algorithms.
SortBench shows that SkTQSort and SkTHeapSort are inferior to std::sort.
The difference is small on randomized inputs, but quite significant for
semi-ordered inputs (forward/backward/repeated). There doesn't seem to
to be any compelling advantage to SkTQSort.

Nanobench results: https://screenshot.googleplex.com/9JOLV1d6Z0u

(These performance numbers are from an optimized build my local machine;
it's possible that we might see different results on the test bots.)

Change-Id: Iaf19563041547eae7de2953be249129108f093b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302295
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-13 23:35:20 +00:00
Greg Daniel
2c180304dc 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>
2020-07-13 20:42:38 +00:00
John Stiles
7c1967700b Split GrConstColorProcessor into three separate .fp effects.
ConstColorProcessor contained three separate InputModes with their own
unique behaviors, but every (non-test) call site simply hardcoded one of
the InputModes.

This change also allows the actual const-color processor to remove the
inputFP entirely; it is never sampled.

The GM slide has been split into three separate slides as well.

Change-Id: I2b77f4eab4d655f06e3704fb6fde8d4f8c70a075
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301987
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-13 15:07:12 +00:00
Adlai Holler
872a32c58d Add an arg to SkImage::makeSubset to take a direct context
This is part of a larger effort to force users to provide a context
when manipulating GPU images which may be shared, instead of having
images themselves retain powerful context pointers.

Chrome flag landed in Chrome CL 2292800

Bug: skia:10466
Change-Id: Ic530a2c5eb1f4399db899d243ea944760fdf2055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300707
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-13 14:55:47 +00:00
Robert Phillips
b27b38b089 Miscellaneous removal of GrContext usages
Change-Id: I558471002db93a09b8fd5dfa2f0929a0139295bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301976
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-13 14:10:54 +00:00
Mike Reed
609ea210e2 more cleanup after removing volatile from bitmap
Change-Id: I3d7b2f59a5657640c3d60f5a2f6e1277d7593096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302038
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-12 19:37:29 +00:00
Mike Reed
1434ce1aa9 Can we remove volatile from skbitmap?
Change-Id: I0faa324b91f2c291be56f5126361ffe7fd54eb65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302037
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-12 17:48:59 +00:00
Ben Wagner
525e87682c Fix Op tests when default typeface is empty.
While testing on Linux with a configuration like

skia_enable_fontmgr_custom_directory=false
skia_enable_fontmgr_custom_embedded=false
skia_enable_fontmgr_custom_empty=true
skia_enable_gpu=true
skia_use_fontconfig=false
skia_use_freetype=true
skia_use_system_freetype2=false

the default typeface will be an empty typeface with no glyphs. This of
course leads to many test failures, which is fine.

However, this also leads to crashes when testing GPU Ops since the Op
factories may return nullptr to indicate no-op but the callers of those
factories currently do not expect nullptr or handle it as a no-op.

Change the callers of Op factories to treat nullptr as no-op.

Change-Id: I9eb1dfca4a8a9066a9cfb4c902d1f52d07763667
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301586
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-10 14:04:53 +00:00
Michael Ludwig
1c66ad940e Apply paint color to alpha-only textures in drawEdgeAAImageSet
This makes batch texture ops consistent with singleton texture ops, and
images drawn through a texture producer.

Bug: chromium:1102578
Change-Id: I490b20940ef6f1899396b786369271ce7130e8a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301540
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-07-10 13:29:33 +00:00
Michael Ludwig
362245e6ed Remove unused GrTRecorder
Change-Id: I9fa9f8785f48e884cf296a638347003d1687e7c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301536
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-09 16:13:20 +00:00
Jim Van Verth
1bef9793e9 Remove uses of non-inclusive terminology from Ganesh code.
Change-Id: Ice75d0caa7b4beb2d982be094d62b54e71b45045
Bug: chromium:1101491
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301456
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-07-09 13:33:02 +00:00
Robert Phillips
16bf7d31c8 Make SkGpuDevice hold a GrRecordingContext (take 2)
This makes the code reflect what is actually going on. During DDL
recording the SkGpuDevice only holds a recording context.

This can't land until the following Chrome-side CL lands:

https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Change-Id: I6ef3896f5a270a4fa7af37f9121f68a66653cce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300896
2020-07-09 12:28:22 +00:00
Ben Wagner
98e0ed78cf PDF without annotations skips structure tree.
The SkPDFDocument::fTagTree::fRoot is set at document creation time.
This root will initially always be discardable, since no annotations
have been made. As a result it does not make sense to assert on it being
non-discardable, since it should be possible to create a PDF which just
happens to have no annotations added to it.

Change-Id: I2fe336c872805b6937f7c8ea275c0cb4d3438682
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301383
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
2020-07-09 00:14:38 +00:00
Robert Phillips
2a4acf328c Remove all internal uses of (and deprecate) SkSurface::getContext
We are replacing GrContext with the GrDirectContext/GrRecordingContext
pair. This starts making that change visible to clients (and weaning
Skia off of GrContext).

Change-Id: I00cc9bf208499984de855a1646229bd7557fc925
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300706
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-08 16:09:27 +00:00
Brian Osman
9cf98dcb49 Remove GrCoordTransform entirely
Bug: skia:10416
Change-Id: I0ca7535a0e6507e6b2a9f4682788826972c5f3b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300296
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-07 20:06:04 +00:00
Chris Dalton
05da783f87 Revert "Make SkGpuDevice hold a GrRecordingContext"
This reverts commit c8b721b086.

Reason for revert: Looks like it's causing build failures around
MakeRenderTargetContext on the roll.

Original change's description:
> Make SkGpuDevice hold a GrRecordingContext
> 
> This makes the code reflect what is actually going on. During DDL
> recording the SkGpuDevice only holds a recording context.
> 
> This can't land until the following Chrome-side CL lands:
> 
> https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)
> 
> Change-Id: I69cfa744226c315c25f68fc509b7b59ec38bbf31
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

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

Change-Id: I6a362daf7c40e36ed9f068c5b2d477c16a3f778e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300853
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-07-07 07:23:55 +00:00
Robert Phillips
c8b721b086 Make SkGpuDevice hold a GrRecordingContext
This makes the code reflect what is actually going on. During DDL
recording the SkGpuDevice only holds a recording context.

This can't land until the following Chrome-side CL lands:

https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)

Change-Id: I69cfa744226c315c25f68fc509b7b59ec38bbf31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-07-07 01:35:30 +00:00