Commit Graph

7784 Commits

Author SHA1 Message Date
Mike Klein
4067a9429a the return of bit_clear
bit_clear is at least useful as a special case for select(),
which helps with code readability.

Add is_NaN() and use these all together in sweep gradient.

Change-Id: I57a54f8956f85e0db0662b33f8446b8dc7342d8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281685
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-05 16:44:16 +00:00
Mike Klein
aa68109a59 special-case overhaul
- new this-> convention: never use it when calling common public
    Builder methods like splat(), bit_and(), etc like you'd see in
    normal user code, but always use it when calling private methods
    like this->push(), this->isImm(), this->allImm().

  - use c++17 if-statements to scope this->allImm() variables tighter.

  - check for x.id == y.id cases where applicable, including a tweak
    to min() and max() to make them able to hit the special case.

  - add special cases for I32 +,-,*, and remove an old unimportant
    unit test that assumed we didn't fold these.

  - add special cases for select(), and use select() in a few more
    places where it's clearer and now just as efficient.

Change-Id: Idaac9250ac5a95a48d33eeba1cc4380c8c91629d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281678
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-05 15:41:36 +00:00
Chris Dalton
d4dec974e3 Add an option to GrMeshTest to save to png
Change-Id: Ie877e995642fe6be48b7e242aa955e87ecc14fb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281385
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-04-03 18:18:04 +00:00
Mike Klein
cca2acfb77 remove little-used bit_clear() and bytes()
bit_clear() is just another bit_and(),
and bytes() is a way of expression pshufb
that we never really use (yet).

Can always add them back later, but there's
some extra complexity to think about for each
that I'd like to not think about now:

  - common sub-expression elimination between bit_and and bit_clear
  - large constant management JIT'ing bytes

Change-Id: I3a54afa963231fec1d5de949acc647e3430ed0d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281557
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-03 18:16:54 +00:00
Brian Osman
b08cc024cd Switch back to stack-based SkSL interpreter
It's slower, but code size is quite a bit smaller, memory usage is
smaller, and we think that mapping it to SkVM is just as easy.

This effectively reverts all of the following commits:

"Fix gcc9 warning around size of memset."
https://skia-review.googlesource.com/c/skia/+/279861

"Remove unused (and misleading) 'instruction' from SkSLInterpreter.h"
https://skia-review.googlesource.com/c/skia/+/278177

"Interpreter: Fix intrinsics when called with vector types"
https://skia-review.googlesource.com/c/skia/+/272721

"Make it easier to add vector versions of byte code instructions"
https://skia-review.googlesource.com/c/skia/+/272527

"Interpreter: Support returns from runStriped"
https://skia-review.googlesource.com/c/skia/+/268941

"add SkSLInterpreter vector instructions"
https://skia-review.googlesource.com/c/skia/+/266560

"Fix crash when editing particle scripts"
https://skia-review.googlesource.com/c/skia/+/269487

"Revert "Revert "Complete rewrite of the SkSL interpreter"""
https://skia-review.googlesource.com/c/skia/+/266205

Change-Id: I4258596399c4ca94489d4faf8aacfec88afeee13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281205
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-04-03 17:20:04 +00:00
Brian Salomon
c524378621 Don't require color type to make proxy copies.
Bug: skia:10078

Change-Id: I3ce0d97f8ada55403cc3f88bb16659085449ea29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281207
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-04-03 15:25:34 +00:00
Mike Klein
5b701e127c pass around programs by value
It's clearer to see the flow of data this way and to read each pass'
implementation without all the pointer indirection, and move semantics
should let this be just as efficient.

Change-Id: I1ac211fbe54bec37de6d126eec0c211573c2a568
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281218
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-02 16:44:06 +00:00
Mike Klein
b7d87903df pull out schedule, finalize
This finishes up the main refactoring.
Still some follow-ups I want to try.

I got tired of typing usage.users(id) so I converted that to operator[],
which I think is clear for now.  If we add more methods that don't refer
to the users, we can undo?

Change-Id: I0ac563cfb1899f7a3f8b2cb6d50ca1646dd05071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281216
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-02 16:37:29 +00:00
Brian Salomon
8afde5f395 Rename outputView->writeView and outputSwizzle->writeSwizzle
Change-Id: Ib09550201bc1556e04555fc7dc9408ab469684a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280964
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-04-02 15:06:16 +00:00
Brian Salomon
c3ce54a8a7 Remove color type from promise image proxy callback.
The color type used to influence the GrPixelConfig and the swizzles
used with the proxy and its GrTextures. So we had to create a new proxy
if the same API texture was used to fulfill a promise image of a
different color type. That has all been removed or lifted out of proxies
and into views. So now it is fine to reuse the same proxy/GrTexture with
a different color type.

