Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
GrGLGpu Class Referencefinal

#include <GrGLGpu.h>

Inheritance diagram for GrGLGpu:
GrGpu

Classes

class  SamplerObjectCache
 

Public Types

using ResolveDirection = GrGLRenderTarget::ResolveDirection
 
- Public Types inherited from GrGpu
enum class  DisconnectType { kAbandon , kCleanup }
 

Public Member Functions

 ~GrGLGpu () override
 
void disconnect (DisconnectType) override
 
GrThreadSafePipelineBuilderpipelineBuilder () override
 
sk_sp< GrThreadSafePipelineBuilderrefPipelineBuilder () override
 
const GrGLContextglContext () const
 
const GrGLInterfaceglInterface () const
 
const GrGLContextInfoctxInfo () const
 
GrGLStandard glStandard () const
 
GrGLVersion glVersion () const
 
SkSL::GLSLGeneration glslGeneration () const
 
const GrGLCapsglCaps () const
 
GrStagingBufferManagerstagingBufferManager () override
 
void bindTexture (int unitIdx, GrSamplerState samplerState, const skgpu::Swizzle &, GrGLTexture *)
 
void bindVertexArray (GrGLuint id)
 
void notifyVertexArrayDelete (GrGLuint id)
 
GrGLenum bindBuffer (GrGpuBufferType type, const GrBuffer *)
 
bool flushGLState (GrRenderTarget *, bool useMultisampleFBO, const GrProgramInfo &)
 
void flushScissorRect (const SkIRect &scissor, int rtHeight, GrSurfaceOrigin)
 
void flushViewport (const SkIRect &viewport, int rtHeight, GrSurfaceOrigin)
 
GrGLProgramcurrentProgram ()
 
GrGLAttribArrayStatebindInternalVertexArray (const GrBuffer *indexBuffer, int numAttribs, GrPrimitiveRestart primitiveRestart)
 
GrGLenum prepareToDraw (GrPrimitiveType primitiveType)
 
void resolveRenderFBOs (GrGLRenderTarget *, const SkIRect &resolveRect, ResolveDirection, bool invalidateReadBufferAfterBlit=false)
 
void drawSingleIntoMSAAFBO (GrGLRenderTarget *rt, const SkIRect &drawBounds)
 
void clear (const GrScissorState &, std::array< float, 4 > color, GrRenderTarget *, bool useMultisampleFBO, GrSurfaceOrigin)
 
void clearStencilClip (const GrScissorState &, bool insideStencilMask, GrRenderTarget *, bool useMultisampleFBO, GrSurfaceOrigin)
 
