83class RefCntedCallback;
118 fHWVertexArrayState.setVertexArrayID(
this,
id);
124 fHWVertexArrayState.notifyVertexArrayDelete(
id);
146 return fHWProgram.
get();
158 auto* attribState = fHWVertexArrayState.bindInternalVertexArray(
this, indexBuffer);
159 attribState->enableVertexArrays(
this, numAttribs, primitiveRestart);
173 bool invalidateReadBufferAfterBlit =
false);
180 this->copySurfaceAsDraw(rt,
true, rt, drawBounds, drawBounds,
181 GrSamplerState::Filter::kNearest);
210 SkISize dimensions,
int numStencilSamples)
override;
223 return fProgramCache->precompileShader(this->
getContext(), key, data);
226#if defined(GR_TEST_UTILS)
237 void resetShaderCacheForTesting()
const override { fProgramCache->
reset(); }
248 [[nodiscard]] std::unique_ptr<GrSemaphore>
makeSemaphore(
bool isOwned)
override;
288 std::string_view label)
override;
297 std::array<float, 4>
color)
override;
313 int renderTargetSampleCnt,
317 uint32_t levelClearMask,
318 std::string_view label)
override;
325 size_t dataSize)
override;
368 std::string_view label);
382 size_t rowBytes)
override;
390 bool prepForTexSampling)
override;
396 size_t size)
override;
404 size_t rowBytes)
override;
413 bool readOrTransferPixelsFrom(
GrSurface*,
418 int rowWidthInPixels);
436 void setTextureUnit(
int unitIdx);
445 bool useMultisampleFBO,
456 bool waitSync(
GrGLsync, uint64_t timeout,
bool flush);
467 ProgramCache(
int runtimeProgramCacheSize);
468 ~ProgramCache()
override;
477 Stats::ProgramCacheResult*);
486 Stats::ProgramCacheResult*);
497 void flushColorWrite(
bool writeColor);
498 void flushClearColor(std::array<float, 4>);
511 void disableWindowRectangles();
524 void disableStencil();
526 void flushConservativeRasterState(
bool enable);
528 void flushWireframeState(
bool enable);
530 void flushFramebufferSRGB(
bool enable);
537 bool uploadColorTypeTexData(
GrGLFormat textureFormat,
550 bool uploadColorToTex(
GrGLFormat textureFormat,
553 std::array<float, 4>
color,
558 void uploadTexData(
SkISize dimensions,
593 TempFBOTarget tempFBOTarget);
598#ifdef SK_ENABLE_DUMP_GPU
602 bool createCopyProgram(
GrTexture* srcTexture);
603 bool createMipmapProgram(
int progIdx);
605 std::unique_ptr<GrGLContext> fGLContext;
613 int fHWActiveTextureUnitIdx;
637 } fHWScissorSettings;
641 bool valid()
const {
return kInvalidSurfaceOrigin != fRTOrigin; }
642 void invalidate() { fRTOrigin = kInvalidSurfaceOrigin; }
643 bool knownDisabled()
const {
return this->valid() && !fWindowState.
enabled(); }
651 fRTOrigin = rtOrigin;
654 fWindowState = windowState;
659 if (!this->valid()) {
663 (fRTOrigin != rtOrigin || fWidth !=
width || fHeight !=
height)) {
666 return fWindowState == windowState;
670 enum { kInvalidSurfaceOrigin = -1 };
676 } fHWWindowRectsState;
683 class HWVertexArrayState {
685 HWVertexArrayState() : fCoreProfileVertexArray(nullptr) { this->invalidate(); }
687 ~HWVertexArrayState() {
delete fCoreProfileVertexArray; }
690 fBoundVertexArrayIDIsValid =
false;
691 fDefaultVertexArrayAttribState.invalidate();
692 if (fCoreProfileVertexArray) {
693 fCoreProfileVertexArray->invalidateCachedState();
697 void notifyVertexArrayDelete(
GrGLuint id) {
698 if (fBoundVertexArrayIDIsValid && fBoundVertexArrayID ==
id) {
700 fBoundVertexArrayID = 0;
709 if (!fBoundVertexArrayIDIsValid || arrayID != fBoundVertexArrayID) {
711 fBoundVertexArrayIDIsValid =
true;
712 fBoundVertexArrayID = arrayID;
730 bool fBoundVertexArrayIDIsValid;
739 } fHWVertexArrayState;
753 unsigned typeAsUInt =
static_cast<unsigned>(
type);
754 SkASSERT(typeAsUInt < std::size(fHWBufferState));
756 return &fHWBufferState[typeAsUInt];
765 void flush(
FlushType flushType = FlushType::kIfRequired);
767 void setNeedsFlush() { fNeedsGLFlush =
true; }
786 TriState fHWConservativeRasterEnabled;
788 TriState fHWWireframeEnabled;
792 TriState fHWStencilTestEnabled;
794 TriState fHWWriteToColor;
796 bool fHWBoundFramebufferIsMSAA;
797 TriState fHWSRGBFramebuffer;
799 class TextureUnitBindings {
801 TextureUnitBindings() =
default;
802 TextureUnitBindings(
const TextureUnitBindings&) =
delete;
803 TextureUnitBindings& operator=(
const TextureUnitBindings&) =
delete;
809 void invalidateAllTargets(
bool markUnmodified);
812 struct TargetBinding {
814 bool fHasBeenModified =
false;
816 TargetBinding fTargetBindings[3];
838 } fMipmapPrograms[4];
843 static int TextureSizeToMipmapProgramIdx(
int width,
int height) {
846 return (wide ? 0x2 : 0x0) | (tall ? 0x1 : 0x0);
853 class SamplerObjectCache;
854 std::unique_ptr<SamplerObjectCache> fSamplerObjectCache;
856 std::unique_ptr<GrGLOpsRenderPass> fCachedOpsRenderPass;
858 std::unique_ptr<GrStagingBufferManager> fStagingBufferManager;
865 bool fNeedsGLFlush =
false;
867 SkDEBUGCODE(
bool fIsExecutingCommandBuffer_DebugOnly =
false;)
869 friend class GrGLPathRendering;
#define GR_GL_TEXTURE_NONE
struct __GLsync * GrGLsync
#define GR_GL_CALL(IFACE, X)
static constexpr GrGLenum GrGLFormatToEnum(GrGLFormat format)
static const constexpr int kGrGpuBufferTypeCount
@ kTopLeft_GrSurfaceOrigin
void * GrGpuFinishedContext
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
#define INHERITED(method,...)
static constexpr bool SkToBool(const T &x)
const GrShaderCaps * shaderCaps() const
bool vertexArrayObjectSupport() const
Is there support for Vertex Array Objects?
GrGLStandard glStandard() const
void flushScissorRect(const SkIRect &scissor, int rtHeight, GrSurfaceOrigin)
bool onReadPixels(GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType dstColorType, void *, size_t rowBytes) override
bool onWritePixels(GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType srcColorType, const GrMipLevel[], int mipLevelCount, bool prepForTexSampling) override
const GrGLCaps & glCaps() const
void clear(const GrScissorState &, std::array< float, 4 > color, GrRenderTarget *, bool useMultisampleFBO, GrSurfaceOrigin)
GrBackendFormat getPreferredStencilFormat(const GrBackendFormat &format) override
void addFinishedProc(GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext) override
GrThreadSafePipelineBuilder * pipelineBuilder() override
void invalidateBoundRenderTarget()
skgpu::BlendEquation fEquation
void deleteSync(GrGLsync)
void bindVertexArray(GrGLuint id)
bool onUpdateCompressedBackendTexture(const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, const void *data, size_t length) override
void clearErrorsAndCheckForOOM()
GrOpsRenderPass * onGetOpsRenderPass(GrRenderTarget *, bool useMultisampleFBO, GrAttachment *, GrSurfaceOrigin, const SkIRect &, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies, GrXferBarrierFlags renderPassXferBarriers) override
void bindTexture(int unitIdx, GrSamplerState samplerState, const skgpu::Swizzle &, GrGLTexture *)
GrBackendTexture onCreateBackendTexture(SkISize dimensions, const GrBackendFormat &, GrRenderable, skgpu::Mipmapped, GrProtected, std::string_view label) override
void bindFramebuffer(GrGLenum fboTarget, GrGLuint fboid)
void deleteBackendTexture(const GrBackendTexture &) override
bool onTransferPixelsFrom(GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer >, size_t offset) override
bool onTransferPixelsTo(GrTexture *, SkIRect, GrColorType textureColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer >, size_t offset, size_t rowBytes) override
sk_sp< GrTexture > onWrapRenderableBackendTexture(const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable) override
sk_sp< GrAttachment > makeMSAAAttachment(SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless) override
void clearStencilClip(const GrScissorState &, bool insideStencilMask, GrRenderTarget *, bool useMultisampleFBO, GrSurfaceOrigin)
bool onCopySurface(GrSurface *dst, const SkIRect &dstRect, GrSurface *src, const SkIRect &srcRect, GrSamplerState::Filter) override
bool onRegenerateMipMapLevels(GrTexture *) override
sk_sp< GrAttachment > makeStencilAttachment(const GrBackendFormat &colorFormat, SkISize dimensions, int numStencilSamples) override
GrGpuResource::UniqueID fBoundBufferUniqueID
void notifyVertexArrayDelete(GrGLuint id)
GrGLProgram * currentProgram()
GrGLenum prepareToDraw(GrPrimitiveType primitiveType)
const GrGLInterface * glInterface() const
sk_sp< GrRenderTarget > onWrapBackendRenderTarget(const GrBackendRenderTarget &) override
void flushProgram(sk_sp< GrGLProgram >)
sk_sp< GrTexture > onCreateTexture(SkISize dimensions, const GrBackendFormat &, GrRenderable, int renderTargetSampleCnt, skgpu::Budgeted, GrProtected, int mipLevelCount, uint32_t levelClearMask, std::string_view label) override
bool onClearBackendTexture(const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, std::array< float, 4 > color) override
void didDrawTo(GrRenderTarget *)
void onResolveRenderTarget(GrRenderTarget *target, const SkIRect &resolveRect) override
GrStagingBufferManager * stagingBufferManager() override
GrGLenum bindBuffer(GrGpuBufferType type, const GrBuffer *)
sk_sp< GrTexture > onWrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType) override
void deleteFramebuffer(GrGLuint fboid)
skgpu::BlendCoeff fDstCoeff
void finishOutstandingGpuWork() override
void resolveRenderFBOs(GrGLRenderTarget *, const SkIRect &resolveRect, ResolveDirection, bool invalidateReadBufferAfterBlit=false)
void beginCommandBuffer(GrGLRenderTarget *, bool useMultisampleFBO, const SkIRect &bounds, GrSurfaceOrigin, const GrOpsRenderPass::LoadAndStoreInfo &colorLoadStore, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
void flushViewport(const SkIRect &viewport, int rtHeight, GrSurfaceOrigin)
void xferBarrier(GrRenderTarget *, GrXferBarrierType) override
bool flushGLState(GrRenderTarget *, bool useMultisampleFBO, const GrProgramInfo &)
void checkFinishProcs() override
void deleteFence(GrGLsync)
SkSL::GLSLGeneration glslGeneration() const
sk_sp< GrThreadSafePipelineBuilder > refPipelineBuilder() override
GrGLint fTexCoordXformUniform
void disconnect(DisconnectType) override
GrGLVersion glVersion() const
void drawSingleIntoMSAAFBO(GrGLRenderTarget *rt, const SkIRect &drawBounds)
void onResetContext(uint32_t resetBits) override
std::unique_ptr< GrSemaphore > makeSemaphore(bool isOwned) override
std::unique_ptr< GrSemaphore > wrapBackendSemaphore(const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership) override
void insertSemaphore(GrSemaphore *semaphore) override
void endCommandBuffer(GrGLRenderTarget *, bool useMultisampleFBO, const GrOpsRenderPass::LoadAndStoreInfo &colorLoadStore, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
bool onTransferFromBufferToBuffer(sk_sp< GrGpuBuffer > src, size_t srcOffset, sk_sp< GrGpuBuffer > dst, size_t dstOffset, size_t size) override
std::unique_ptr< GrSemaphore > prepareTextureForCrossContextUsage(GrTexture *) override
void waitSemaphore(GrSemaphore *semaphore) override
void onResetTextureBindings() override
GrGLenum getErrorAndCheckForOOM()
void submit(GrOpsRenderPass *renderPass) override
sk_sp< GrTexture > onCreateCompressedTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Budgeted, skgpu::Mipmapped, GrProtected, const void *data, size_t dataSize) override
const GrGLContextInfo & ctxInfo() const
skgpu::BlendCoeff fSrcCoeff
bool onSubmitToGpu(GrSyncCpu sync) override
GrGLAttribArrayState * bindInternalVertexArray(const GrBuffer *indexBuffer, int numAttribs, GrPrimitiveRestart primitiveRestart)
GrBackendTexture onCreateCompressedBackendTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, GrProtected) override
sk_sp< GrGpuBuffer > onCreateBuffer(size_t size, GrGpuBufferType, GrAccessPattern) override
void willExecute() override
sk_sp< GrTexture > onWrapCompressedBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable) override
static std::unique_ptr< GrGpu > Make(sk_sp< const GrGLInterface >, const GrContextOptions &, GrDirectContext *)
const GrGLContext & glContext() const
bool fBufferZeroKnownBound
bool precompileShader(const SkData &key, const SkData &data) override
const GrCaps * caps() const
GrDirectContext * getContext()
void handleDirtyContext()
const SkIRect & rect() const
void reset(T *ptr=nullptr)
uint32_t uint32_t * format
uint32_t Hash32(const void *data, size_t bytes, uint32_t seed)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set