Also remove unit test that checked required a new GrTexture be made if
a different color type was used.

Bug: skia:10078

Change-Id: Ib74c419b5d54d382ea95720af7026640e35013f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281056
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-04-02 14:59:18 +00:00
Mike Klein
7542ab5e5b reframe liveness_analysis as eliminate_dead_code
Seems nicer to keep encapsulated in a program->program pass
so nothing upstream of it has to think about liveness.

I will be circling back around to profiling the cost of these
tempoaries, copies, etc.  I just want to start writing them as
if cost were no object first.

Change-Id: I1d1187b521fbe963e720e0d8de90316a549f7797
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281182
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-02 14:44:36 +00:00
Brian Osman
46aacc7710 Fix SkVertices serialization bug. Also remove Builder getters for counts.
We already checked the SkSafeRange earlier (after its last use). Here we
need to be checking the SkSafeMath object. Oops.

The counts are directly copied from the constructor to the vertices'
fields - the user already knows what they are (and the tests are
verifying a tautology).

Bug: skia:9984
Change-Id: I33c62e02825718e497834b0dfa40d0d56e46a197
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280963
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-02 00:28:36 +00:00
Brian Osman
ffd11f4ab3 Adding attribute types to SkVertices
Adds structure to the per-vertex (now custom) data.
Attributes currently just have a type, but the next
step is to augment that with semantic flags to handle
transformation logic in the vertex shader.

Added unit tests and GMs that exercise attributes of
varying float counts, as well as normalized bytes.

Bug: skia:9984
Change-Id: I02402d40b66a6e15b39f71125004efb98bc06295
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280338
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-04-01 23:23:26 +00:00
Ethan Nicholas
7c75226854 Renamed the various 'stage' shader functions to have the actual effect name
This is purely to make debugging easier, as the shaders now make more sense
to read.

Change-Id: Ie8e9b9d36112fda3ff997d088955de5a0e2c787a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281017
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-04-01 19:07:04 +00:00
Mike Klein
4f90a8e399 Uses refactoring
Instead of copying fIndex and marching it forward,
we can tick down our existing uses counts backward,
saving one temporary std::vector.

Our implementation does guarantee the Instructions
returned by users() are sorted, so let's lean into
that... that means we can find the death time of any
instruction simply by looking at users().back()
(if there are any, of course).

Everything else is names and formatting, the biggest
being renaming Uses -> Usage.  There's enough mention
of "users" and "uses" contrasting with each other that
I think it makes sense for the type to have the nice
middle-ground neutral name Usage, reflecting the arrow
and not which way we're thinking about it pointing.

Change-Id: I32ea9af6eb6430a162bee6da4810a599e8ed0dfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281003
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-04-01 18:18:13 +00:00
Brian Salomon
982f546cc1 Rename outputSwizzle->writeSwizzle.
It is also used for writes to surfaces other than fragment shader
output. e.g. clears.

Change-Id: Id1eb79be6d1a8aed936456bffa59dee32661cec8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280344
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-31 21:50:38 +00:00
Brian Salomon
8a78e9cdc3 Don't require color type to wrap a texture/RT.
Change-Id: Ic6c0de262e13c3c3ea9e7777ccdd04f22ff6ae0a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280345
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-03-31 19:18:39 +00:00
Herb Derby
f20400e2a1 Introduce Liveness and Uses into existing scheduler
Liveness tracks all the live instructions in the instruction stream.
Uses maps this value to instructions that use it.

Uses is overkill for the current schedule, but will be needed for
spilling.

Change-Id: Id20b7b7a90901e156d323bb612c5908f91405967
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277744
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-31 17:53:07 +00:00
Brian Osman
8cbedf9855 Improve SkVerticesPriv ergonomics
Rather than two separate (partially overlapping) ways of accessing the
private portions of SkVertices, use a single privileged helper class
(similar to GrContextPriv).

Change-Id: I76b14b63088658ed8726719cce126577e5a52078
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280601
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-03-31 16:10:07 +00:00
Brian Salomon
469046c096 Revert "Revert "Remove GrCaps::isFormatTexturableAndUploadable""
This reverts commit 8176508cc6.

Replaces incorrect check for Read pixels support with Write check.

Change-Id: Idc80aaaa41ba35014339df450bb8b583fb6dab51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280399
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-31 13:41:27 +00:00
Ben Wagner
14ba58ff01 Add GrTAllocator::push_back(T&&)
Allow push_back to take an rvalue to move into the allocator, which has
the nice side effect of making the test for it a bit better.