void beginCommandBuffer (GrGLRenderTarget *, bool useMultisampleFBO, const SkIRect &bounds, GrSurfaceOrigin, const GrOpsRenderPass::LoadAndStoreInfo &colorLoadStore, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
 
void endCommandBuffer (GrGLRenderTarget *, bool useMultisampleFBO, const GrOpsRenderPass::LoadAndStoreInfo &colorLoadStore, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
 
void invalidateBoundRenderTarget ()
 
sk_sp< GrAttachmentmakeStencilAttachment (const GrBackendFormat &colorFormat, SkISize dimensions, int numStencilSamples) override
 
sk_sp< GrAttachmentmakeMSAAAttachment (SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless) override
 
void deleteBackendTexture (const GrBackendTexture &) override
 
bool compile (const GrProgramDesc &, const GrProgramInfo &) override
 
bool precompileShader (const SkData &key, const SkData &data) override
 
void willExecute () override
 
void submit (GrOpsRenderPass *renderPass) override
 
GrGLsync insertFence ()
 
bool waitFence (GrGLsync)
 
void deleteFence (GrGLsync)
 
std::unique_ptr< GrSemaphoremakeSemaphore (bool isOwned) override
 
std::unique_ptr< GrSemaphorewrapBackendSemaphore (const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership) override
 
void insertSemaphore (GrSemaphore *semaphore) override
 
void waitSemaphore (GrSemaphore *semaphore) override
 
void checkFinishProcs () override
 
void finishOutstandingGpuWork () override
 
void clearErrorsAndCheckForOOM ()
 
GrGLenum getErrorAndCheckForOOM ()
 
std::unique_ptr< GrSemaphoreprepareTextureForCrossContextUsage (GrTexture *) override
 
void deleteSync (GrGLsync)
 
void bindFramebuffer (GrGLenum fboTarget, GrGLuint fboid)
 
void deleteFramebuffer (GrGLuint fboid)
 
void flushProgram (sk_sp< GrGLProgram >)
 
void flushProgram (GrGLuint)
 
void didDrawTo (GrRenderTarget *)
 
- Public Member Functions inherited from GrGpu
 GrGpu (GrDirectContext *direct)
 
virtual ~GrGpu ()
 
GrDirectContextgetContext ()
 
const GrDirectContextgetContext () const
 
const GrCapscaps () const
 
sk_sp< const GrCapsrefCaps () const
 
virtual GrStagingBufferManagerstagingBufferManager ()
 
virtual GrRingBufferuniformsRingBuffer ()
 
virtual void disconnect (DisconnectType)
 
virtual GrThreadSafePipelineBuilderpipelineBuilder ()=0
 
virtual sk_sp< GrThreadSafePipelineBuilderrefPipelineBuilder ()=0
 
virtual bool isDeviceLost () const
 
void markContextDirty (uint32_t state=kAll_GrBackendState)
 
sk_sp< GrTexturecreateTexture (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)
 
sk_sp< GrTexturecreateTexture (SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, GrRenderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped mipmapped, skgpu::Budgeted budgeted, GrProtected isProtected, std::string_view label)
 
sk_sp< GrTexturecreateCompressedTexture (SkISize dimensions, const GrBackendFormat &format, skgpu::Budgeted budgeted, skgpu::Mipmapped mipmapped, GrProtected isProtected, const void *data, size_t dataSize)
 
sk_sp< GrTexturewrapBackendTexture (const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType)
 
sk_sp< GrTexturewrapCompressedBackendTexture (const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable)
 
sk_sp< GrTexturewrapRenderableBackendTexture (const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable)
 
sk_sp< GrRenderTargetwrapBackendRenderTarget (const GrBackendRenderTarget &)
 
sk_sp< GrRenderTargetwrapVulkanSecondaryCBAsRenderTarget (const SkImageInfo &, const GrVkDrawableInfo &)
 
sk_sp< GrGpuBuffercreateBuffer (size_t size, GrGpuBufferType intendedType, GrAccessPattern accessPattern)
 
void resolveRenderTarget (GrRenderTarget *, const SkIRect &resolveRect)
 
bool regenerateMipMapLevels (GrTexture *)
 
void resetTextureBindings ()
 
bool readPixels (GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType dstColorType, void *buffer, size_t rowBytes)
 
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)
 
bool transferFromBufferToBuffer (sk_sp< GrGpuBuffer > src, size_t srcOffset, sk_sp< GrGpuBuffer > dst, size_t dstOffset, size_t size)
 
bool transferPixelsTo (GrTexture *texture, SkIRect rect, GrColorType textureColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer > transferBuffer, size_t offset, size_t rowBytes)
 
bool transferPixelsFrom (GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer > transferBuffer, size_t offset)
 
bool copySurface (GrSurface *dst, const SkIRect &dstRect, GrSurface *src, const SkIRect &srcRect, GrSamplerState::Filter filter)
 
GrOpsRenderPassgetOpsRenderPass (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)
 
void executeFlushInfo (SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess access, const GrFlushInfo &, const skgpu::MutableTextureState *newState)
 
virtual void willExecute ()
 
bool submitToGpu (GrSyncCpu sync)
 
virtual void submit (GrOpsRenderPass *)=0
 
virtual std::unique_ptr< GrSemaphoremakeSemaphore (bool isOwned=true)=0
 
virtual std::unique_ptr< GrSemaphorewrapBackendSemaphore (const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership)=0
 
virtual void insertSemaphore (GrSemaphore *semaphore)=0
 
virtual void waitSemaphore (GrSemaphore *semaphore)=0
 
virtual void addFinishedProc (GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)=0
 
virtual void checkFinishProcs ()=0
 
virtual void finishOutstandingGpuWork ()=0
 
virtual void takeOwnershipOfBuffer (sk_sp< GrGpuBuffer >)
 
bool checkAndResetOOMed ()
 
virtual std::unique_ptr< GrSemaphoreprepareTextureForCrossContextUsage (GrTexture *)=0
 
virtual void releaseUnlockedBackendObjects ()
 
Statsstats ()
 
void dumpJSON (SkJSONWriter *) const
 
GrBackendTexture createBackendTexture (SkISize dimensions, const GrBackendFormat &, GrRenderable, skgpu::Mipmapped, GrProtected, std::string_view label)
 
bool clearBackendTexture (const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, std::array< float, 4 > color)
 
GrBackendTexture createCompressedBackendTexture (SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, GrProtected)
 
bool updateCompressedBackendTexture (const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, const void *data, size_t length)
 
virtual bool setBackendTextureState (const GrBackendTexture &, const skgpu::MutableTextureState &, skgpu::MutableTextureState *previousState, sk_sp< skgpu::RefCntedCallback > finishedCallback)
 
virtual bool setBackendRenderTargetState (const GrBackendRenderTarget &, const skgpu::MutableTextureState &, skgpu::MutableTextureState *previousState, sk_sp< skgpu::RefCntedCallback > finishedCallback)
 
virtual void deleteBackendTexture (const GrBackendTexture &)=0
 
virtual bool compile (const GrProgramDesc &, const GrProgramInfo &)=0
 
virtual bool precompileShader (const SkData &key, const SkData &data)
 
virtual sk_sp< GrAttachmentmakeStencilAttachment (const GrBackendFormat &colorFormat, SkISize dimensions, int numStencilSamples)=0
 
virtual GrBackendFormat getPreferredStencilFormat (const GrBackendFormat &)=0
 
virtual sk_sp< GrAttachmentmakeMSAAAttachment (SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless isMemoryless)=0
 
void handleDirtyContext ()
 
virtual void storeVkPipelineCacheData ()
 
virtual void xferBarrier (GrRenderTarget *, GrXferBarrierType)=0
 

Static Public Member Functions

static std::unique_ptr< GrGpuMake (sk_sp< const GrGLInterface >, const GrContextOptions &, GrDirectContext *)
 

Additional Inherited Members

- Protected Member Functions inherited from GrGpu
void didWriteToSurface (GrSurface *surface, GrSurfaceOrigin origin, const SkIRect *bounds, uint32_t mipLevels=1) const
 
void setOOMed ()
 
void initCaps (sk_sp< const GrCaps > caps)
 
- Static Protected Member Functions inherited from GrGpu
static bool CompressedDataIsCorrect (SkISize dimensions, SkTextureCompressionType, skgpu::Mipmapped, const void *data, size_t length)
 
- Protected Attributes inherited from GrGpu
Stats fStats
 

Detailed Description

Definition at line 89 of file GrGLGpu.h.

Member Typedef Documentation

◆ ResolveDirection

Definition at line 166 of file GrGLGpu.h.

Constructor & Destructor Documentation

◆ ~GrGLGpu()

GrGLGpu::~GrGLGpu ( )
override

Definition at line 473 of file GrGLGpu.cpp.

473 {
474 // Ensure any GrGpuResource objects get deleted first, since they may require a working GrGLGpu
475 // to release the resources held by the objects themselves.
476 fCopyProgramArrayBuffer.reset();
477 fMipmapProgramArrayBuffer.reset();
478 if (fProgramCache) {
479 fProgramCache->reset();
480 }
481
482 fHWProgram.reset();
483 if (fHWProgramID) {
484 // detach the current program so there is no confusion on OpenGL's part
485 // that we want it to be deleted
486 GL_CALL(UseProgram(0));
487 }
488
489 if (fTempSrcFBOID) {
490 this->deleteFramebuffer(fTempSrcFBOID);
491 }
492 if (fTempDstFBOID) {
493 this->deleteFramebuffer(fTempDstFBOID);
494 }
495 if (fStencilClearFBOID) {
496 this->deleteFramebuffer(fStencilClearFBOID);
497 }
498
499 for (size_t i = 0; i < std::size(fCopyPrograms); ++i) {
500 if (0 != fCopyPrograms[i].fProgram) {
501 GL_CALL(DeleteProgram(fCopyPrograms[i].fProgram));
502 }
503 }
504
505 for (size_t i = 0; i < std::size(fMipmapPrograms); ++i) {
506 if (0 != fMipmapPrograms[i].fProgram) {
507 GL_CALL(DeleteProgram(fMipmapPrograms[i].fProgram));
508 }
509 }
510
511 fSamplerObjectCache.reset();
512
513 fFinishCallbacks.callAll(true);
514}
#define GL_CALL(X)
Definition: GrGLGpu.cpp:79
void callAll(bool doDelete)
GrGLuint fProgram
Definition: GrGLGpu.h:826
void deleteFramebuffer(GrGLuint fboid)
Definition: GrGLGpu.cpp:3203
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

Member Function Documentation

◆ beginCommandBuffer()

void GrGLGpu::beginCommandBuffer ( GrGLRenderTarget rt,
bool  useMultisampleFBO,
const SkIRect bounds,
GrSurfaceOrigin  origin,
const GrOpsRenderPass::LoadAndStoreInfo colorLoadStore,
const GrOpsRenderPass::StencilLoadAndStoreInfo stencilLoadStore 
)

Definition at line 2211 of file GrGLGpu.cpp.

2214 {
2215 SkASSERT(!fIsExecutingCommandBuffer_DebugOnly);
2216
2217 this->handleDirtyContext();
2218
2219 this->flushRenderTarget(rt, useMultisampleFBO);
2220 SkDEBUGCODE(fIsExecutingCommandBuffer_DebugOnly = true);
2221
2222 if (use_tiled_rendering(this->glCaps(), stencilLoadStore)) {
2223 auto nativeBounds = GrNativeRect::MakeRelativeTo(origin, rt->height(), bounds);
2224 GrGLbitfield preserveMask = (GrLoadOp::kLoad == colorLoadStore.fLoadOp)
2226 SkASSERT(GrLoadOp::kLoad != stencilLoadStore.fLoadOp); // Handled by use_tiled_rendering().
2227 GL_CALL(StartTiling(nativeBounds.fX, nativeBounds.fY, nativeBounds.fWidth,
2228 nativeBounds.fHeight, preserveMask));
2229 }
2230
2231 GrGLbitfield clearMask = 0;
2232 if (GrLoadOp::kClear == colorLoadStore.fLoadOp) {
2233 SkASSERT(!this->caps()->performColorClearsAsDraws());
2234 this->flushClearColor(colorLoadStore.fClearColor);
2235 this->flushColorWrite(true);
2236 clearMask |= GR_GL_COLOR_BUFFER_BIT;
2237 }
2238 if (GrLoadOp::kClear == stencilLoadStore.fLoadOp) {
2239 SkASSERT(!this->caps()->performStencilClearsAsDraws());
2240 GL_CALL(StencilMask(0xffffffff));
2241 GL_CALL(ClearStencil(0));
2242 clearMask |= GR_GL_STENCIL_BUFFER_BIT;
2243 }
2244 if (clearMask) {
2245 this->flushScissorTest(GrScissorTest::kDisabled);
2246 this->disableWindowRectangles();
2247 GL_CALL(Clear(clearMask));
2248 if (clearMask & GR_GL_COLOR_BUFFER_BIT) {
2249 this->didWriteToSurface(rt, origin, nullptr);
2250 }
2251 }
2252}
#define GR_GL_STENCIL_BUFFER_BIT
Definition: GrGLDefines.h:22
#define GR_GL_NONE
Definition: GrGLDefines.h:942
#define GR_GL_COLOR_BUFFER_BIT
Definition: GrGLDefines.h:23
#define GR_GL_COLOR_BUFFER_BIT0
Definition: GrGLDefines.h:1065
static bool use_tiled_rendering(const GrGLCaps &glCaps, const GrOpsRenderPass::StencilLoadAndStoreInfo &stencilLoadStore)
Definition: GrGLGpu.cpp:2203
unsigned int GrGLbitfield
Definition: GrGLTypes.h:104
#define SkASSERT(cond)
Definition: SkAssert.h:116
const GrGLCaps & glCaps() const
Definition: GrGLGpu.h:108
const GrCaps * caps() const
Definition: GrGpu.h:73
void didWriteToSurface(GrSurface *surface, GrSurfaceOrigin origin, const SkIRect *bounds, uint32_t mipLevels=1) const
Definition: GrGpu.cpp:665
void handleDirtyContext()
Definition: GrGpu.h:677
int height() const
Definition: GrSurface.h:37
Optional< SkRect > bounds
Definition: SkRecords.h:189
static GrNativeRect MakeRelativeTo(GrSurfaceOrigin origin, int rtHeight, SkIRect devRect)
Definition: GrNativeRect.h:25
std::array< float, 4 > fClearColor

◆ bindBuffer()

GrGLenum GrGLGpu::bindBuffer ( GrGpuBufferType  type,
const GrBuffer buffer 
)

Definition at line 2154 of file GrGLGpu.cpp.

2154 {
2155 this->handleDirtyContext();
2156
2157 // Index buffer state is tied to the vertex array.
2159 this->bindVertexArray(0);
2160 }
2161
2162 auto* bufferState = this->hwBufferState(type);
2163 if (buffer->isCpuBuffer()) {
2164 if (!bufferState->fBufferZeroKnownBound) {
2165 GL_CALL(BindBuffer(bufferState->fGLTarget, 0));
2166 bufferState->fBufferZeroKnownBound = true;
2167 bufferState->fBoundBufferUniqueID.makeInvalid();
2168 }
2169 } else if (static_cast<const GrGpuBuffer*>(buffer)->uniqueID() !=
2170 bufferState->fBoundBufferUniqueID) {
2171 const GrGLBuffer* glBuffer = static_cast<const GrGLBuffer*>(buffer);
2172 GL_CALL(BindBuffer(bufferState->fGLTarget, glBuffer->bufferID()));
2173 bufferState->fBufferZeroKnownBound = false;
2174 bufferState->fBoundBufferUniqueID = glBuffer->uniqueID();
2175 }
2176
2177 return bufferState->fGLTarget;
2178}
GLenum type
GrGLuint bufferID() const
Definition: GrGLBuffer.h:29
void bindVertexArray(GrGLuint id)
Definition: GrGLGpu.h:117
UniqueID uniqueID() const
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 defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ bindFramebuffer()

