58class MutableTextureState;
59class RefCntedCallback;
145 int renderTargetSampleCnt,
152 std::string_view label);
161 int renderTargetSampleCnt,
165 std::string_view label);
288 bool prepForTexSampling =
false);
299 bool prepForTexSampling =
false) {
419 [[nodiscard]]
virtual std::unique_ptr<GrSemaphore>
makeSemaphore(
bool isOwned =
true) = 0;
463 void reset() { *
this = {}; }
465 int textureCreates()
const {
return fTextureCreates; }
468 int textureUploads()
const {
return fTextureUploads; }
471 int transfersToTexture()
const {
return fTransfersToTexture; }
474 int transfersFromSurface()
const {
return fTransfersFromSurface; }
478 int bufferTransfers()
const {
return fBufferTransfers; }
480 int stencilAttachmentCreates()
const {
return fStencilAttachmentCreates; }
483 int msaaAttachmentCreates()
const {
return fMSAAAttachmentCreates; }
486 int numDraws()
const {
return fNumDraws; }
489 int numFailedDraws()
const {
return fNumFailedDraws; }
492 int numSubmitToGpus()
const {
return fNumSubmitToGpus; }
495 int numScratchTexturesReused()
const {
return fNumScratchTexturesReused; }
498 int numScratchMSAAAttachmentsReused()
const {
return fNumScratchMSAAAttachmentsReused; }
501 int renderPasses()
const {
return fRenderPasses; }
504 int numReorderedDAGsOverBudget()
const {
return fNumReorderedDAGsOverBudget; }
507#if defined(GR_TEST_UTILS)
509 void dumpKeyValuePairs(
513 int fTextureCreates = 0;
514 int fTextureUploads = 0;
515 int fTransfersToTexture = 0;
516 int fTransfersFromSurface = 0;
517 int fBufferTransfers = 0;
518 int fStencilAttachmentCreates = 0;
519 int fMSAAAttachmentCreates = 0;
521 int fNumFailedDraws = 0;
522 int fNumSubmitToGpus = 0;
523 int fNumScratchTexturesReused = 0;
524 int fNumScratchMSAAAttachmentsReused = 0;
525 int fRenderPasses = 0;
526 int fNumReorderedDAGsOverBudget = 0;
530#if defined(GR_TEST_UTILS)
574 std::string_view label);
578 std::array<float, 4>
color);
623#if defined(GR_TEST_UTILS)
625 virtual bool isTestingOnlyBackendTexture(
const GrBackendTexture&)
const = 0;
648 virtual const GrGLContext* glContextForTesting()
const {
return nullptr; }
651 virtual void resetShaderCacheForTesting()
const {}
657 virtual void testingOnly_startCapture() {}
658 virtual void testingOnly_stopCapture() {}
666 int numStencilSamples) = 0;
679 this->resetContext();
699 uint32_t mipLevels = 1)
const;
714 std::string_view label) = 0;
723 std::array<float, 4>
color) = 0;
744 int renderTargetSampleCnt,
748 uint32_t levelClearMask,
749 std::string_view label) = 0;
756 size_t dataSize) = 0;
784 size_t rowBytes) = 0;
793 bool prepForTexSampling) = 0;
809 size_t rowBytes) = 0;
848 void reportSubmitHistograms();
851#ifdef SK_ENABLE_DUMP_GPU
859 int renderTargetSampleCnt,
863 uint32_t levelClearMask,
864 std::string_view label);
866 void resetContext() {
871 void callSubmittedProcs(
bool success);
879 struct SubmittedProc {
890#if SK_HISTOGRAMS_ENABLED
891 int fCurrentSubmitRenderPassCount = 0;
static const uint32_t kAll_GrBackendState
void * GrGpuSubmittedContext
void * GrGpuFinishedContext
void(* GrGpuSubmittedProc)(GrGpuSubmittedContext submittedContext, bool success)
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
void incNumSubmitToGpus()
void incNumScratchTexturesReused()
void incNumReorderedDAGsOverBudget()
void incBufferTransfers()
void incNumScratchMSAAAttachmentsReused()
void incStencilAttachmentCreates()
void incTransfersFromSurface()
void incTransfersToTexture()
void incMSAAAttachmentCreates()
virtual std::unique_ptr< GrSemaphore > makeSemaphore(bool isOwned=true)=0
bool writePixels(GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType srcColorType, const GrMipLevel texels[], int mipLevelCount, bool prepForTexSampling=false)
bool writePixels(GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType srcColorType, const void *buffer, size_t rowBytes, bool prepForTexSampling=false)
virtual bool onReadPixels(GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType dstColorType, void *, size_t rowBytes)=0
virtual bool precompileShader(const SkData &key, const SkData &data)
virtual sk_sp< GrTexture > onCreateTexture(SkISize dimensions, const GrBackendFormat &, GrRenderable, int renderTargetSampleCnt, skgpu::Budgeted, GrProtected, int mipLevelCoont, uint32_t levelClearMask, std::string_view label)=0
virtual bool onTransferPixelsTo(GrTexture *, SkIRect, GrColorType textureColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer > transferBuffer, size_t offset, size_t rowBytes)=0
virtual GrBackendTexture onCreateCompressedBackendTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, GrProtected)=0
virtual void insertSemaphore(GrSemaphore *semaphore)=0
bool readPixels(GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType dstColorType, void *buffer, size_t rowBytes)
virtual void onReportSubmitHistograms()
virtual GrBackendTexture onCreateBackendTexture(SkISize dimensions, const GrBackendFormat &, GrRenderable, skgpu::Mipmapped, GrProtected, std::string_view label)=0
virtual void deleteBackendTexture(const GrBackendTexture &)=0
bool submitToGpu(GrSyncCpu sync)
void dumpJSON(SkJSONWriter *) const
virtual bool onCopySurface(GrSurface *dst, const SkIRect &dstRect, GrSurface *src, const SkIRect &srcRect, GrSamplerState::Filter)=0
const GrCaps * caps() const
bool regenerateMipMapLevels(GrTexture *)
GrBackendTexture createCompressedBackendTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, GrProtected)
virtual void finishOutstandingGpuWork()=0
virtual GrOpsRenderPass * onGetOpsRenderPass(GrRenderTarget *renderTarget, bool useMSAASurface, GrAttachment *stencil, GrSurfaceOrigin, const SkIRect &bounds, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies, GrXferBarrierFlags renderPassXferBarriers)=0
GrDirectContext * getContext()
virtual void willExecute()
virtual bool onTransferFromBufferToBuffer(sk_sp< GrGpuBuffer > src, size_t srcOffset, sk_sp< GrGpuBuffer > dst, size_t dstOffset, size_t size)=0
void didWriteToSurface(GrSurface *surface, GrSurfaceOrigin origin, const SkIRect *bounds, uint32_t mipLevels=1) const
virtual bool onTransferPixelsFrom(GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer > transferBuffer, size_t offset)=0
virtual bool onWritePixels(GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType srcColorType, const GrMipLevel[], int mipLevelCount, bool prepForTexSampling)=0
virtual sk_sp< GrTexture > onWrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType)=0
virtual sk_sp< GrRenderTarget > onWrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo &, const GrVkDrawableInfo &)
virtual void waitSemaphore(GrSemaphore *semaphore)=0
bool updateCompressedBackendTexture(const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, const void *data, size_t length)
virtual sk_sp< GrAttachment > makeStencilAttachment(const GrBackendFormat &colorFormat, SkISize dimensions, int numStencilSamples)=0
virtual sk_sp< GrTexture > onWrapCompressedBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable)=0
virtual void releaseUnlockedBackendObjects()
void resolveRenderTarget(GrRenderTarget *, const SkIRect &resolveRect)
virtual void storeVkPipelineCacheData()
virtual std::unique_ptr< GrSemaphore > prepareTextureForCrossContextUsage(GrTexture *)=0
bool checkAndResetOOMed()
sk_sp< GrTexture > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType)
virtual void prepareSurfacesForBackendAccessAndStateUpdates(SkSpan< GrSurfaceProxy * > proxies, SkSurfaces::BackendSurfaceAccess access, const skgpu::MutableTextureState *newState)
virtual void addFinishedProc(GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)=0
virtual sk_sp< GrAttachment > makeMSAAAttachment(SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless isMemoryless)=0
virtual bool onClearBackendTexture(const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, std::array< float, 4 > color)=0
virtual sk_sp< GrGpuBuffer > onCreateBuffer(size_t size, GrGpuBufferType intendedType, GrAccessPattern)=0
virtual bool onRegenerateMipMapLevels(GrTexture *)=0
virtual bool setBackendRenderTargetState(const GrBackendRenderTarget &, const skgpu::MutableTextureState &, skgpu::MutableTextureState *previousState, sk_sp< skgpu::RefCntedCallback > finishedCallback)
bool transferPixelsFrom(GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer > transferBuffer, size_t offset)
sk_sp< const GrCaps > refCaps() const
void resetTextureBindings()
bool transferFromBufferToBuffer(sk_sp< GrGpuBuffer > src, size_t srcOffset, sk_sp< GrGpuBuffer > dst, size_t dstOffset, size_t size)
virtual bool compile(const GrProgramDesc &, const GrProgramInfo &)=0
void markContextDirty(uint32_t state=kAll_GrBackendState)
virtual bool onSubmitToGpu(GrSyncCpu sync)=0
virtual void onResetContext(uint32_t resetBits)
virtual sk_sp< GrRenderTarget > onWrapBackendRenderTarget(const GrBackendRenderTarget &)=0
sk_sp< GrGpuBuffer > createBuffer(size_t size, GrGpuBufferType intendedType, GrAccessPattern accessPattern)
virtual GrBackendFormat getPreferredStencilFormat(const GrBackendFormat &)=0
virtual GrThreadSafePipelineBuilder * pipelineBuilder()=0
const GrDirectContext * getContext() const
virtual GrStagingBufferManager * stagingBufferManager()
virtual void onResetTextureBindings()
sk_sp< GrRenderTarget > wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo &, const GrVkDrawableInfo &)
virtual void submit(GrOpsRenderPass *)=0
virtual void onResolveRenderTarget(GrRenderTarget *target, const SkIRect &resolveRect)=0
GrBackendTexture createBackendTexture(SkISize dimensions, const GrBackendFormat &, GrRenderable, skgpu::Mipmapped, GrProtected, std::string_view label)
virtual bool isDeviceLost() const
sk_sp< GrRenderTarget > wrapBackendRenderTarget(const GrBackendRenderTarget &)
virtual sk_sp< GrTexture > onWrapRenderableBackendTexture(const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable)=0
static bool CompressedDataIsCorrect(SkISize dimensions, SkTextureCompressionType, skgpu::Mipmapped, const void *data, size_t length)
virtual sk_sp< GrTexture > onCreateCompressedTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Budgeted, skgpu::Mipmapped, GrProtected, const void *data, size_t dataSize)=0
bool copySurface(GrSurface *dst, const SkIRect &dstRect, GrSurface *src, const SkIRect &srcRect, GrSamplerState::Filter filter)
void executeFlushInfo(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess access, const GrFlushInfo &, const skgpu::MutableTextureState *newState)
virtual bool setBackendTextureState(const GrBackendTexture &, const skgpu::MutableTextureState &, skgpu::MutableTextureState *previousState, sk_sp< skgpu::RefCntedCallback > finishedCallback)
virtual GrRingBuffer * uniformsRingBuffer()
virtual void disconnect(DisconnectType)
sk_sp< GrTexture > wrapCompressedBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable)
GrOpsRenderPass * getOpsRenderPass(GrRenderTarget *renderTarget, bool useMSAASurface, GrAttachment *stencil, GrSurfaceOrigin, const SkIRect &bounds, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies, GrXferBarrierFlags renderPassXferBarriers)
virtual bool onUpdateCompressedBackendTexture(const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, const void *data, size_t length)=0
virtual void xferBarrier(GrRenderTarget *, GrXferBarrierType)=0
void initCaps(sk_sp< const GrCaps > caps)
virtual void takeOwnershipOfBuffer(sk_sp< GrGpuBuffer >)
virtual void checkFinishProcs()=0
bool transferPixelsTo(GrTexture *texture, SkIRect rect, GrColorType textureColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer > transferBuffer, size_t offset, size_t rowBytes)
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, GrRenderable renderable, int renderTargetSampleCnt, skgpu::Budgeted budgeted, GrProtected isProtected, GrColorType textureColorType, GrColorType srcColorType, const GrMipLevel texels[], int texelLevelCount, std::string_view label)
virtual std::unique_ptr< GrSemaphore > wrapBackendSemaphore(const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership)=0
void handleDirtyContext()
sk_sp< GrTexture > createCompressedTexture(SkISize dimensions, const GrBackendFormat &format, skgpu::Budgeted budgeted, skgpu::Mipmapped mipmapped, GrProtected isProtected, const void *data, size_t dataSize)
sk_sp< GrTexture > wrapRenderableBackendTexture(const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable)
bool clearBackendTexture(const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, std::array< float, 4 > color)
virtual sk_sp< GrThreadSafePipelineBuilder > refPipelineBuilder()=0
static const uint8_t buffer[]
uint32_t uint32_t * format