Change-Id: I7e313cf75c1ad65fbf765b10c4717672063b5570
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280412
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-03-30 22:37:25 +00:00
Mike Reed
853c15cdaa remove unused SkLightingShader
Change-Id: I60a3569b47b599b710c0f3a9522241748f15360d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280409
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-03-30 20:55:34 +00:00
Brian Osman
01e6d17fe8 Stop including SkCanvas.h from GrTypesPriv.h
It was too easy to get into circular include chains. Added static
asserts to ensure we keep our quad AA flags in sync. Also, IWYU.

Change-Id: I01aefa264aa56420ab5a46a8ecd9e63c021c79ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280405
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-03-30 20:43:34 +00:00
Brian Salomon
8176508cc6 Revert "Remove GrCaps::isFormatTexturableAndUploadable"
This reverts commit c18dad25e4.

Reason for revert: Revealed thread safety issue in GrGLCaps, picked up by viz_unittests/TSAN.

Original change's description:
> Remove GrCaps::isFormatTexturableAndUploadable
> 
> Instead separately check texturability and uploadability using existing
> queries.
> 
> Also remove unused renderable param from onGetDefaultBackendFormat()
> 
> Change-Id: I8751e6d62263ddabd713c850beb788620a78bf10
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279996
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I8cd90fb35091009e51f283db1ee55df6088a8fe1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280398
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-30 18:16:34 +00:00
Brian Salomon
c18dad25e4 Remove GrCaps::isFormatTexturableAndUploadable
Instead separately check texturability and uploadability using existing
queries.

Also remove unused renderable param from onGetDefaultBackendFormat()

Change-Id: I8751e6d62263ddabd713c850beb788620a78bf10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279996
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-30 14:20:40 +00:00
Ben Wagner
7363af8c51 Fix gcc 9 warnings.
GCC 9 warns about this pessimizing-move. It isn't clear why clang isn't
as well.

GCC 9 has a working redundant-move diagnostic. Clang has an old (C++11
style) redundant-move diagnostic which only warns when moving a
parameter. The GCC warning conflicts with Clang's
return-std-move-in-c++11, which we want to keep until we can drop
support for older compilers. So just disable redundant-move warnings
until we can remove return-std-move-in-c++11.

This change allows us to compile without warnings on gcc 9.3.0.

Change-Id: If21fcfb2944ce49e27fc84d40805752895ae68cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279958
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-03-27 23:00:54 +00:00
Brian Salomon
2f23ae6b8e Rename SkColorTypeComponentFlags to SkColorChannelFlags.
Precusor step for making this public and adding a method to
GrBackendFormat to query its channels.

Bug: skia:10078
Change-Id: I2d8fa6586721c35961bc328a15eef8e2ebd4406e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279422
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-27 21:48:41 +00:00
Chris Dalton
07e5b8f0ed Rename TessellatingPathRendererTests.cpp -> "Triangulating"
Change-Id: Ie0525d71bb8cc15da2ebe61821c92e213f8dd3c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279896
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-27 19:42:03 +00:00
Brian Salomon
df1bd6dd0a Remove texture swizzle from GrSurfaceProxy.
Bug: skia:9556


Change-Id: I2c450c51e1a0987aacebdfcf32ef76cd31f0e80b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279656
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-27 17:01:07 +00:00
Brian Osman
9a3ee1913a Remove arbitrary limit on number of composed color filters
This effectively reverts https://codereview.chromium.org/972153010/

Note that we have no such hard limit on SkShaders, and it's never
been a problem. Complex SkPaint objects can generate too many FPs
for us to handle, but those are rare, and better managed by just
reporting the shader compile error (which we do).

Change-Id: Iee5dc3d65ec130f2ce0a29e55fbe3c25b00dc828
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279836
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-03-27 15:01:32 +00:00
Jim Van Verth
6ec5688413 Rename GrD3DTextureInfo to GrD3DTextureResourceInfo.
Also renames GrD3DSurfaceResource to GrD3DTextureResource. This makes
things consistent with our naming convention in Vulkan, and with the
terminology used in Direct3D.

Bug: skia:9935
Change-Id: I6e6d2066ac70eb8a0d63c1b5731f31851a3017d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279338
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-03-26 16:26:44 +00:00
Chris Dalton
17dc41870a Rename CPU tessellation to "triangulation"
Ambiguity has come up re: what "tessellation" means in Ganesh. I
believe that, in the context of a graphics library, "tessellation"
should refer to the hardware pipeline feature of submitting patches
and tessellating them on the GPU. This CL therefore renames classes
that triangulate things on the CPU to call it "triangulation".