void GrGLGpu::bindFramebuffer ( GrGLenum  fboTarget,
GrGLuint  fboid 
)

Definition at line 3195 of file GrGLGpu.cpp.

3195 {
3196 GL_CALL(BindFramebuffer(target, fboid));
3198 fBoundDrawFramebuffer = fboid;
3199 }
3200 this->onFBOChanged();
3201}
#define GR_GL_DRAW_FRAMEBUFFER
Definition: GrGLDefines.h:901
#define GR_GL_FRAMEBUFFER
Definition: GrGLDefines.h:899
uint32_t * target

◆ bindInternalVertexArray()

GrGLAttribArrayState * GrGLGpu::bindInternalVertexArray ( const GrBuffer indexBuffer,
int  numAttribs,
GrPrimitiveRestart  primitiveRestart 
)
inline

Definition at line 156 of file GrGLGpu.h.

157 {
158 auto* attribState = fHWVertexArrayState.bindInternalVertexArray(this, indexBuffer);
159 attribState->enableVertexArrays(this, numAttribs, primitiveRestart);
160 return attribState;
161 }

◆ bindTexture()

void GrGLGpu::bindTexture ( int  unitIdx,
GrSamplerState  samplerState,
const skgpu::Swizzle swizzle,
GrGLTexture texture 
)

Definition at line 2826 of file GrGLGpu.cpp.

2827 {
2829
2830#ifdef SK_DEBUG
2831 if (!this->caps()->npotTextureTileSupport()) {
2832 if (samplerState.isRepeatedX()) {
2833 const int w = texture->width();
2835 }
2836 if (samplerState.isRepeatedY()) {
2837 const int h = texture->height();
2839 }
2840 }
2841#endif
2842
2843 GrGpuResource::UniqueID textureID = texture->uniqueID();
2844 GrGLenum target = texture->target();
2845 if (fHWTextureUnitBindings[unitIdx].boundID(target) != textureID) {
2846 this->setTextureUnit(unitIdx);
2847 GL_CALL(BindTexture(target, texture->textureID()));
2848 fHWTextureUnitBindings[unitIdx].setBoundID(target, textureID);
2849 }
2850
2851 if (samplerState.mipmapped() == skgpu::Mipmapped::kYes) {
2852 if (!this->caps()->mipmapSupport() || texture->mipmapped() == skgpu::Mipmapped::kNo) {
2853 // We should have caught this already.
2854 SkASSERT(!samplerState.isAniso());
2855 samplerState = GrSamplerState(samplerState.wrapModeX(),
2856 samplerState.wrapModeY(),
2857 samplerState.filter(),
2859 } else {
2860 SkASSERT(!texture->mipmapsAreDirty());
2861 }
2862 }
2863
2864 auto timestamp = texture->parameters()->resetTimestamp();
2865 bool setAll = timestamp < fResetTimestampForTextureParameters;
2866 const GrGLTextureParameters::SamplerOverriddenState* samplerStateToRecord = nullptr;
2868 if (this->glCaps().useSamplerObjects()) {
2869 fSamplerObjectCache->bindSampler(unitIdx, samplerState);
2870 if (this->glCaps().mustSetAnyTexParameterToEnableMipmapping()) {
2871 if (samplerState.mipmapped() == skgpu::Mipmapped::kYes) {
2872 GrGLenum minFilter = filter_to_gl_min_filter(samplerState.filter(),
2873 samplerState.mipmapMode());
2874 const GrGLTextureParameters::SamplerOverriddenState& oldSamplerState =
2875 texture->parameters()->samplerOverriddenState();
2876 this->setTextureUnit(unitIdx);
2877 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, minFilter));
2878 newSamplerState = oldSamplerState;
2879 newSamplerState.fMinFilter = minFilter;
2880 samplerStateToRecord = &newSamplerState;
2881 }
2882 }
2883 } else {
2884 if (fSamplerObjectCache) {
2885 fSamplerObjectCache->unbindSampler(unitIdx);
2886 }
2887 const GrGLTextureParameters::SamplerOverriddenState& oldSamplerState =
2888 texture->parameters()->samplerOverriddenState();
2889 samplerStateToRecord = &newSamplerState;
2890
2891 newSamplerState.fMinFilter = filter_to_gl_min_filter(samplerState.filter(),
2892 samplerState.mipmapMode());
2893 newSamplerState.fMagFilter = filter_to_gl_mag_filter(samplerState.filter());
2894
2895 newSamplerState.fWrapS = wrap_mode_to_gl_wrap(samplerState.wrapModeX(), this->glCaps());
2896 newSamplerState.fWrapT = wrap_mode_to_gl_wrap(samplerState.wrapModeY(), this->glCaps());
2897
2898 newSamplerState.fMaxAniso = std::min(static_cast<GrGLfloat>(samplerState.maxAniso()),
2899 this->glCaps().maxTextureMaxAnisotropy());
2900
2901 // These are the OpenGL default values.
2902 newSamplerState.fMinLOD = -1000.f;
2903 newSamplerState.fMaxLOD = 1000.f;
2904
2905 if (setAll || newSamplerState.fMagFilter != oldSamplerState.fMagFilter) {
2906 this->setTextureUnit(unitIdx);
2907 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAG_FILTER, newSamplerState.fMagFilter));
2908 }
2909 if (setAll || newSamplerState.fMinFilter != oldSamplerState.fMinFilter) {
2910 this->setTextureUnit(unitIdx);
2911 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, newSamplerState.fMinFilter));
2912 }
2913 if (this->glCaps().mipmapLodControlSupport()) {
2914 if (setAll || newSamplerState.fMinLOD != oldSamplerState.fMinLOD) {
2915 this->setTextureUnit(unitIdx);
2916 GL_CALL(TexParameterf(target, GR_GL_TEXTURE_MIN_LOD, newSamplerState.fMinLOD));
2917 }
2918 if (setAll || newSamplerState.fMaxLOD != oldSamplerState.fMaxLOD) {
2919 this->setTextureUnit(unitIdx);
2920 GL_CALL(TexParameterf(target, GR_GL_TEXTURE_MAX_LOD, newSamplerState.fMaxLOD));
2921 }
2922 }
2923 if (setAll || newSamplerState.fWrapS != oldSamplerState.fWrapS) {
2924 this->setTextureUnit(unitIdx);
2925 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_WRAP_S, newSamplerState.fWrapS));
2926 }
2927 if (setAll || newSamplerState.fWrapT != oldSamplerState.fWrapT) {
2928 this->setTextureUnit(unitIdx);
2929 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_WRAP_T, newSamplerState.fWrapT));
2930 }
2931 if (this->glCaps().clampToBorderSupport()) {
2932 // Make sure the border color is transparent black (the default)
2933 if (setAll || oldSamplerState.fBorderColorInvalid) {
2934 this->setTextureUnit(unitIdx);
2935 static const GrGLfloat kTransparentBlack[4] = {0.f, 0.f, 0.f, 0.f};
2936 GL_CALL(TexParameterfv(target, GR_GL_TEXTURE_BORDER_COLOR, kTransparentBlack));
2937 }
2938 }
2939 if (this->caps()->anisoSupport()) {
2940 if (setAll || oldSamplerState.fMaxAniso != newSamplerState.fMaxAniso) {
2941 GL_CALL(TexParameterf(target,
2943 newSamplerState.fMaxAniso));
2944 }
2945 }
2946 }
2947 GrGLTextureParameters::NonsamplerState newNonsamplerState;
2948 newNonsamplerState.fBaseMipMapLevel = 0;
2949 newNonsamplerState.fMaxMipmapLevel = texture->maxMipmapLevel();
2950 newNonsamplerState.fSwizzleIsRGBA = true;
2951
2952 const GrGLTextureParameters::NonsamplerState& oldNonsamplerState =
2953 texture->parameters()->nonsamplerState();
2954 if (this->glCaps().textureSwizzleSupport()) {
2955 if (setAll || !oldNonsamplerState.fSwizzleIsRGBA) {
2956 static constexpr GrGLenum kRGBA[4] {
2957 GR_GL_RED,
2959 GR_GL_BLUE,
2961 };
2962 this->setTextureUnit(unitIdx);
2963 if (GR_IS_GR_GL(this->glStandard())) {
2964 static_assert(sizeof(kRGBA[0]) == sizeof(GrGLint));
2966 reinterpret_cast<const GrGLint*>(kRGBA)));
2967 } else if (GR_IS_GR_GL_ES(this->glStandard())) {
2968 // ES3 added swizzle support but not GL_TEXTURE_SWIZZLE_RGBA.
2969 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SWIZZLE_R, kRGBA[0]));
2970 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SWIZZLE_G, kRGBA[1]));
2971 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SWIZZLE_B, kRGBA[2]));
2972 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_SWIZZLE_A, kRGBA[3]));
2973 }
2974 }
2975 }
2976 // These are not supported in ES2 contexts
2977 if (this->glCaps().mipmapLevelControlSupport() &&
2978 (texture->textureType() != GrTextureType::kExternal ||
2979 !this->glCaps().dontSetBaseOrMaxLevelForExternalTextures())) {
2980 if (newNonsamplerState.fBaseMipMapLevel != oldNonsamplerState.fBaseMipMapLevel) {
2981 this->setTextureUnit(unitIdx);
2983 newNonsamplerState.fBaseMipMapLevel));
2984 }
2985 if (newNonsamplerState.fMaxMipmapLevel != oldNonsamplerState.fMaxMipmapLevel) {
2986 this->setTextureUnit(unitIdx);
2987 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LEVEL,
2988 newNonsamplerState.fMaxMipmapLevel));
2989 }
2990 }
2991 texture->parameters()->set(samplerStateToRecord, newNonsamplerState,
2992 fResetTimestampForTextureParameters);
2993}
#define GR_GL_RED
Definition: GrGLDefines.h:430
#define GR_GL_TEXTURE_MAX_LOD
Definition: GrGLDefines.h:221
#define GR_GL_TEXTURE_BASE_LEVEL
Definition: GrGLDefines.h:222
#define GR_GL_TEXTURE_MAX_ANISOTROPY
Definition: GrGLDefines.h:634
#define GR_GL_TEXTURE_SWIZZLE_B
Definition: GrGLDefines.h:696
#define GR_GL_TEXTURE_WRAP_T
Definition: GrGLDefines.h:632
#define GR_GL_TEXTURE_MAG_FILTER
Definition: GrGLDefines.h:629
#define GR_GL_BLUE
Definition: GrGLDefines.h:433
#define GR_GL_GREEN
Definition: GrGLDefines.h:432
#define GR_GL_TEXTURE_SWIZZLE_RGBA
Definition: GrGLDefines.h:698
#define GR_GL_ALPHA
Definition: GrGLDefines.h:434
#define GR_GL_TEXTURE_SWIZZLE_A
Definition: GrGLDefines.h:697
#define GR_GL_TEXTURE_BORDER_COLOR
Definition: GrGLDefines.h:715
#define GR_GL_TEXTURE_WRAP_S
Definition: GrGLDefines.h:631
#define GR_GL_TEXTURE_MIN_LOD
Definition: GrGLDefines.h:220
#define GR_GL_TEXTURE_SWIZZLE_R
Definition: GrGLDefines.h:694
#define GR_GL_TEXTURE_MAX_LEVEL
Definition: GrGLDefines.h:223
#define GR_GL_TEXTURE_SWIZZLE_G
Definition: GrGLDefines.h:695
#define GR_GL_TEXTURE_MIN_FILTER
Definition: GrGLDefines.h:630
static GrGLenum wrap_mode_to_gl_wrap(GrSamplerState::WrapMode wrapMode, const GrCaps &caps)
Definition: GrGLGpu.cpp:240
static GrGLenum filter_to_gl_min_filter(GrSamplerState::Filter filter, GrSamplerState::MipmapMode mm)
Definition: GrGLGpu.cpp:219
static GrGLenum filter_to_gl_mag_filter(GrSamplerState::Filter filter)
Definition: GrGLGpu.cpp:211
float GrGLfloat
Definition: GrGLTypes.h:116
int GrGLint
Definition: GrGLTypes.h:108
unsigned int GrGLenum
Definition: GrGLTypes.h:102
#define GR_IS_GR_GL(standard)
Definition: GrGLTypes.h:48
#define GR_IS_GR_GL_ES(standard)
Definition: GrGLTypes.h:49
constexpr bool SkIsPow2(T value)
Definition: SkMath.h:51
GrGLStandard glStandard() const
Definition: GrGLGpu.h:105
constexpr skgpu::Mipmapped mipmapped() const
constexpr WrapMode wrapModeX() const
bool isAniso() const
constexpr Filter filter() const
constexpr bool isRepeatedX() const
constexpr MipmapMode mipmapMode() const
int maxAniso() const
constexpr bool isRepeatedY() const
constexpr WrapMode wrapModeY() const
@ kRGBA
Definition: embedder.h:607
static float min(float r, float g, float b)
Definition: hsl.cpp:48
FlTexture * texture
SkScalar w
SkScalar h

