Change-Id: I87b0fc76ef48c1a21498e576853a6c3b4a6a98f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242563
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This CL adds:
kAlpha_F16_SkColorType
kRG_F16_SkColorType
kRGBA_16161616_SkColorType,
which should be it for a while.
Bug: skia:9121
Change-Id: I81b9d46a202a76e9b7d7ca86495d72dbdae32576
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241357
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Include protected in scratch key.
Change-Id: I0dfc58c9f54e8279a39adf4bad808b7e0e72cba2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241397
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Also trim includes in SkSLCompiler while I'm there
Change-Id: I87b27199b84e5e856e0a914f44368313a6f226e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242085
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This also switches GrColorType::kR_16 to kAlpha_16 to more closely match raster.
Bug: skia:9121
Change-Id: I03c6e6c52c90aa4223478c5ea6c8b2ed8558f677
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239930
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Subsumed by fShaderCacheStrategy, clients have switched over.
Change-Id: I70b6ade4ccab2f48f2ef9437ae65c78cf458cfe4
Bug: skia:9402
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239928
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
The client can do a test run of their application with
a persistent cache set to SkSL mode. They store the key
and data blobs that are produced.
Ship those blobs with the application. At startup, call
GrContext::precompileShader for each key/data pair. This
compiles the shaders, and stores the GL program ID, plus
a small amount of metadata in our runtime program cache.
Caveats:
* Currently only implemented for the GL backend. Other
backends will require more metadata to do any useful
amount of work. Metal may need a more drastic workflow
change, involving offline compilation of the shaders.
* Currently only implemented for cached SkSL (not GLSL
or program binaries). Supporting other formats again
requires more metadata, and the cached shaders become
increasingly specialized to GPU and driver versions.
* Reusing the cached SkSL on different hardware is not
supported. Many driver workarounds are implemented in
the SkSL -> GLSL transformation, but some are higher
level. Limiting device variance by artificially hiding
extensions may help, but there are no guarantees.
* The 'gltestprecompile' DM config exercises this code
similarly to 'gltestpersistentcache', ensuring that
results are visually identical when precompiling, and
that no cache misses occur after precompiling.
Change-Id: Id314c5d5f5a58fe503a0505a613bd4a540cc3589
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239438
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The removal of IORefs from GrSurface makes a lot of other cruft obsolete.
Change-Id: I0e02d680a17dc4f4ec705cb6ee4c294738271e28
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239919
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Change-Id: I988fd8cc7e78e2124f20b7d8a815f160bb166756
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239756
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
As part of this (clean up), also removed support for serialized-paths
older than version-4, which was introduced Feb 2018.
Change-Id: I2dc74a52bb8bdd7ea0cb2d8a78b644ca783eb31f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239102
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Combines the two boolean options into a single tri-state enum. Old GLSL
option is still present (temporarily) until Chrome is switched over.
Also add a type tag for cached program binaries, so we can safely
detect cache entries of the wrong type.
Change-Id: I0ddeefa9180b27bc2c46e2e7b77e6c9cdf4a730a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238856
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This is a reland of 804f6a0fe7
Original change's description:
> Initiate MSAA resolves during DAG generation
>
> Adds an "fIsMSAADirty" flag to GrRenderTargetProxy and switches to
> resolving MSAA in GrTextureResolveRenderTask. This completes our push
> to resolve textures outside of render passes.
>
> For the time being, we only store a dirty flag on the proxy and still
> rely on the GrRenderTarget itself to track the actual dirty rect. This
> will be followed by a CL that moves the dirty rect out of
> GrRenderTarget and into the proxy.
>
> Bug: skia:
> Change-Id: I21219a58028bdb4590940210e565133093cd34b3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235672
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:
Change-Id: I805b3af1404eb7919ae937cff3dfa97921e32c69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237482
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Also, expose GrNonAtomicRef's ref count. Since it's non-atomic and not
thread-safe it seems fine.
Change-Id: I5cf48e60d32094354955b2614cfeebbb4c1ecf2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238059
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: Icd331e8946d80652750b8b6ea0db65f5f676ac3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238058
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
This reverts commit 7be971fa3a.
Reason for revert: Flutter has been updated to new API, these patches
should not be necessary.
Original change's description:
> Fix flutter roll
>
> Flutter extends from the SkCanvasVirtualEnforcer, so the prior change
> to onDrawEdgeAAQuad to accept an SkColor4f instead of SkColor broke
> their build, the flutter roller, and--transitively--the G3 roller.
>
> This keeps the old onDrawEdgeAAQuad around as a no-op so their
> canvas_spy class can extend from it.
>
> TBR=bsalomon@google.com, stani@google.com
>
> Bug: skia:
> Change-Id: I3798ec60a21e90c3d3f5d59f19f7dbe62e37cbec
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237590
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
TBR=bsalomon@google.com,stani@google.com,michaelludwig@google.com
Change-Id: I2946043dbddfdfc8c853e68853a8a349db0b5ab1
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237901
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
GrFence is implemented by a single MTLSharedEvent where we increase the
value with each new invocation. GrSemaphore uses a MTLEvent (the
assumption here is that we are signaling and waiting on the same device)
with an associated value that defaults to 1. For generating a large
number of GrSemaphores at once it should be possible to use the same
MTLEvent but with different assigned values.
Bug: skia:8243
Change-Id: Ic7de2d9d295fbe51e67bc7c3c4354257cb0774d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233416
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Flutter extends from the SkCanvasVirtualEnforcer, so the prior change
to onDrawEdgeAAQuad to accept an SkColor4f instead of SkColor broke
their build, the flutter roller, and--transitively--the G3 roller.
This keeps the old onDrawEdgeAAQuad around as a no-op so their
canvas_spy class can extend from it.
TBR=bsalomon@google.com, stani@google.com
Bug: skia:
Change-Id: I3798ec60a21e90c3d3f5d59f19f7dbe62e37cbec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237590
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: chromium:795132,chromium:985500
Change-Id: Idbb4d45b29d2c0d0fd54b05b807086ecf0b8cf26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237492
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Skia has traditionally snapped horizontal and vertical baslines to
pixels as a kind of baseline hinting. This is a feature which cannot
reliably be implemented from the outside and tends to make static text
better looking by ensuring the baselines are consistent. However, with
animation like scrolling or flying and resizing text the animation
suffers. Allow the user to disable the baseline snapping.
Change-Id: I6ee1c12a07242d10c08ae4b75c73e4e28c860790
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237124
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
These unused comparison operators are the only users of
<functional> in SkRefCnt.h, for std::less. <functional>
is an expensive header to compile, and SkRefCnt.h is popular,
so it helps to cut dependencies like this.
Mostly we just need to add #include <functional> in a few
places that were picking it up via SkRefCnt.h.
In SkPixmapPriv.h, it looked simpler to template the argument,
since everything was inline anyway.
Change-Id: I7c125bb26a04199847357c729a1b178256c6ef8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236942
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
<ostream> is one of the more expensive headers to include
and that's amplified by SkRefCnt.h's popularity.
We've been including <ostream> for sk_sp's operator<<. That's only
used by Chromium and while we could just sprinkle in a bunch of .get()
calls and remove operator<<, when I started going through and actually
doing that I got the feeling I was making things pointlessly harder to
read and write, and wanted to find a way to make it actually work.
My next instinct was to template it without mentioning ostreams,
template <typename OS, typename T>
auto operator<<(OS& os, const sk_sp<T>& sp) -> decltype(os << sp.get()) {
return os << sp.get();
}
but that makes this operator<< ambiguous with some other templated operator<<
in GTest. They got in first, so they win...
So ultimately, switch <ostream> to <iosfwd>. Anyone using our
operator<<() presumably has <ostream> included already, and the #include
cost for <iosfwd> is small enough that I don't think we'll mind keeping
this around indefinitely.
To repro, look at before/after of -ftime-trace:
~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ -I. -Os -c src/core/SkCanvas.cpp -ftime-trace
I have tested locally that Chromium builds with this change.
Change-Id: I9decc2e65b5cc8fd07d8106a5eff81901aedd7d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237190
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This reduces the number of map lookups that need to happen.
Change-Id: I068819f2576bf644a5c3550d48e69413e19179d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237217
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Herb Derby <herb@google.com>
This reverts commit 804f6a0fe7.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Initiate MSAA resolves during DAG generation
>
> Adds an "fIsMSAADirty" flag to GrRenderTargetProxy and switches to
> resolving MSAA in GrTextureResolveRenderTask. This completes our push
> to resolve textures outside of render passes.
>
> For the time being, we only store a dirty flag on the proxy and still
> rely on the GrRenderTarget itself to track the actual dirty rect. This
> will be followed by a CL that moves the dirty rect out of
> GrRenderTarget and into the proxy.
>
> Bug: skia:
> Change-Id: I21219a58028bdb4590940210e565133093cd34b3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235672
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,csmartdalton@google.com
Change-Id: Ife557caa840edfb64cbcafc272dc3012cfb43702
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237242
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Adds an "fIsMSAADirty" flag to GrRenderTargetProxy and switches to
resolving MSAA in GrTextureResolveRenderTask. This completes our push
to resolve textures outside of render passes.
For the time being, we only store a dirty flag on the proxy and still
rely on the GrRenderTarget itself to track the actual dirty rect. This
will be followed by a CL that moves the dirty rect out of
GrRenderTarget and into the proxy.
Bug: skia:
Change-Id: I21219a58028bdb4590940210e565133093cd34b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235672
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
The existing intersect logic already fails if either argument is empty,
without performing any extra checks.
Change-Id: I4cc4f1e63af7efbed4e1084284c1607c104ff361
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237142
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Today we do a fairly decent job of tracking device bounds as an SkIRect,
with a little more of that plumbed through here, but that gets foiled in
SkNoPixelsDevice's constructor where we only look at bounds.width() and
bounds.height().
I think the idea was to follow the usual constraint that a "base" layer
has an origin at (0,0) and only temporary "save" layers on top might be
offset, but for a device without any pixels it's pretty reasonable for
the base layer to be offset too.
This makes picture_cull_rect draw correctly in serialize-8888 mode.
Bug: skia:9334
Change-Id: I845e74779bb21cbfd4051b0ef07381e684176eac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236859
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This reverts commit e67133b8e5.
Removing testing code that's no longer needed.
Change-Id: I27bc5c77d1bc1b928d5cdb89daf82ab5fd3878c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236338
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This allows us to test with fReduceOpListSplitting both enabled and
disabled.
This CL also requires adding basic mipmap support to GrMockGpu.
Bug: skia:
Change-Id: I97ba912a9e5f3b90756c027ac19c003c99c15902
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235996
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Also don't specify redundant width/height to SkGpuDevice.
Change-Id: I389df5c4b073c2c05632ba6b7c95b02a22dfaf98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235824
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>