Change-Id: Ic8515ea6a33000f1b638a852d5122bc9bd6b38f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279236
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-26 16:21:39 +00:00
Michael Ludwig
4519134e07 Implement GrTAllocator in terms of GrBlockAllocator
Previously, the GrAllocator header defined three types: GrAllocator,
GrTAllocator, and GrSTAllocator. GrAllocator was generic, and would
manage the blocks of memory (fixed size to hold N * sizeof(item)). It
stored an SkTArray of pointers to each block. GrTAllocator wrapped
the GrAllocator to add template support for a specific T. GrSTAllocator
extended GrTAllocator to include a template arg for inline storage.

In this CL, GrAllocator is no longer defined, and its memory functionality
is replaced with the use of GrBlockAllocator. For the most part, the
implementation of GrTAllocator on top of GrBlockAllocator remains the
same, although there is explicit array to the block pointers so indexing
is slightly different. GrSTAllocator is also removed entirely, so that
GrTAllocator's template includes initial storage size.

The iteration over the allocated items
is updated to wrap GrBlockAllocator's block iterator, and then iterate
by index within each block. Documentation on GrAllocator already recommended
using the iterator instead of random access, and these changes further
reinforce it. It turns out that many of the use cases of GrAllocator
were written to use random access, so many of the files outside of
GrAllocator.h have just been updated to use the new for-range iteration
instead of a random access for loop.


Change-Id: I28b0bc277c323fd7035d4a8442ae67f058b2b64c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272058
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-03-24 18:00:33 +00:00
Dominic Mazzoni
c227f4a826 Add support for tagging link annotations in PDFs.
Properly tagging links in PDFs just required a small change: at the time
an annotation is drawn, we need to keep track of the bounding rect, the
url and/or named destination, and now additionally the node ID. Instead
of keeping track of separate maps of rects/urls and rects/dests, this
patch combines them into a vector of SkPDFLinks.

Then, at the time the annotation is written to the file, an object
reference to that annotation can be saved and passed to the document
structure tree, where it can be included as an additional child of
the node with that node ID.

That allows for properly tagging the link and optionally giving it alt
text (like for an image link).

Bug: chromium:1039816
Change-Id: I97e47d3c70949020c3e0a69b8c9fc743748f3a7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277426
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-03-24 15:52:55 +00:00
Mike Reed
bcb46c06c7 Add approx_pow/log2/pow2 to SkVM builder
... in support of programs for colorspacexforms

Change-Id: I72ace09f10511ef8994038a4af3feab8bc1a299e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278466
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-23 22:17:04 +00:00
Mike Reed
f5ff4c25a0 add loadF() and storeF() helpers to Builder
Change-Id: I5fe1ca090868cfb9fa930753232e9cbb42737d9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278473
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-03-23 19:25:43 +00:00
Robert Phillips
709e2408fe Revert "Make TessellationTestOp and GrPipelineDynamicStateTestOp surface their programInfos at record time"
This reverts commit bc0fe058f8.

Reason for revert: red

Original change's description:
> Make TessellationTestOp and GrPipelineDynamicStateTestOp surface their programInfos at record time
> 
> These aren't high priority but it would be nice to have all the ops go through the same system.
> 
> Bug: skia:9455
> Change-Id: Idbd8b0829faf12703c82f5a016f5b0e7c3efb762
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277757
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: I579ad16f144d17afaec9ee1b9000eaaa5c04228c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278508
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-23 18:29:33 +00:00
Robert Phillips
bc0fe058f8 Make TessellationTestOp and GrPipelineDynamicStateTestOp surface their programInfos at record time
These aren't high priority but it would be nice to have all the ops go through the same system.

Bug: skia:9455
Change-Id: Idbd8b0829faf12703c82f5a016f5b0e7c3efb762
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277757
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-23 17:39:23 +00:00
Brian Salomon
f4ba4ec796 Revert "Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""""
Updated to use sentinel GL context even when GL backend is not built.

This reverts commit 1171d314ef.

Change-Id: Ia94bbe4865ddd4e898446c13886877c539f0eb0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-20 17:11:58 +00:00
Brian Salomon
1171d314ef Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots"""
This reverts commit fb27c9a25f.

Revert "Remove MoltenVK support"

Reason: TSAN Vulkan bots hanging.

This reverts commit 6cafe73da9.

Change-Id: I8ec9db35c112f3c8da8636dab2065e6f18de7d0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277936
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-19 13:10:59 +00:00
Brian Salomon
fb27c9a25f Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""
This reverts commit 00ba5ef4a6.