◆ bindVertexArray()

void GrGLGpu::bindVertexArray ( GrGLuint  id)
inline

Definition at line 117 of file GrGLGpu.h.

117 {
118 fHWVertexArrayState.setVertexArrayID(this, id);
119 }

◆ checkFinishProcs()

void GrGLGpu::checkFinishProcs ( )
overridevirtual

Implements GrGpu.

Definition at line 4386 of file GrGLGpu.cpp.

4386 {
4387 fFinishCallbacks.check();
4388}

◆ clear()

void GrGLGpu::clear ( const GrScissorState scissor,
std::array< float, 4 >  color,
GrRenderTarget target,
bool  useMultisampleFBO,
GrSurfaceOrigin  origin 
)

Definition at line 2180 of file GrGLGpu.cpp.

2184 {
2185 // parent class should never let us get here with no RT
2187 SkASSERT(!this->caps()->performColorClearsAsDraws());
2188 SkASSERT(!scissor.enabled() || !this->caps()->performPartialClearsAsDraws());
2189
2190 this->handleDirtyContext();
2191
2192 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
2193
2194 this->flushRenderTarget(glRT, useMultisampleFBO);
2195 this->flushScissor(scissor, glRT->height(), origin);
2196 this->disableWindowRectangles();
2197 this->flushColorWrite(true);
2198 this->flushClearColor(color);
2200 this->didWriteToSurface(glRT, origin, scissor.enabled() ? &scissor.rect() : nullptr);
2201}
bool enabled() const
const SkIRect & rect() const
DlColor color

◆ clearErrorsAndCheckForOOM()

void GrGLGpu::clearErrorsAndCheckForOOM ( )

Definition at line 4394 of file GrGLGpu.cpp.

4394 {
4395 while (this->getErrorAndCheckForOOM() != GR_GL_NO_ERROR) {}
4396}
#define GR_GL_NO_ERROR
Definition: GrGLDefines.h:175
GrGLenum getErrorAndCheckForOOM()
Definition: GrGLGpu.cpp:4398

◆ clearStencilClip()

void GrGLGpu::clearStencilClip ( const GrScissorState scissor,
bool  insideStencilMask,
GrRenderTarget target,
bool  useMultisampleFBO,
GrSurfaceOrigin  origin 
)

Definition at line 2302 of file GrGLGpu.cpp.

2304 {
2306 SkASSERT(!this->caps()->performStencilClearsAsDraws());
2307 SkASSERT(!scissor.enabled() || !this->caps()->performPartialClearsAsDraws());
2308 this->handleDirtyContext();
2309
2310 GrAttachment* sb = target->getStencilAttachment(useMultisampleFBO);
2311 if (!sb) {
2312 // We should only get here if we marked a proxy as requiring a SB. However,
2313 // the SB creation could later fail. Likely clipping is going to go awry now.
2314 return;
2315 }
2316
2317 GrGLint stencilBitCount = GrBackendFormatStencilBits(sb->backendFormat());
2318#if 0
2319 SkASSERT(stencilBitCount > 0);
2320 GrGLint clipStencilMask = (1 << (stencilBitCount - 1));
2321#else
2322 // we could just clear the clip bit but when we go through
2323 // ANGLE a partial stencil mask will cause clears to be
2324 // turned into draws. Our contract on OpsTask says that
2325 // changing the clip between stencil passes may or may not
2326 // zero the client's clip bits. So we just clear the whole thing.
2327 static const GrGLint clipStencilMask = ~0;
2328#endif
2329 GrGLint value;
2330 if (insideStencilMask) {
2331 value = (1 << (stencilBitCount - 1));
2332 } else {
2333 value = 0;
2334 }
2335 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
2336 this->flushRenderTarget(glRT, useMultisampleFBO);
2337
2338 this->flushScissor(scissor, glRT->height(), origin);
2339 this->disableWindowRectangles();
2340
2341 GL_CALL(StencilMask((uint32_t) clipStencilMask));
2342 GL_CALL(ClearStencil(value));
2344 fHWStencilSettings.invalidate();
2345}
int GrBackendFormatStencilBits(const GrBackendFormat &format)
virtual GrBackendFormat backendFormat() const =0
uint8_t value

◆ compile()

bool GrGLGpu::compile ( const GrProgramDesc ,
const GrProgramInfo  
)
overridevirtual

In this case we have a program descriptor and a program info but no render target.

Implements GrGpu.

Definition at line 4028 of file GrGLGpu.cpp.

4028 {
4030
4031 sk_sp<GrGLProgram> tmp = fProgramCache->findOrCreateProgram(this->getContext(),
4032 desc, programInfo, &stat);
4033 if (!tmp) {
4034 return false;
4035 }
4036
4038}
GrDirectContext * getContext()
Definition: GrGpu.h:67

◆ ctxInfo()

const GrGLContextInfo & GrGLGpu::ctxInfo ( ) const
inline

Definition at line 104 of file GrGLGpu.h.

104{ return *fGLContext; }

◆ currentProgram()

GrGLProgram * GrGLGpu::currentProgram ( )
inline

Definition at line 144 of file GrGLGpu.h.

144 {
145 this->handleDirtyContext();
146 return fHWProgram.get();
147 }
T * get() const
Definition: SkRefCnt.h:303

