The client passes a GrDirectContext* when creating a vertex or index
buffer. The data is copied to a GPU accessible buffer object
and the client gets a Skia object that may only be used with the GrDirectContext. The GPU backend draws directly from the buffer, thereby
avoiding the per-draw copy cost.
The underlying Ganesh object is freed in a thread-safe manner using an
existing message bus to perform a delayed unref in GrResourceCache.
Bug: skia:12720
Change-Id: If2578fbbf094874967a294a095b3bc5d7616d73a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527918
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I2374fd376f3038e59c82f57c68ac13557058de8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534663
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit 094bcdb9e5.
Reason for revert: Breaking Housekeeper-PerCommit-InfraTests_Linux. The bot will have to be updated as part of this change.
Original change's description:
> [infra] Use Python3 for our Presubmits
>
> https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_support.py;l=319;drc=443d9135cc33f3156d5fe25ebec33f9adffbab65
>
> This also makes any errors from `make train -C infra/bots`
> look well formatted because check_output returns a bytestring
> in Python3 and when that is printed, the newlines et al are not
> rendered correctly. Thus we want the output of check_output
> to be encoded to UTF-8.
>
> Without setting the USE_PYTHON3 = True in PRESUBMIT.py,
> it appears that `git cl upload` would try to run our
> infra_tests.py in Python2 mode, which does not have
> the encoding argument for check_output.
>
> Apparently cipd_bin_packages/vpython3 does not have the
> "six" package installed (but cipd_bin_packages/vpython does)
> so I replaced the six.StringIO with io.StringIO, which
> is where that is located in Python3.
>
> Change-Id: Ic8f61bf943531583ba3d110a85260d69bdbf5eb2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537677
> Reviewed-by: Ravi Mistry <rmistry@google.com>
> Reviewed-by: Eric Boren <borenet@google.com>
Change-Id: I0becb25d155ce0b0281c25d83662f1b01aee8033
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537777
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Ravi Mistry <rmistry@google.com>
In general, we drop the entire flush when we detect an allocation
failure. This CL makes an allocation failure in the flush-time preFlush
call also drop the entire flush.
Bug: 1320964
Change-Id: Idd2e24fbf5d2083c4fec8de7ccd028897a239b33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536837
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
The HW stroke tessellator had subclassed PatchWriter and called
writePatch() directly. Now the fixed-count variants all just use
the trait templates to configure PatchWriter directly.
Bug: skia:13263, skia:13056
Change-Id: I51c674968fe46974b217069909d71446a0d829c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534568
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
There had been plumbing for variable amounts of segments throughout
the patch writers and shaders because HW tessellation had to limit it
based on what the GPU could handle in its tessellation pipeline.
Now that everything just uses the fixed count approach, we can keep it
all as constants. I considered letting it remain parameterized in the
event we wanted ganesh and graphite to diverge, but figured it was
better to have consistent handling of paths.
Bug: skia:13263, skia:13056
Change-Id: I351d5d762bdab47e4091b18efbd857ac1e500be4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534567
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_support.py;l=319;drc=443d9135cc33f3156d5fe25ebec33f9adffbab65
This also makes any errors from `make train -C infra/bots`
look well formatted because check_output returns a bytestring
in Python3 and when that is printed, the newlines et al are not
rendered correctly. Thus we want the output of check_output
to be encoded to UTF-8.
Without setting the USE_PYTHON3 = True in PRESUBMIT.py,
it appears that `git cl upload` would try to run our
infra_tests.py in Python2 mode, which does not have
the encoding argument for check_output.
Apparently cipd_bin_packages/vpython3 does not have the
"six" package installed (but cipd_bin_packages/vpython does)
so I replaced the six.StringIO with io.StringIO, which
is where that is located in Python3.
Change-Id: Ic8f61bf943531583ba3d110a85260d69bdbf5eb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537677
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
This, combined with moving the def for GlyphVector::regenerateAtlas to
a Ganesh-only cpp file, allows us to move GlyphVector into the shared
gpu GN group.
Bug: skia:13118
Change-Id: I59b91f8406ac31f105f10fcddf6d0076d35c5bd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537459
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Starting with Visual Studio 2019 version 16.9 (msvc++ 14.28,
__MSC_VER 1928) has support for it's own version of AddressSanitizer.
Change-Id: I106b7e765ac80e4fc6eabd5b88500cbec5e38714
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537461
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Any settings in the FreeType build which may modify the public FreeType
headers must be public_defines. Otherwise FreeType may be built one way
and the dependents on this target may be built with what are essentially
different headers.
This fixes the Skia build with built-in FreeType on Windows.
Change-Id: I6b317fbe491dd6fdd135928b6f50436102a1e281
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537460
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
In preparation for making GlyphRunList handle the drawing buffers.
When handling the drawing buffers, there will no longer be
an empty glyph run list.
Change-Id: I7b3ff1bffc5e684515daabfa7601df0e107082f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537458
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This CL could, arguably, confuse the issue wrt why these images are
being generated but making the sizes match will make the images easier
to triage.
Bug: skia:13278
Change-Id: Ifb0b82eaaa4351fb589118d3b28673da9dd32e20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537576
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Previously we made them texture-only to fix an upcast that occurred
through a virtual inheritance link on a pointer to a deleted object.
This change changes the mechanism such that the sender of the message
maintains a ref that is moved into the sent message. The upcast happens
during creation of the message and thus before the resource is deleted.
The motivation is to use this for SkCustomMesh vertex/index buffers.
Bug: skia:13036
Change-Id: I0990eaed0d736257e1b19e9819e0dac8a9af8c18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537084
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Moves GlyphVector, TextStrike, StrikeCache, and SubRunAllocator.
Bug: skia:13118
Change-Id: Ifa4957b5cff280f44606dc62bfd30f6a03063c07
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536102
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
In this CL, the labels will be plumbed through createTextureCommon,
into onCreateTexture, and then passed to the various Gr*Textures
constructors.
Bug: chromium:1164111
Plumb label from GrGpu's createTexture function.
In this CL, GrResourceProvider's functions, like createTexture etc,
get label string passed to it which are called from GrGpu which then
passes the label to setLabel method of GrGpuResource by making use of
intermediate GrGpuResourcePriv class.
Bug: chromium:1164111
Change-Id: I068a4b4bf3db8efa099bf742efce592f73a3008a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536879
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
With HW tessellation removed, fixed-count is the only version of this
approach, so the fixed-count-only constants can be part of
Tessellation.h, leaving FixedCountBufferUtils.h purely for creating the
vertex/index buffers.
Bug: skia:13056, skia:13263
Change-Id: I413a9ebe19fe4427e1ebacee7484d57377abf44e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534563
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Various kinds of math with enums are deprecated, so switch to
constexprs.
Bug: chromium:1284275
Change-Id: I7ec0aa493b170538170f2a9f3262e7bed870c568
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536886
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: skia:12198
Change-Id: I6f69ba61fc15ce21963875e7b8ad0fac9d8d9430
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/533701
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Bug: skia:13263
Change-Id: I2289895e49d32664653165b8c1e29968edd3e0a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/533700
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:13040
Change-Id: I1749f21162ea400a8b8fb00ed52e6024eb658d52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537082
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:13263, skia:12198
Change-Id: I70988b765dc21e7c8728ea614c0974f9696eac33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534203
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I1ca07f97757f70debc0589648a57ba10b1729636
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537081
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Reviewer notes:
PS1 and PS2 handle everything up to the linking stage of the build
PS6 and PS7 are trivial renamings and rebases, diff between Base->PS5 for a cleaner review
No-Try: true
Change-Id: Ib21ce2e8839ecd4b4dd57280e82f56a98194e476
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/532765
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
SkCustomMesh is a class with factory functions. Vertex and index
data are stored in buffer objects rather than raw pointers. User can
provide offsets into the buffers.
Currently the buffers are always CPU backend and are uploaded to the
GPU on each draw. However, buffer the creation API takes a
GrDirectContext which in the future will be used to create a GPU-backed
buffer specific to the passed context.
Bug: skia:12720
Change-Id: If1bb8110f0f2f219b030f9682ab844f1f2207d9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527917
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:13040
Bug: skia:9235
Bug: skia:10412
Bug: skia:12437
Change-Id: Ia96f8332b5372ecf65cb20ffb9549bc0dc8f931b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537080
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This removes one branch, one normalize, one max, and switches to
dividing by the magnitude once, instead of doing it twice; invMag may
not be exact but it's accuracy should be similar to doing the divide
directly.
I changed the magnitude scaling to happen after subtracting the two
points, since this was a better balance between dealing with points
that had really large coordinates, and points that differed by epsilon
(where upon dividing the original coordinate value would lose that
precision, but doing it after the subtraction preserved the
direction).
At the very least, this does not cause the accuracy failures for large
coordinates that I was seeing before robust_normalize_diff was first
added, and it avoids issues with epsilon sized stroke rectangles that I
ran into when evaluating other optimization variants of this function.
Bug: skia:13275
Change-Id: I07862b80b67ef905fce2aeeeabed3e907a63796a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535438
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Change-Id: Ib81dc1f0c77a8300b20105612b7310d69027ea29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537077
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Change-Id: Ia1d43e4814eb23fc111df0c1800425272337936c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536639
Reviewed-by: Ravi Mistry <rmistry@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Bug: skia:13263
Change-Id: I045f7c3b5d0ea27fd231309ac4af275257bebf33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/534202
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: If5f14828029473afef25c5ef69db3971796cdfc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/537076
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
There are two SKP versions we deal with here:
* The min and current supported versions in src/core/SkPicturePriv.h.
* The SKP asset version that is incremented weekly in infra/bots/assets/skp/VERSION.
We will need to update the asset version used by the bot when the min version in src/core/SkPicturePriv.h is updated.
Instructions on how to do that have been documented in src/core/SkPicturePriv.h.
As noted in https://bugs.chromium.org/p/skia/issues/detail?id=13278#c2 DM currently does not fail when it fails to parse an SKP. Till DM is updated to fail, developers will have to look for blank images in Gold via this new bot to determine when we are failing to support the oldest SKP version.
Bug: skia:13278
Change-Id: I8fff62cc289c3bd6abf5179bcee349baf0a8188a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536106
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
We now pass the child output variable names into the snippet code after
all the uniforms.
This leaves the following 3 custom glue code generators:
GenerateImageShaderGlueCode -- sampler
GenerateFixedFunctionBlenderGlueCode -- prior stage's output
GenerateShaderBasedBlenderGlueCode -- dst read & prior stage's output
Bug: skia:12701
Change-Id: I9185d8f292cc45d351218b95fa6d7d70d639e2f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536098
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
I need to add a presubmit that verifies our BUILD.bazel files
(i.e. the new ones) have the appropriate header.
Change-Id: I368d8e773aa59ff17b6d81812c67cb849c0a08fc
Bug: skia:13211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/536881
Reviewed-by: Ravi Mistry <rmistry@google.com>