Bug: skia:10051

Change-Id: I13fd5494b7e7e64159e6330f168ab8c16a2db149
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277609
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-18 18:12:11 +00:00
Robert Phillips
c655c3aa8b Make GrOp::onPrePrepare be pure virtual
This makes onPrePrepare match onPrepare & onExecute. Most of the new method bodies will-have-to/should be filled in anyway.

Change-Id: Ifc897feaeb2d8fe6eec3ac3a8e91f99393ad6758
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277542
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-18 18:06:02 +00:00
Brian Salomon
bc074a68df Add SkBudgeted parameter to SkImage::makeTextureImage().
Also strengthens/adds some guarantees about this function:
* Always returns the same image if the original is texture-backed and
compatible with GrMipMapped (WRT HW MIP support)
* If a new texture backed image is returned it is always an uncached
texture that is not shared with another image or owned by an image
generator.

Adds a GrImageTexGenPolicy that allows control through image/bitmap
GrTextureProducers of whether a new texture must be made and whether
that texture should be budgeted or not.

Increases unit test coverage of this API.

Bug: skia:8669

Change-Id: Ifc0681856114a08fc8cfc57ca83d22efb1c1f166
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274938
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-18 17:27:41 +00:00
Chris Dalton
304e14d883 Remove FixedDynamicState from GrProgramInfo and GrPipeline
Everybody uses explicit binding now.

Change-Id: Idb6f64104eddd31d28dd2ba19f9743520a4e5170
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277541
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-17 23:09:08 +00:00
Chris Dalton
3bf2f3a9da Remove DynamicStateArrays from GrProgramInfo and GrPipeline
Every op that updates dynamic state between draws has now been
migrated to explicit binding.

Change-Id: Ibd13c9c0ffb16a205c073dfb4fd21d93f496dc52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277493
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-03-17 19:12:18 +00:00
Chris Dalton
be45742933 Change GrProgramInfo::visitProxies to "visitFPProxies"
We are removing dynamic state from the ProgramInfo, so the Ops will
need to invoke visits on their own primProc proxies.

Change-Id: I7ab227ab71208b7c7bcb7a9deb56b9abd556d6aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277236
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-03-17 15:06:55 +00:00
Chris Dalton
765ed36ad4 Delete GrOpsRenderPass::drawMeshes
Everyone is responsible to set up their own scissor and textures now.

Change-Id: Ic3547f00c0e7908409631951de4b7237b9bce23b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277177
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-17 15:05:54 +00:00
Michael Ludwig
cd01979004 Refactor GrMemoryPool into reusable GrBlockAllocator
This moves the byte block linked list structure outside of GrMemoryPool
into a new type, GrBlockAllocator. This new type is solely responsible
for managing the byte blocks, tracking where the next allocation
occurs, and creating/destroying the byte blocks. It also tries to
encapsulate all of/most alignment related math, while making it
convenient for clients to add per-allocation padding/metadata.

It has added functionality compared to the original block linked list
that was embedded in GrMemoryPool:
 - Supports resetting the entire allocator
 - Supports resizing the last allocation
 - Is able to rewind an entire stack of allocations, instead of just the
   last allocation.
 - Supports multiple block growth policies instead of just a fixed size.
 - Supports templated alignment, and variable alignment within a single
   GrBlockAllocator
 - Query the amount of available memory
 - Performs as much math as possible in 32-bit ints with static asserts
   that ensure overflow won't happen.

Some of this flexibility was added so that the GrBlockAllocator can be
used to implement an arena allocator similar to SkArenaAlloc, or to
replace the use of SkTArray in GrQuadBuffer. It is also likely possible
that GrAllocator can be written on top of GrBlockAllocator. I will try
to perform these consolidations in later CLs.

Change-Id: Ia6c8709642369b66b88eb1bc46264fb2aa9b62ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262216
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-03-17 14:41:14 +00:00
Mike Klein
6b48e62ed2 remove unused mutate() apis
Whether we should shrink at the end of mutate() turns out to be moot.

:)

Change-Id: Ic29df5734e3057f165f695b2d03f8e7eb0eeb4dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277299
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-16 20:44:36 +00:00
Herb Derby
3b946c1618 Check fullness and purge on every strike lookup
In the old code, the cache was checked and perged on every reattach
of a strike. That was left out of the multi-threaded code. Add the
check and purge back in to maintain cache size.

* Removed minimum cache size from setCacheSizeLimit.

Bug: skia:10046
Change-Id: I2438c83f04b6da8133c161a29604c3c3d7f58cd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277066
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-16 19:59:56 +00:00