◆ deleteBackendTexture()

void GrGLGpu::deleteBackendTexture ( const GrBackendTexture )
overridevirtual

Frees a texture created by createBackendTexture(). If ownership of the backend texture has been transferred to a context using adopt semantics this should not be called.

Implements GrGpu.

Definition at line 4019 of file GrGLGpu.cpp.

4019 {
4020 SkASSERT(GrBackendApi::kOpenGL == tex.backend());
4021
4024 GL_CALL(DeleteTextures(1, &info.fID));
4025 }
4026}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SK_API bool GetGLTextureInfo(const GrBackendTexture &, GrGLTextureInfo *)

◆ deleteFence()

void GrGLGpu::deleteFence ( GrGLsync  fence)

Definition at line 4352 of file GrGLGpu.cpp.

4352 {
4353 if (this->glCaps().fenceSyncSupport()) {
4354 this->deleteSync(fence);
4355 }
4356}
void deleteSync(GrGLsync)
Definition: GrGLGpu.cpp:4411

◆ deleteFramebuffer()

void GrGLGpu::deleteFramebuffer ( GrGLuint  fboid)

Definition at line 3203 of file GrGLGpu.cpp.

3203 {
3204 // We're relying on the GL state shadowing being correct in the workaround code below so we
3205 // need to handle a dirty context.
3206 this->handleDirtyContext();
3207 if (fboid == fBoundDrawFramebuffer &&
3208 this->caps()->workarounds().unbind_attachments_on_bound_render_fbo_delete) {
3209 // This workaround only applies to deleting currently bound framebuffers
3210 // on Adreno 420. Because this is a somewhat rare case, instead of
3211 // tracking all the attachments of every framebuffer instead just always
3212 // unbind all attachments.
3213 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0,
3214 GR_GL_RENDERBUFFER, 0));
3215 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, GR_GL_STENCIL_ATTACHMENT,
3216 GR_GL_RENDERBUFFER, 0));
3217 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, GR_GL_DEPTH_ATTACHMENT,
3218 GR_GL_RENDERBUFFER, 0));
3219 }
3220
3221 GL_CALL(DeleteFramebuffers(1, &fboid));
3222
3223 // Deleting the currently bound framebuffer rebinds to 0.
3224 if (fboid == fBoundDrawFramebuffer) {
3225 this->onFBOChanged();
3226 }
3227}
#define GR_GL_RENDERBUFFER
Definition: GrGLDefines.h:903
#define GR_GL_STENCIL_ATTACHMENT
Definition: GrGLDefines.h:935
#define GR_GL_DEPTH_ATTACHMENT
Definition: GrGLDefines.h:934
#define GR_GL_COLOR_ATTACHMENT0
Definition: GrGLDefines.h:933

◆ deleteSync()

void GrGLGpu::deleteSync ( GrGLsync  sync)

Definition at line 4411 of file GrGLGpu.cpp.

4411 {
4412 if (this->glCaps().fenceType() == GrGLCaps::FenceType::kNVFence) {
4413 GrGLuint nvFence = SkToUInt(reinterpret_cast<intptr_t>(sync));
4414 GL_CALL(DeleteFences(1, &nvFence));
4415 } else {
4416 GL_CALL(DeleteSync(sync));
4417 }
4418}
unsigned int GrGLuint
Definition: GrGLTypes.h:113
constexpr unsigned SkToUInt(S x)
Definition: SkTo.h:30

◆ didDrawTo()

void GrGLGpu::didDrawTo ( GrRenderTarget rt)

Definition at line 2145 of file GrGLGpu.cpp.

2145 {
2146 SkASSERT(fHWWriteToColor != kUnknown_TriState);
2147 if (fHWWriteToColor == kYes_TriState) {
2148 // The bounds are only used to check for empty and we don't know the bounds. The origin
2149 // is irrelevant if there are no bounds.
2150 this->didWriteToSurface(rt, kTopLeft_GrSurfaceOrigin, /*bounds=*/nullptr);
2151 }
2152}
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148

◆ disconnect()

void GrGLGpu::disconnect ( DisconnectType  type)
overridevirtual

Reimplemented from GrGpu.

Definition at line 516 of file GrGLGpu.cpp.

516 {
519 if (fHWProgramID) {
520 GL_CALL(UseProgram(0));
521 }
522 if (fTempSrcFBOID) {
523 this->deleteFramebuffer(fTempSrcFBOID);
524 }
525 if (fTempDstFBOID) {
526 this->deleteFramebuffer(fTempDstFBOID);
527 }
528 if (fStencilClearFBOID) {
529 this->deleteFramebuffer(fStencilClearFBOID);
530 }
531 for (size_t i = 0; i < std::size(fCopyPrograms); ++i) {
532 if (fCopyPrograms[i].fProgram) {
533 GL_CALL(DeleteProgram(fCopyPrograms[i].fProgram));
534 }
535 }
536 for (size_t i = 0; i < std::size(fMipmapPrograms); ++i) {
537 if (fMipmapPrograms[i].fProgram) {
538 GL_CALL(DeleteProgram(fMipmapPrograms[i].fProgram));
539 }
540 }
541
542 if (fSamplerObjectCache) {
543 fSamplerObjectCache->release();
544 }
545 } else {
546 if (fProgramCache) {
547 fProgramCache->abandon();
548 }
549 if (fSamplerObjectCache) {
550 fSamplerObjectCache->abandon();
551 }
552 }
553
554 fHWProgram.reset();
555 fProgramCache->reset();
556 fProgramCache.reset();
557
558 fHWProgramID = 0;
559 fTempSrcFBOID = 0;
560 fTempDstFBOID = 0;
561 fStencilClearFBOID = 0;
562 fCopyProgramArrayBuffer.reset();
563 for (size_t i = 0; i < std::size(fCopyPrograms); ++i) {
564 fCopyPrograms[i].fProgram = 0;
565 }
566 fMipmapProgramArrayBuffer.reset();
567 for (size_t i = 0; i < std::size(fMipmapPrograms); ++i) {
568 fMipmapPrograms[i].fProgram = 0;
569 }
570
571 fFinishCallbacks.callAll(/* doDelete */ DisconnectType::kCleanup == type);
572}
virtual void disconnect(DisconnectType)
Definition: GrGpu.cpp:51

◆ drawSingleIntoMSAAFBO()

void GrGLGpu::drawSingleIntoMSAAFBO ( GrGLRenderTarget rt,
const SkIRect drawBounds 
)
inline

Definition at line 179 of file GrGLGpu.h.

179 {
180 this->copySurfaceAsDraw(rt, true/*drawToMultisampleFBO*/, rt, drawBounds, drawBounds,
182 }

◆ endCommandBuffer()

void GrGLGpu::endCommandBuffer ( GrGLRenderTarget rt,
bool  useMultisampleFBO,
const GrOpsRenderPass::LoadAndStoreInfo colorLoadStore,
const GrOpsRenderPass::StencilLoadAndStoreInfo stencilLoadStore 
)

Definition at line 2254 of file GrGLGpu.cpp.

2256 {
2257 SkASSERT(fIsExecutingCommandBuffer_DebugOnly);
2258
2259 this->handleDirtyContext();
2260
2261 if (rt->uniqueID() != fHWBoundRenderTargetUniqueID ||
2262 useMultisampleFBO != fHWBoundFramebufferIsMSAA) {
2263 // The framebuffer binding changed in the middle of a command buffer. We should have already
2264 // printed a warning during onFBOChanged.
2265 return;
2266 }
2267
2268 if (GrGLCaps::kNone_InvalidateFBType != this->glCaps().invalidateFBType()) {
2269 STArray<2, GrGLenum> discardAttachments;
2270 if (GrStoreOp::kDiscard == colorLoadStore.fStoreOp) {
2271 discardAttachments.push_back(
2272 rt->isFBO0(useMultisampleFBO) ? GR_GL_COLOR : GR_GL_COLOR_ATTACHMENT0);
2273 }
2274 if (GrStoreOp::kDiscard == stencilLoadStore.fStoreOp) {
2275 discardAttachments.push_back(
2276 rt->isFBO0(useMultisampleFBO) ? GR_GL_STENCIL : GR_GL_STENCIL_ATTACHMENT);
2277 }
2278
2279 if (!discardAttachments.empty()) {
2280 if (GrGLCaps::kInvalidate_InvalidateFBType == this->glCaps().invalidateFBType()) {
2281 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, discardAttachments.size(),
2282 discardAttachments.begin()));
2283 } else {
2284 SkASSERT(GrGLCaps::kDiscard_InvalidateFBType == this->glCaps().invalidateFBType());
2285 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, discardAttachments.size(),
2286 discardAttachments.begin()));
2287 }
2288 }
2289 }
2290
2291 if (use_tiled_rendering(this->glCaps(), stencilLoadStore)) {
2292 GrGLbitfield preserveMask = (GrStoreOp::kStore == colorLoadStore.fStoreOp)
2294 // Handled by use_tiled_rendering().
2295 SkASSERT(GrStoreOp::kStore != stencilLoadStore.fStoreOp);
2296 GL_CALL(EndTiling(preserveMask));
2297 }
2298
2299 SkDEBUGCODE(fIsExecutingCommandBuffer_DebugOnly = false);
2300}
#define GR_GL_STENCIL
Definition: GrGLDefines.h:940
#define GR_GL_COLOR
Definition: GrGLDefines.h:938
@ kNone_InvalidateFBType
Definition: GrGLCaps.h:95
@ kDiscard_InvalidateFBType
Definition: GrGLCaps.h:96
@ kInvalidate_InvalidateFBType
Definition: GrGLCaps.h:97
bool isFBO0(bool multisample) const
bool empty() const
Definition: SkTArray.h:199
int size() const
Definition: SkTArray.h:421

