Change-Id: I6a48410f2203a0a88831d02713b9b7475fb6e5a6
Reviewed-on: https://skia-review.googlesource.com/c/192826
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@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>
When the GrImageContext & GrRecordingContext are actually GrDirectContexts it is useful for them to report the abandonment state of the GrDirectContext.
When the GrImageContext & GrRecordingContext are actually GrImageCreationContext or GrDDLContexts then they will just never be abandoned.
This CL also strips the GrProxyProvider and GrDrawingManager of their tracking on abandonment and centralizes it in the GrImageContext.
ImageContext
can't abandon
can only check abandonment privately
RecordingContext
can't abandon
can only check abandonment privately
DirectContext (aka GrContext)
can abandon publicly
can check abandonment publicly
Note that abandoning the DirectContext won't alter the abandonment status of any of
the other contexts in its group (e.g., DDL contexts that may be being used to record).
Change-Id: Ib790f74d90ab18da58a127fed2aad20e2477bd21
Reviewed-on: https://skia-review.googlesource.com/c/190669
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: chromium:926235
Change-Id: I338323847c34dabdbd963efe631f7dc1351ed8cc
Reviewed-on: https://skia-review.googlesource.com/c/191143
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This function binds texture ID 0 to any texture unit/target combo that
Skia has modified.
Bug: chromium:926017
Change-Id: I3ac8f8050c863232886102886e60d3b91a5380c9
Reviewed-on: https://skia-review.googlesource.com/c/190663
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Any context that records ops (i.e., direct and/or DDL) will need these two objects.
Change-Id: Ifd3527c23a4015f7d469ad2222563508cccbd339
Reviewed-on: https://skia-review.googlesource.com/c/190307
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This starts to beef up the capabilities of the GrImageContext in preparation for its future responsibilities (i.e., creating promise images w/o a recordingContext).
Note that the proxyProvider still has different behavior if it has a full context vs. a reduced context. I intend to just let this behavior remain as is.
Change-Id: Idb9d99a548ef928fc1b9dc1e5a34f74343bb0b4b
Reviewed-on: https://skia-review.googlesource.com/c/189490
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Also remove unused invalid ID factory function.
Change-Id: Iacfb14a0a652ac6bf6a6c59d71144ed01463839e
Reviewed-on: https://skia-review.googlesource.com/c/190302
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This makes the "matches" functionality available to all the context flavors and uses it for SkImages
Change-Id: I1e3d55f19a7752a9da8789e93a848b7a7a64d180
Reviewed-on: https://skia-review.googlesource.com/c/190227
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
GrBuffer is a base class for GrGpuBuffer and GrCpuBuffer. GrGpuBuffer is a
GrGpuResource and the others are not. This allows GrCpuBuffers to exist
outside of the GrGpuResourceCache.
Also removes flags from GrResourceProvider buffer factory function. The
only flag still in use was kRequireGpuMemory. Now CPU buffers are made
without using GrResourceProvider.
Change-Id: I82670d1316e28fd6331ca36b26c8c4ead33846f9
Reviewed-on: https://skia-review.googlesource.com/c/188823
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Both GrContext and GrContextThreadSafeProxy had their own copies. This centralizes ownership and standardizes how all the contexts get initialized.
Change-Id: Ib2e418fbb53fcd6b0054789ef30a5fc4a3d80b20
Reviewed-on: https://skia-review.googlesource.com/c/189305
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Mechanical. This makes the priv() accessor the same for all the context types.
Change-Id: I40850eb05a33b8d7cc3eabdd42226d24b2ba58aa
Reviewed-on: https://skia-review.googlesource.com/c/189164
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
The main thrust of this CL is to bring the GrContextThreadSafeProxy into the fold.
Change-Id: I8f457d5b75c69f89beac3a0035b1c05ba5d3b931
Reviewed-on: https://skia-review.googlesource.com/c/188622
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
The GrContext's ID isn't really unique any more (since it can be shared among a family of contexts). Change its name to reflect the new reality.
Additionally, no client seems to be using it so make it private.
Change-Id: Ibb9004d699fe6ca7876b3be94142e612b5b9efbd
Reviewed-on: https://skia-review.googlesource.com/c/188308
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This begins the process of splitting GrContext into:
GrContext_Base, GrImageContext, GrRecordingContext and GrDirectContext.
Change-Id: I3c43045f2a5549b049e95791d65f74d4e16de36f
Reviewed-on: https://skia-review.googlesource.com/c/186878
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This just shuffles stuff around.
Change-Id: I90e24a73bf44dd3e88fc121a0528bf94e4fdead4
Reviewed-on: https://skia-review.googlesource.com/c/187786
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This just shuffles stuff around.
Change-Id: Ieab35f50945efe87512d7077cb994132f0e0b6ef
Reviewed-on: https://skia-review.googlesource.com/c/186874
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This moves us to the correct way of handling the correct version of
Vulkan that the client wants us to use.
Bug: skia:
Change-Id: I6c7962b5d2d48ae142c6a701c30f5af3801ac99b
Reviewed-on: https://skia-review.googlesource.com/c/187382
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
kUnbudgetedCacheable now means that the resource is never purged
until its unique key is removed.
This fixes an issue where a cached texture for a promise image
might get purged by cache pressure. This in turn could cause
Skia to call the promise image's Fulfill proc multiple times with
no intervening Release calls. The balancing Release calls would
occur, but the policy is that each Fulfill should be balanced by
Release *before* another Fulfill.
Update/add unit tests.
Bug: chromium:922851
Change-Id: I6411e413b3104721ca4bb6e7f07b3b73d14cbcf9
Reviewed-on: https://skia-review.googlesource.com/c/186361
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Make all wrapped resources be kUnbudgetedUncacheable except those
created by AHardwareBuffer image generators and as backings for promise
images.
Make all non-wrapped unbudgeted resources be kUnbudgetedUncacheable.
Update unit tests to mostly use GrWrapCacheable::kNo except where they
are testing the distinction.
Update unit tests for new expectations.
Bug: chromium:922851
Change-Id: I4d3bdaa161ffc76390f26334bcb7e2b47dd9319d
Reviewed-on: https://skia-review.googlesource.com/c/185004
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Store budgeted status as a tri-state enum on GrGpuResource:
kBudgeted
kUnbudgetedCacheable
kUnbudgetedUncacheable
Uncacheable vs. Cacheable captures the current distinction between
wrapped resources created with purgeImmediately or !purgeImmediately.
Non-wrapped and unbudgeted resources are all kUnbudgetedCacheable to
match current behavior.
This change just introduces the new types. No behavior is changed.
Bug: chromium:922851
Change-Id: Ic2387bf321cf9b56b4c9ffd9dbef8ade60f9cb98
Reviewed-on: https://skia-review.googlesource.com/c/185003
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
fulfills a different SkImage.
Bug: skia:8613
Change-Id: I7ee14112c69f8aaef223a37dda455259b501a2bf
Reviewed-on: https://skia-review.googlesource.com/c/184440
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:
Change-Id: Ib029f337f5e61366e2550e77dc99310b44d03f84
Reviewed-on: https://skia-review.googlesource.com/c/182970
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Unlike other ops, always use half-float colors. The logic around the
Instance struct makes dynamically switching color size tricky.
CCPR stores color in a per-instance attribute though, so the cost of
always using FP16 is much lower.
Bug: skia:
Change-Id: I9c0c64940f74f915a18417a5830030558e065d28
Reviewed-on: https://skia-review.googlesource.com/c/182760
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
We want to hide this API from general public use. Chromium can dig into
skia to include it as it does with other Skia API's that are in src
Bug: skia:
Change-Id: I00dc36d181237ea0785eefb31ad6c2d4e50e3c68
Reviewed-on: https://skia-review.googlesource.com/c/180648
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This sets up the context and adds support for creating RTContexts, RTProxies, RTs,
and GrVkRenderPass's that wrap the external secondary command buffer.
Bug: skia:
Change-Id: I80ebbb690a5fe464f775c5fcad651dfe2a150418
Reviewed-on: https://skia-review.googlesource.com/c/178926
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
With this change clients will still have to have vulkan/vulkan_core.h
on their include path when compiling files that include Skia. However,
it will not be required when compiling Skia files.
Bug: skia:
Change-Id: I1cd75f4f18d3097c8a1606c3e8a51a371b01b565
Reviewed-on: https://skia-review.googlesource.com/c/179560
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
A proc can be registered with a GrTexture. The proc will be called when
it is safe to delete the texture is "idle." Idle means it referred to
outside of GrResourceCache and that the I/O operations on the GPU are
completed (this latter part applieas to Vulkan only).
The intended use case for this is to call promise image texture release
procs once we start caching GrTextures for deinstantiated promise
images.
Bug= skia:8613
Change-Id: Idce9a4292fef7b15370a053060d8878a9d6828fa
Reviewed-on: https://skia-review.googlesource.com/c/178937
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Enough's enough. It's been a long time since the standard was updated.
Change-Id: I49ae08ee49f06cb8403c9cb72a811edd35b25575
Reviewed-on: https://skia-review.googlesource.com/c/178930
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I697e34c779112a01b36580a2f22ebce420542e33
Reviewed-on: https://skia-review.googlesource.com/c/178933
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This flag is annoying to set correctly when writing test code.
Fortunately it has become redundant with the "is GL FBO 0" flag.
Change-Id: Ifd88292d2d6ea05bfe0d269e853baff857e70bfe
Reviewed-on: https://skia-review.googlesource.com/c/178929
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
BUG=chromium:910360
Change-Id: Ibd353d851626cca1b44bcfe38de5039a772bc6f0
Reviewed-on: https://skia-review.googlesource.com/c/178284
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Moves method to get GrBackendFormat from GrBackendTexture from GrCaps
to GrBackendTexture so that a GrContext is not required.
Uses kUnknown_GrPixelConfig as failure return from GrCaps functions
rather than an GrPixelConfig* out param and bool result.
Having the texture type be part of GrBackendFormat made removing the
GrCaps function that goes from GrBackendRenderTarget to GrPixelConfig
awkward so that was left alone for now.
Change-Id: If9be0f898c538be4a7b24022b6011f63441a0317
Reviewed-on: https://skia-review.googlesource.com/c/175991
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>