This reverts commit 9ac0407006.
Reason for revert: Breaking DDL Win10 skpbench bot
Original change's description:
> Distinguish between "flushed" and "finished" idle state callbacks on GrTexture.
>
> This is necessary to convert the promise image API to call Release when all
> work is flushed and Done when all work is complete (future work).
>
> Change-Id: I9745952bb0978ca2aaa79aeed460730b2fea856e
> Bug: skia:8800
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197163
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:8800
Change-Id: I5e6c4ea072beb4fb67a53d2ea2b007a7d201799d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198603
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit c5e8e150c8.
Reason for revert: Reverting to revert 9ac0407006https://skia-review.googlesource.com/c/skia/+/197163
Original change's description:
> Change promise image contract to for when Release and Done are called.
>
> Now Release is called when all work related to the SkImage is flushed
> and Done is called when it is finished on the GPU in Vulkan. In GL they
> are still both called back-to-back after flushing.
>
> Bug: skia:8800
> Change-Id: I990be7b9ebef8411590afd860ef40511fb5fee32
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198165
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I13e8211d89ed1b7694c2d7734eeaaf4ba9ad410a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8800
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198602
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Now Release is called when all work related to the SkImage is flushed
and Done is called when it is finished on the GPU in Vulkan. In GL they
are still both called back-to-back after flushing.
Bug: skia:8800
Change-Id: I990be7b9ebef8411590afd860ef40511fb5fee32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198165
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Previously, we relied on ops to deduce whether a draw would have
hardware coverage modulation as a result mixed samples. This is
problematic because *any* draw can have mixed samples coverage if
there is a multisampled stencil clip. No ops were checking for stencil
clip, and most just said they never used mixed samples.
Now that the only usecase for mixed samples is the stencil buffer,
this CL makes the processorSet automatically deduce mixed samples
coverage from the stencil settings and fsaaType.
Bug: skia:
Change-Id: Ib69b84bc03b12f6efb8e7d6ed721ae1612785315
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197281
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
In future Ganesh the SkImage's will only have GrImageContexts. asTextureProxyRef, however, may need to perform some rendering thus requires an external GrRecordingContext.
Change-Id: I893573e9f3462b4c4cf5e29a7f8ee74027a2ce6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197134
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This is necessary to convert the promise image API to call Release when all
work is flushed and Done when all work is complete (future work).
Change-Id: I9745952bb0978ca2aaa79aeed460730b2fea856e
Bug: skia:8800
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197163
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: b/126595186
Change-Id: I0a23ca2a7cc47bd02bb535566aa37627899249ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197201
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This converts a number of ownership semantics by using sk_sp and
unique_ptr instead of comments.
Change-Id: I4c584a5a8ea54fd22a4d23deddb5ce844f883117
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197206
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Now that we never re-fulfill a promise image we no longer need to deinstantiate
promise image proxies. They now can use kSingleUse callback semantics.
This was the only usage of the kDeinstantiate lazy callback type so it is
removed. The DeinstantiateProxyTracker is also no longer required and is
removed.
The GrTexture idle callback mechanism now uses GrReleaseProcHelper, which has
been extended to support chaining multiple callbacks together and an abandon()
method that aborts calling the callback in the destructor. It has been renamed
GrRefCntedCallback to reflect its more general usage.
Bug: skia:8800
Change-Id: I857c9eec57fdf706631a266ec8bea682d6657a7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196500
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
SkCanvas::flush is problematic and we wish to deprecate it. As a first step, this CL begins to remove Skia's internal usage of it.
Ideally clients would use SkSurface::flush and/or GrContext::flush.
Change-Id: I39bb0702f8230134a97961a4ee70833fd5bd0dcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196641
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
For now this is distinct from kRGBA_F16_SkColorType but treated the
same. Next steps are to see if we can keep it clamped to [0,1].
Switched a few switches away from default to exhaustive.
Took away any explicit SW clamps for now except the one we definitely
want in append_gamut_clamp_if_normalized().
Skip F16Norm in the DDL test because we can't yet distinguish it from
F16.
Change-Id: I021a864fe078e4fa4e2b399982e6c38350e10d74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196371
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Bug: skia:
Change-Id: I5e664939a446616ef57acc79d26a10e6908cda10
Reviewed-on: https://skia-review.googlesource.com/c/196643
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: skia:
Change-Id: I9bab3ff73d3934786d7457c4b1bcf67d01c653f3
Reviewed-on: https://skia-review.googlesource.com/c/196060
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Add SSE, SSE4.1, and NEON specializations.
The if_then_else() unit tests in SkVxTest.cpp should cover this.
I had to give up on my dream of not using Skia headers for now. There's
really no good way of knowing whether we've got SSE4.1 support in MSVC
except when we explicitly define SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41.
This refactor to use SK_CPU_SSE_LEVEL let MSVC point out a slight
ordering problem that would cause an infinite loop calling any of
the specializions like sqrt(float2). I believe moving them after
the float4 specializations will fix that.
Change-Id: I83639f378a182716d1b37e92b6d725472698f874
Reviewed-on: https://skia-review.googlesource.com/c/195920
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This is a reland of dfe5000a5f
Original change's description:
> Stack-allocate pipelines for GrMeshDrawOp
>
> Stack-allocates the pipelines in onExecute. This saves us from having
> to store the pipelines on the heap, as well as delaying the need to
> detach processors until onExecute. The delay is an improvement because
> it allows us to keep visiting proxies after onPrepare. (Previously,
> they were moved out of GrProcessorSet and into a pipeline during
> onPrepare, so visiting proxies was impossible after that point.)
>
> Bug: skia:8731
> Change-Id: Idc05063fb0dfbfed42b434e429fa5a497097bdae
> Reviewed-on: https://skia-review.googlesource.com/c/193368
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com
Bug: skia:8731
Change-Id: I32def1a35bb0593470fa672691a9e697dc6d9680
Reviewed-on: https://skia-review.googlesource.com/c/195261
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This reverts commit dfe5000a5f.
Reason for revert: HWAA pipeline flag not getting set for dashing.
Original change's description:
> Stack-allocate pipelines for GrMeshDrawOp
>
> Stack-allocates the pipelines in onExecute. This saves us from having
> to store the pipelines on the heap, as well as delaying the need to
> detach processors until onExecute. The delay is an improvement because
> it allows us to keep visiting proxies after onPrepare. (Previously,
> they were moved out of GrProcessorSet and into a pipeline during
> onPrepare, so visiting proxies was impossible after that point.)
>
> Bug: skia:8731
> Change-Id: Idc05063fb0dfbfed42b434e429fa5a497097bdae
> Reviewed-on: https://skia-review.googlesource.com/c/193368
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=robertphillips@google.com,csmartdalton@google.com
Change-Id: If706f19423310846de70288f393ac12f17ffeee5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:8731
Reviewed-on: https://skia-review.googlesource.com/c/195161
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This moves the smart pointer use up one more level in preparation for
changing SkTypeface::openStream to return unique_ptr as well.
Change-Id: Ib8173d59e03de38b06f6e1b4e6776f1961055ae7
Reviewed-on: https://skia-review.googlesource.com/c/195121
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Stack-allocates the pipelines in onExecute. This saves us from having
to store the pipelines on the heap, as well as delaying the need to
detach processors until onExecute. The delay is an improvement because
it allows us to keep visiting proxies after onPrepare. (Previously,
they were moved out of GrProcessorSet and into a pipeline during
onPrepare, so visiting proxies was impossible after that point.)
Bug: skia:8731
Change-Id: Idc05063fb0dfbfed42b434e429fa5a497097bdae
Reviewed-on: https://skia-review.googlesource.com/c/193368
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This reverts commit 22170b3178.
It was reverted due to the test breaking Google3. This includes a
workaround.
Original change's description:
> Treat kWEBP encode with quality=100 as lossless
>
> In SkEncodeImage and friends, treat quality of 100 as a lossless encode
> when using kWEBP. This seems a good fit for the intent - which is
> presumably to save the highest quality image. This also matches
> Chromium's blink::ImageEncoder::ComputeWebpOptions, which treats a
> quality of 1 (on a float scale from 0 to 1) as a lossless encode.
>
> FWIW, Chromium has had this behavior since
> https://codereview.chromium.org/1937433002, in response to
> crbug.com/523098. The goal is to "maintain sharpness to
> match the JPEG encoder behavior (use WEBP lossless encoding)".
>
> Add a test to verify the new behavior. This requires making tests
> depend on libwebp to use WebPGetFeatures, since the Skia API does not
> provide a way to determine whether an encoded webp file was encoded
> lossless-ly or lossily.
>
> Bug: skia:8586
> Change-Id: Ie9e09c2f7414ab701d696c4ad9edf405868a716f
> Reviewed-on: https://skia-review.googlesource.com/c/175823
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
TBR=reed@google.com, based on prior approval
Bug: skia:8586
Change-Id: I09c73f71996422f797fd9456fef5dfad9af36839
Reviewed-on: https://skia-review.googlesource.com/c/194194
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Add a new constructor which merges the SkISize scaledSize with the
SkImageInfo. This allows passing an SkColorSpace to the decode.
Update the test to call the new API.
Bug: b/123301872
Change-Id: I9fd89198e97ac9b8e6dc9fcfe89ed38913a0fe69
Reviewed-on: https://skia-review.googlesource.com/c/189303
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This CL does make use of a new GrRecordingContextPriv backdoor to break CL deadlocks. This occurs when this CL tries to create GrContext-dependent objects outside its scope.
Change-Id: I278fe9d321f8e0a4f5e9b489b1a5cc01b8974521
Reviewed-on: https://skia-review.googlesource.com/c/191287
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This makes sure we don't call the release proc on an external image before
the transition to the external queue finishes on the gpu.
Bug: skia:
Change-Id: I35b0e3899fcd859cd5ccaa57df9427a47d434210
Reviewed-on: https://skia-review.googlesource.com/c/194004
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This fixes an issue in Chrome where Skia is calling a promise SkImage
texture release proc from ~SkImage that in turn flushes a SkSurface.
Prior to this change this caused an assert because we had already
decremented the GrTexture's ref count priot to calling the release
proc. This made the GrTexture purgeable, but the cache had not yet
been notified that the texture was purgeable and still had it in its
array of non-purgeable resources. This triggered an assert in the
cache's self-validation checks during the flush.
Now we call the release proc just prior to decrementing the ref count.
This also makes it legal to re-ref the resources from the release proc.
Bug: chromium:933526
Change-Id: I8cd921b77ca3dfe112089f9a553c1a625160d16d
Reviewed-on: https://skia-review.googlesource.com/c/194000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit b03b80066b.
Reason for revert: !@#$%^&*
Original change's description:
> remove linear sRGB singleton
>
> Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
> Change-Id: I01e2515cfa8e5356ee862ea7184bb7ceb4c9176f
> Reviewed-on: https://skia-review.googlesource.com/c/192038
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=mtklein@google.com,brianosman@google.com
Change-Id: Ic88368e193aaa48b9aa6d3a6c145377681b2a5db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Reviewed-on: https://skia-review.googlesource.com/c/194005
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I01e2515cfa8e5356ee862ea7184bb7ceb4c9176f
Reviewed-on: https://skia-review.googlesource.com/c/192038
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
With this formalization, the edge-AA APIs in GrRTC can distinguish
between tiling cases and regular drawing cases implemented using
kNone or kAll for the AA flags. This means fillRectToRect can be
implemented in terms of fillRectWithEdgeAA.
It also means the drawTexture cases will properly handle
isolated draws and tiled draws when drawing into MSAA.
Bug: skia:
Change-Id: I248dd001919228a958cf84b6bc91363b58b72c0b
Reviewed-on: https://skia-review.googlesource.com/c/192023
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Should allow more stroke cases to succeed, and simplifies the impl.
Bug: oss-fuzz:6811
Change-Id: I53390f57372938ba6d732726486a567c26ff121f
Reviewed-on: https://skia-review.googlesource.com/c/131140
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Refactor Sk4f transformations into reusable internal function.
Switches the SkRect+SkMatrix ctor to a factory method.
Adds simple constructors for Sk4fs and SkRects w/o transforms.
Bug: skia:
Change-Id: I88a4a5f7304b1cf00d68c7772bb0fc19c97abee3
Reviewed-on: https://skia-review.googlesource.com/c/191569
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Remove the internal-only/XMLWriter-based factory.
Update SkSVGDevice to always own the xml writer.
The only internal client passing an interesting XMLWriter is
SVGDeviceTest - update to use the device factory directly.
While at it, update the SkSVGDevice factory to return smart pointers
(Create -> Make).
Change-Id: Ibda1ca86ef9fb81ab512822000835ace1af67978
Reviewed-on: https://skia-review.googlesource.com/c/192580
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This makes drawTexture handle blend modes with a fallback to be consistent
with drawTextureSet. Simple draws (other than non src-over) should be
faster now since they will skip the extra overhead of the GrTextureAdjuster.
It also refactors the GrPaint emulation of GrTextureOp into a function,
which will be reused in the general-purpose quad APIs.
Bug: skia:
Change-Id: Idad67ec749b82c6894df6ec2b57987130125b910
Reviewed-on: https://skia-review.googlesource.com/c/191360
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This is needed to support importing of RGBX AHB into skia's vulkan backend.
With this CL we only enable the new pixel config to be textureable.
Bug: skia:
Change-Id: Iba9180c14f3ef633ae846091cf453d68f82ce544
Reviewed-on: https://skia-review.googlesource.com/c/192035
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Use RawIter, so we can dependably peek() (since consumeDegenerates in
Iter() make peeking unreliable), which caused us to think there were two
real contours in the test case.
Bug: oss-fuzz:13013
Change-Id: I0d85f3e6a83cb972c4d801dd9b17f0e388b926d0
Reviewed-on: https://skia-review.googlesource.com/c/192025
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
The path renderers convert paths into Ganesh ops when recording so should also be able to make due with only the GrRecordingContext.
Change-Id: Ie796af73ca5aa2a074ebd037d6d558ec85ff5928
Reviewed-on: https://skia-review.googlesource.com/c/191568
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Since, by definition, the ops are created when recording, it makes sense that they should be able to make due with only the GrRecordingContext.
TBR=bsalomon@google.com
Change-Id: If64353aee30b35d0a16401f7de00954f44ed8c59
Reviewed-on: https://skia-review.googlesource.com/c/190670
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
GrPixelConfig is no longer public so there is no need for us to have the
special private configs.
Bug: skia:
Change-Id: Id732a3b2db3a7b9fd5d767e5548e796a4e670547
Reviewed-on: https://skia-review.googlesource.com/c/191572
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>