◆ finishOutstandingGpuWork()

void GrGLGpu::finishOutstandingGpuWork ( )
overridevirtual

Implements GrGpu.

Definition at line 4390 of file GrGLGpu.cpp.

4390 {
4391 GL_CALL(Finish());
4392}
static void Finish(Thread *thread)
Definition: bootstrap.cc:44

◆ flushGLState()

bool GrGLGpu::flushGLState ( GrRenderTarget renderTarget,
bool  useMultisampleFBO,
const GrProgramInfo programInfo 
)

Definition at line 2076 of file GrGLGpu.cpp.

2077 {
2078 this->handleDirtyContext();
2079
2080 sk_sp<GrGLProgram> program = fProgramCache->findOrCreateProgram(this->getContext(),
2081 programInfo);
2082 if (!program) {
2083 GrCapsDebugf(this->caps(), "Failed to create program!\n");
2084 return false;
2085 }
2086
2087 this->flushProgram(std::move(program));
2088
2089 // Swizzle the blend to match what the shader will output.
2090 this->flushBlendAndColorWrite(programInfo.pipeline().getXferProcessor().getBlendInfo(),
2091 programInfo.pipeline().writeSwizzle());
2092
2093 fHWProgram->updateUniforms(renderTarget, programInfo);
2094
2095 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget);
2096 GrStencilSettings stencil;
2097 if (programInfo.isStencilEnabled()) {
2098 SkASSERT(glRT->getStencilAttachment(useMultisampleFBO));
2099 stencil.reset(*programInfo.userStencilSettings(),
2100 programInfo.pipeline().hasStencilClip(),
2101 glRT->numStencilBits(useMultisampleFBO));
2102 }
2103 this->flushStencil(stencil, programInfo.origin());
2104 this->flushScissorTest(GrScissorTest(programInfo.pipeline().isScissorTestEnabled()));
2105 this->flushWindowRectangles(programInfo.pipeline().getWindowRectsState(),
2106 glRT, programInfo.origin());
2107 this->flushConservativeRasterState(programInfo.pipeline().usesConservativeRaster());
2108 this->flushWireframeState(programInfo.pipeline().isWireframe());
2109
2110 // This must come after textures are flushed because a texture may need
2111 // to be msaa-resolved (which will modify bound FBO state).
2112 this->flushRenderTarget(glRT, useMultisampleFBO);
2113
2114 return true;
2115}
#define GrCapsDebugf(caps,...)
Definition: GrTypesPriv.h:490
GrScissorTest
Definition: GrTypesPriv.h:115
void flushProgram(sk_sp< GrGLProgram >)
Definition: GrGLGpu.cpp:2117
void updateUniforms(const GrRenderTarget *, const GrProgramInfo &)
Definition: GrGLProgram.cpp:99
const skgpu::Swizzle & writeSwizzle() const
Definition: GrPipeline.h:197
bool hasStencilClip() const
Definition: GrPipeline.h:174
bool isScissorTestEnabled() const
Definition: GrPipeline.h:163
bool isWireframe() const
Definition: GrPipeline.h:170
bool usesConservativeRaster() const
Definition: GrPipeline.h:169
const GrWindowRectsState & getWindowRectsState() const
Definition: GrPipeline.h:167
const GrXferProcessor & getXferProcessor() const
Definition: GrPipeline.h:116
GrSurfaceOrigin origin() const
Definition: GrProgramInfo.h:38
const GrPipeline & pipeline() const
Definition: GrProgramInfo.h:39
const GrUserStencilSettings * userStencilSettings() const
Definition: GrProgramInfo.h:35
bool isStencilEnabled() const
Definition: GrProgramInfo.h:31
GrAttachment * getStencilAttachment(bool useMSAASurface) const
int numStencilBits(bool useMSAASurface) const
void reset(const GrUserStencilSettings &, bool hasStencilClip, int numStencilBits)
skgpu::BlendInfo getBlendInfo() const

◆ flushProgram() [1/2]

void GrGLGpu::flushProgram ( GrGLuint  id)

Definition at line 2134 of file GrGLGpu.cpp.

2134 {
2135 SkASSERT(id);
2136 if (fHWProgramID == id) {
2137 SkASSERT(!fHWProgram);
2138 return;
2139 }
2140 fHWProgram.reset();
2141 GL_CALL(UseProgram(id));
2142 fHWProgramID = id;
2143}
const uintptr_t id

◆ flushProgram() [2/2]

void GrGLGpu::flushProgram ( sk_sp< GrGLProgram program)

Definition at line 2117 of file GrGLGpu.cpp.

2117 {
2118 if (!program) {
2119 fHWProgram.reset();
2120 fHWProgramID = 0;
2121 return;
2122 }
2123 SkASSERT((program == fHWProgram) == (fHWProgramID == program->programID()));
2124 if (program == fHWProgram) {
2125 return;
2126 }
2127 auto id = program->programID();
2128 SkASSERT(id);
2129 GL_CALL(UseProgram(id));
2130 fHWProgram = std::move(program);
2131 fHWProgramID = id;
2132}
GrGLuint programID() const
Definition: GrGLProgram.h:78

◆ flushScissorRect()

void GrGLGpu::flushScissorRect ( const SkIRect scissor,
int  rtHeight,
GrSurfaceOrigin  rtOrigin 
)

Definition at line 2016 of file GrGLGpu.cpp.

2016 {
2017 SkASSERT(fHWScissorSettings.fEnabled == TriState::kYes_TriState);
2018 auto nativeScissor = GrNativeRect::MakeRelativeTo(rtOrigin, rtHeight, scissor);
2019 if (fHWScissorSettings.fRect != nativeScissor) {
2020 GL_CALL(Scissor(nativeScissor.fX, nativeScissor.fY, nativeScissor.fWidth,
2021 nativeScissor.fHeight));
2022 fHWScissorSettings.fRect = nativeScissor;
2023 }
2024}

◆ flushViewport()

void GrGLGpu::flushViewport ( const SkIRect viewport,
int  rtHeight,
GrSurfaceOrigin  rtOrigin 
)

Definition at line 2026 of file GrGLGpu.cpp.

2026 {
2027 auto nativeViewport = GrNativeRect::MakeRelativeTo(rtOrigin, rtHeight, viewport);
2028 if (fHWViewport != nativeViewport) {
2029 GL_CALL(Viewport(nativeViewport.fX, nativeViewport.fY,
2030 nativeViewport.fWidth, nativeViewport.fHeight));
2031 fHWViewport = nativeViewport;
2032 }
2033}

◆ getErrorAndCheckForOOM()

GrGLenum GrGLGpu::getErrorAndCheckForOOM ( )

Definition at line 4398 of file GrGLGpu.cpp.

4398 {
4399#if GR_GL_CHECK_ERROR
4400 if (this->glInterface()->checkAndResetOOMed()) {
4401 this->setOOMed();
4402 }
4403#endif
4404 GrGLenum error = this->fGLContext->glInterface()->fFunctions.fGetError();
4405 if (error == GR_GL_OUT_OF_MEMORY) {
4406 this->setOOMed();
4407 }
4408 return error;
4409}
#define GR_GL_OUT_OF_MEMORY
Definition: GrGLDefines.h:179
const GrGLInterface * glInterface() const
Definition: GrGLGpu.h:103
void setOOMed()
Definition: GrGpu.h:701
bool checkAndResetOOMed()
Definition: GrGpu.cpp:783
const uint8_t uint32_t uint32_t GError ** error

◆ glCaps()

const GrGLCaps & GrGLGpu::glCaps ( ) const
inline

Definition at line 108 of file GrGLGpu.h.

108{ return *fGLContext->caps(); }

◆ glContext()

const GrGLContext & GrGLGpu::glContext ( ) const
inline

Definition at line 101 of file GrGLGpu.h.

101{ return *fGLContext; }

◆ glInterface()

const GrGLInterface * GrGLGpu::glInterface ( ) const
inline

Definition at line 103 of file GrGLGpu.h.

103{ return fGLContext->glInterface(); }

◆ glslGeneration()

SkSL::GLSLGeneration GrGLGpu::glslGeneration ( ) const
inline

Definition at line 107 of file GrGLGpu.h.

107{ return fGLContext->glslGeneration(); }

◆ glStandard()

GrGLStandard GrGLGpu::glStandard ( ) const
inline

Definition at line 105 of file GrGLGpu.h.

105{ return fGLContext->standard(); }

◆ glVersion()

GrGLVersion GrGLGpu::glVersion ( ) const
inline

Definition at line 106 of file GrGLGpu.h.

106{ return fGLContext->version(); }

◆ insertFence()

GrGLsync GrGLGpu::insertFence ( )

Definition at line 4303 of file GrGLGpu.cpp.

4303 {
4304 if (!this->glCaps().fenceSyncSupport()) {
4305 return nullptr;
4306 }
4307 GrGLsync sync;
4308 if (this->glCaps().fenceType() == GrGLCaps::FenceType::kNVFence) {
4309 static_assert(sizeof(GrGLsync) >= sizeof(GrGLuint));
4310 GrGLuint fence = 0;
4311 GL_CALL(GenFences(1, &fence));
4312 GL_CALL(SetFence(fence, GR_GL_ALL_COMPLETED));
4313 sync = reinterpret_cast<GrGLsync>(static_cast<intptr_t>(fence));
4314 } else {
4315 GL_CALL_RET(sync, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
4316 }
4317 this->setNeedsFlush();
4318 return sync;
4319}
#define GR_GL_ALL_COMPLETED
Definition: GrGLDefines.h:1149
#define GR_GL_SYNC_GPU_COMMANDS_COMPLETE
Definition: GrGLDefines.h:1099
#define GL_CALL_RET(RET, X)
Definition: GrGLGpu.cpp:80
struct __GLsync * GrGLsync
Definition: GrGLTypes.h:129

◆ insertSemaphore()

void GrGLGpu::insertSemaphore ( GrSemaphore semaphore)
overridevirtual

Implements GrGpu.

Definition at line 4369 of file GrGLGpu.cpp.

4369 {
4370 SkASSERT(semaphore);
4371 GrGLSemaphore* glSem = static_cast<GrGLSemaphore*>(semaphore);
4372
4373 GrGLsync sync;
4374 GL_CALL_RET(sync, FenceSync(GR_GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
4375 glSem->setSync(sync);
4376 this->setNeedsFlush();
4377}
void setSync(const GrGLsync &sync)
Definition: GrGLSemaphore.h:29

◆ invalidateBoundRenderTarget()

void GrGLGpu::invalidateBoundRenderTarget ( )
inline

Definition at line 205 of file GrGLGpu.h.

205 {
206 fHWBoundRenderTargetUniqueID.makeInvalid();
207 }

◆ Make()

std::unique_ptr< GrGpu > GrGLGpu::Make ( sk_sp< const GrGLInterface interface,
const GrContextOptions options,
GrDirectContext direct 
)
static

Definition at line 408 of file GrGLGpu.cpp.

410 {
411#if !defined(SK_DISABLE_LEGACY_GL_MAKE_NATIVE_INTERFACE)
412 if (!interface) {
413 interface = GrGLMakeNativeInterface();
414 if (!interface) {
415 return nullptr;
416 }
417 }
418#else
419 if (!interface) {
420 return nullptr;
421 }
422#endif
423#ifdef USE_NSIGHT
424 const_cast<GrContextOptions&>(options).fSuppressPathRendering = true;
425#endif
426 auto glContext = GrGLContext::Make(std::move(interface), options);
427 if (!glContext) {
428 return nullptr;
429 }
430 return std::unique_ptr<GrGpu>(new GrGLGpu(std::move(glContext), direct));
431}
const char * options
SK_API sk_sp< const GrGLInterface > GrGLMakeNativeInterface()
static std::unique_ptr< GrGLContext > Make(sk_sp< const GrGLInterface >, const GrContextOptions &)
Definition: GrGLContext.cpp:19
const GrGLContext & glContext() const
Definition: GrGLGpu.h:101

◆ makeMSAAAttachment()

sk_sp< GrAttachment > GrGLGpu::makeMSAAAttachment ( SkISize  dimensions,
const GrBackendFormat format,
int  numSamples,
GrProtected  isProtected,
GrMemoryless  isMemoryless 
)
overridevirtual

Implements GrGpu.

Definition at line 1986 of file GrGLGpu.cpp.

1988 {
1989 SkASSERT(isMemoryless == GrMemoryless::kNo);
1991 this, dimensions, numSamples, GrBackendFormats::AsGLFormat(format));
1992}
static sk_sp< GrGLAttachment > MakeMSAA(GrGLGpu *gpu, SkISize dimensions, int sampleCnt, GrGLFormat format)
uint32_t uint32_t * format
SK_API GrGLFormat AsGLFormat(const GrBackendFormat &)

◆ makeSemaphore()

std::unique_ptr< GrSemaphore > GrGLGpu::makeSemaphore ( bool  isOwned)
overridevirtual

Implements GrGpu.

Definition at line 4358 of file GrGLGpu.cpp.

4358 {
4359 SkASSERT(this->caps()->semaphoreSupport());
4360 return GrGLSemaphore::Make(this, isOwned);
4361}
static std::unique_ptr< GrGLSemaphore > Make(GrGLGpu *gpu, bool isOwned)
Definition: GrGLSemaphore.h:22

◆ makeStencilAttachment()

sk_sp< GrAttachment > GrGLGpu::makeStencilAttachment ( const GrBackendFormat colorFormat,
SkISize  dimensions,
int  numStencilSamples 
)
overridevirtual

Implements GrGpu.

Definition at line 1971 of file GrGLGpu.cpp.

1972 {
1973 int sIdx = this->getCompatibleStencilIndex(GrBackendFormats::AsGLFormat(colorFormat));
1974 if (sIdx < 0) {
1975 return nullptr;
1976 }
1977 GrGLFormat sFmt = this->glCaps().stencilFormats()[sIdx];
1978
1979 auto stencil = GrGLAttachment::MakeStencil(this, dimensions, numStencilSamples, sFmt);
1980 if (stencil) {
1982 }
1983 return stencil;
1984}
GrGLFormat
Definition: GrGLTypes.h:59
static sk_sp< GrGLAttachment > MakeStencil(GrGLGpu *gpu, SkISize dimensions, int sampleCnt, GrGLFormat format)
const skia_private::TArray< GrGLFormat, true > & stencilFormats() const
Definition: GrGLCaps.h:223
void incStencilAttachmentCreates()
Definition: GrGpu.h:539
Stats fStats
Definition: GrGpu.h:703

◆ notifyVertexArrayDelete()

void GrGLGpu::notifyVertexArrayDelete ( GrGLuint  id)
inline

Definition at line 123 of file GrGLGpu.h.

123 {
124 fHWVertexArrayState.notifyVertexArrayDelete(id);
125 }

◆ pipelineBuilder()

GrThreadSafePipelineBuilder * GrGLGpu::pipelineBuilder ( )
overridevirtual

Implements GrGpu.

Definition at line 574 of file GrGLGpu.cpp.

574 {
575 return fProgramCache.get();
576}

◆ precompileShader()

bool GrGLGpu::precompileShader ( const SkData key,
const SkData data 
)
inlineoverridevirtual

Reimplemented from GrGpu.

Definition at line 222 of file GrGLGpu.h.

222 {
223 return fProgramCache->precompileShader(this->getContext(), key, data);
224 }
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ prepareTextureForCrossContextUsage()

std::unique_ptr< GrSemaphore > GrGLGpu::prepareTextureForCrossContextUsage ( GrTexture )
overridevirtual

Put this texture in a safe and known state for use across multiple contexts. Depending on the backend, this may return a GrSemaphore. If so, other contexts should wait on that semaphore before using this texture.

Implements GrGpu.

Definition at line 4420 of file GrGLGpu.cpp.

4420 {
4421 // Set up a semaphore to be signaled once the data is ready, and flush GL
4422 std::unique_ptr<GrSemaphore> semaphore = this->makeSemaphore(true);
4423 SkASSERT(semaphore);
4424 this->insertSemaphore(semaphore.get());
4425 // We must call flush here to make sure the GrGLsync object gets created and sent to the gpu.
4426 this->flush(FlushType::kForce);
4427
4428 return semaphore;
4429}
std::unique_ptr< GrSemaphore > makeSemaphore(bool isOwned) override
Definition: GrGLGpu.cpp:4358
void insertSemaphore(GrSemaphore *semaphore) override
Definition: GrGLGpu.cpp:4369

◆ prepareToDraw()

GrGLenum GrGLGpu::prepareToDraw ( GrPrimitiveType  primitiveType)

Definition at line 2527 of file GrGLGpu.cpp.

2527 {
2529
2530 if (this->glCaps().requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines() &&
2531 GrIsPrimTypeLines(primitiveType) && !GrIsPrimTypeLines(fLastPrimitiveType)) {
2532 GL_CALL(Enable(GR_GL_CULL_FACE));
2533 GL_CALL(Disable(GR_GL_CULL_FACE));
2534 }
2535 fLastPrimitiveType = primitiveType;
2536
2537 switch (primitiveType) {
2539 return GR_GL_TRIANGLES;
2541 return GR_GL_TRIANGLE_STRIP;
2543 return GR_GL_POINTS;
2545 return GR_GL_LINES;
2547 return GR_GL_LINE_STRIP;
2548 }
2549 SK_ABORT("invalid GrPrimitiveType");
2550}
#define GR_GL_TRIANGLE_STRIP
Definition: GrGLDefines.h:35
#define GR_GL_CULL_FACE
Definition: GrGLDefines.h:153
#define GR_GL_POINTS
Definition: GrGLDefines.h:30
#define GR_GL_LINES
Definition: GrGLDefines.h:31
#define GR_GL_TRIANGLES
Definition: GrGLDefines.h:34
#define GR_GL_LINE_STRIP
Definition: GrGLDefines.h:33
static constexpr bool GrIsPrimTypeLines(GrPrimitiveType type)
Definition: GrTypesPriv.h:52
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
void incNumDraws()
Definition: GrGpu.h:541

◆ refPipelineBuilder()

sk_sp< GrThreadSafePipelineBuilder > GrGLGpu::refPipelineBuilder ( )
overridevirtual

Implements GrGpu.

Definition at line 578 of file GrGLGpu.cpp.

578 {
579 return fProgramCache;
580}

◆ resolveRenderFBOs()

void GrGLGpu::resolveRenderFBOs ( GrGLRenderTarget rt,
const SkIRect resolveRect,
ResolveDirection  resolveDirection,
bool  invalidateReadBufferAfterBlit = false 
)

Definition at line 2562 of file GrGLGpu.cpp.

2564 {
2565 this->handleDirtyContext();
2566 rt->bindForResolve(resolveDirection);
2567
2568 const GrGLCaps& caps = this->glCaps();
2569
2570 // make sure we go through flushRenderTarget() since we've modified
2571 // the bound DRAW FBO ID.
2572 fHWBoundRenderTargetUniqueID.makeInvalid();
2573 if (GrGLCaps::kES_Apple_MSFBOType == caps.msFBOType()) {
2574 // The Apple extension doesn't support blitting from single to multisample.
2575 SkASSERT(resolveDirection != ResolveDirection::kSingleToMSAA);
2576 SkASSERT(resolveRect == SkIRect::MakeSize(rt->dimensions()));
2577 // Apple's extension uses the scissor as the blit bounds.
2578 // Passing in kTopLeft_GrSurfaceOrigin will make sure no transformation of the rect
2579 // happens inside flushScissor since resolveRect is already in native device coordinates.
2580 GrScissorState scissor(rt->dimensions());
2581 SkAssertResult(scissor.set(resolveRect));
2582 this->flushScissor(scissor, rt->height(), kTopLeft_GrSurfaceOrigin);
2583 this->disableWindowRectangles();
2584 GL_CALL(ResolveMultisampleFramebuffer());
2585 } else {
2586 SkASSERT(!caps.framebufferResolvesMustBeFullSize() ||
2587 resolveRect == SkIRect::MakeSize(rt->dimensions()));
2588 int l = resolveRect.x();
2589 int b = resolveRect.y();
2590 int r = resolveRect.x() + resolveRect.width();
2591 int t = resolveRect.y() + resolveRect.height();
2592
2593 // BlitFrameBuffer respects the scissor, so disable it.
2594 this->flushScissorTest(GrScissorTest::kDisabled);
2595 this->disableWindowRectangles();
2596 GL_CALL(BlitFramebuffer(l, b, r, t, l, b, r, t, GR_GL_COLOR_BUFFER_BIT, GR_GL_NEAREST));
2597 }
2598
2599 if (caps.invalidateFBType() != GrGLCaps::kNone_InvalidateFBType &&
2600 invalidateReadBufferAfterBlit) {
2601 // Invalidate the read FBO attachment after the blit, in hopes that this allows the driver
2602 // to perform tiling optimizations.
2603 bool readBufferIsMSAA = resolveDirection == ResolveDirection::kMSAAToSingle;
2604 GrGLenum colorDiscardAttachment = rt->isFBO0(readBufferIsMSAA) ? GR_GL_COLOR
2606 if (caps.invalidateFBType() == GrGLCaps::kInvalidate_InvalidateFBType) {
2607 GL_CALL(InvalidateFramebuffer(GR_GL_READ_FRAMEBUFFER, 1, &colorDiscardAttachment));
2608 } else {
2609 SkASSERT(caps.invalidateFBType() == GrGLCaps::kDiscard_InvalidateFBType);
2610 // glDiscardFramebuffer only accepts GL_FRAMEBUFFER.
2611 rt->bind(readBufferIsMSAA);
2612 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, 1, &colorDiscardAttachment));
2613 }
2614 }
2615}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define GR_GL_READ_FRAMEBUFFER
Definition: GrGLDefines.h:900
#define GR_GL_NEAREST
Definition: GrGLDefines.h:614
@ kES_Apple_MSFBOType
Definition: GrGLCaps.h:69
void bindForResolve(ResolveDirection)
void bind(bool useMultisampleFBO)
SkISize dimensions() const
Definition: GrSurface.h:27
static bool b
constexpr int32_t x() const
Definition: SkRect.h:141
constexpr int32_t y() const
Definition: SkRect.h:148
constexpr int32_t height() const
Definition: SkRect.h:165
static constexpr SkIRect MakeSize(const SkISize &size)
Definition: SkRect.h:66
constexpr int32_t width() const
Definition: SkRect.h:158

◆ stagingBufferManager()

GrStagingBufferManager * GrGLGpu::stagingBufferManager ( )
inlineoverridevirtual

Reimplemented from GrGpu.

Definition at line 110 of file GrGLGpu.h.

110{ return fStagingBufferManager.get(); }

◆ submit()

void GrGLGpu::submit ( GrOpsRenderPass renderPass)
overridevirtual

Implements GrGpu.

Definition at line 4297 of file GrGLGpu.cpp.

4297 {
4298 // The GrGLOpsRenderPass doesn't buffer ops so there is nothing to do here
4299 SkASSERT(fCachedOpsRenderPass.get() == renderPass);
4300 fCachedOpsRenderPass->reset();
4301}

◆ waitFence()

bool GrGLGpu::waitFence ( GrGLsync  fence)

Definition at line 4345 of file GrGLGpu.cpp.

4345 {
4346 if (!this->glCaps().fenceSyncSupport()) {
4347 return true;
4348 }
4349 return this->waitSync(fence, 0, false);
4350}

◆ waitSemaphore()

void GrGLGpu::waitSemaphore ( GrSemaphore semaphore)
overridevirtual

Implements GrGpu.

Definition at line 4379 of file GrGLGpu.cpp.

4379 {
4380 SkASSERT(semaphore);
4381 GrGLSemaphore* glSem = static_cast<GrGLSemaphore*>(semaphore);
4382
4383 GL_CALL(WaitSync(glSem->sync(), 0, GR_GL_TIMEOUT_IGNORED));
4384}
#define GR_GL_TIMEOUT_IGNORED
Definition: GrGLDefines.h:1105
GrGLsync sync() const
Definition: GrGLSemaphore.h:28

◆ willExecute()

void GrGLGpu::willExecute ( )
overridevirtual

Reimplemented from GrGpu.

Definition at line 4289 of file GrGLGpu.cpp.

4289 {
4290 // Because our transfers will be submitted to GL to perfom immediately (no command buffer to
4291 // submit), we must unmap any staging buffers.
4292 if (fStagingBufferManager) {
4293 fStagingBufferManager->detachBuffers();
4294 }
4295}

◆ wrapBackendSemaphore()

std::unique_ptr< GrSemaphore > GrGLGpu::wrapBackendSemaphore ( const GrBackendSemaphore ,
GrSemaphoreWrapType  ,
GrWrapOwnership   
)
overridevirtual

Implements GrGpu.

Definition at line 4363 of file GrGLGpu.cpp.

4365 {
4366 SK_ABORT("Unsupported");
4367}

Member Data Documentation

◆ fBoundBufferUniqueID

GrGpuResource::UniqueID GrGLGpu::fBoundBufferUniqueID

Definition at line 743 of file GrGLGpu.h.

◆ fBufferZeroKnownBound

bool GrGLGpu::fBufferZeroKnownBound

Definition at line 744 of file GrGLGpu.h.

◆ fConstColor

SkPMColor4f GrGLGpu::fConstColor

Definition at line 773 of file GrGLGpu.h.

◆ fConstColorValid

bool GrGLGpu::fConstColorValid

Definition at line 774 of file GrGLGpu.h.

◆ fDstCoeff

skgpu::BlendCoeff GrGLGpu::fDstCoeff

Definition at line 772 of file GrGLGpu.h.

◆ fEnabled

TriState GrGLGpu::fEnabled

Definition at line 631 of file GrGLGpu.h.

◆ fEquation

skgpu::BlendEquation GrGLGpu::fEquation

Definition at line 770 of file GrGLGpu.h.

◆ fGLTarget

GrGLenum GrGLGpu::fGLTarget

Definition at line 742 of file GrGLGpu.h.

◆ fPosXformUniform

GrGLint GrGLGpu::fPosXformUniform = 0

Definition at line 829 of file GrGLGpu.h.

◆ fProgram

GrGLuint GrGLGpu::fProgram = 0

Definition at line 826 of file GrGLGpu.h.

◆ fRect

GrNativeRect GrGLGpu::fRect

Definition at line 632 of file GrGLGpu.h.

◆ fSrcCoeff

skgpu::BlendCoeff GrGLGpu::fSrcCoeff

Definition at line 771 of file GrGLGpu.h.

◆ fTexCoordXformUniform

GrGLint GrGLGpu::fTexCoordXformUniform = 0

Definition at line 828 of file GrGLGpu.h.

◆ fTextureUniform

GrGLint GrGLGpu::fTextureUniform = 0

Definition at line 827 of file GrGLGpu.h.


The documentation for this class was generated from the following files: