Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
GrMockGpu Class Reference

#include <GrMockGpu.h>

Inheritance diagram for GrMockGpu:
GrGpu

Public Member Functions

 ~GrMockGpu () override
 
GrThreadSafePipelineBuilderpipelineBuilder () override
 
sk_sp< GrThreadSafePipelineBuilderrefPipelineBuilder () override
 
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
 
std::unique_ptr< GrSemaphoreprepareTextureForCrossContextUsage (GrTexture *) override
 
void submit (GrOpsRenderPass *renderPass) override
 
void checkFinishProcs () override
 
void finishOutstandingGpuWork () override
 
- 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 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 takeOwnershipOfBuffer (sk_sp< GrGpuBuffer >)
 
bool checkAndResetOOMed ()
 
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 bool precompileShader (const SkData &key, const SkData &data)
 
void handleDirtyContext ()
 
virtual void storeVkPipelineCacheData ()
 

Static Public Member Functions

static std::unique_ptr< GrGpuMake (const GrMockOptions *, const GrContextOptions &, GrDirectContext *)
 

Private Member Functions

void xferBarrier (GrRenderTarget *, GrXferBarrierType) override
 
sk_sp< GrTextureonCreateTexture (SkISize, const GrBackendFormat &, GrRenderable, int renderTargetSampleCnt, skgpu::Budgeted, GrProtected, int mipLevelCount, uint32_t levelClearMask, std::string_view label) override
 
sk_sp< GrTextureonCreateCompressedTexture (SkISize dimensions, const GrBackendFormat &, skgpu::Budgeted, skgpu::Mipmapped, GrProtected, const void *data, size_t dataSize) override
 
sk_sp< GrTextureonWrapBackendTexture (const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType) override
 
sk_sp< GrTextureonWrapCompressedBackendTexture (const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable) override
 
sk_sp< GrTextureonWrapRenderableBackendTexture (const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable) override
 
sk_sp< GrRenderTargetonWrapBackendRenderTarget (const GrBackendRenderTarget &) override
 
sk_sp< GrGpuBufferonCreateBuffer (size_t sizeInBytes, GrGpuBufferType, GrAccessPattern) override
 
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
 
bool onTransferFromBufferToBuffer (sk_sp< GrGpuBuffer > src, size_t srcOffset, sk_sp< GrGpuBuffer > dst, size_t dstOffset, size_t size) override
 
bool onTransferPixelsTo (GrTexture *, SkIRect, GrColorType surfaceColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer >, size_t offset, size_t rowBytes) override
 
bool onTransferPixelsFrom (GrSurface *, SkIRect, GrColorType surfaceColorType, GrColorType bufferColorType, sk_sp< GrGpuBuffer >, size_t offset) override
 
bool onCopySurface (GrSurface *dst, const SkIRect &dstRect, GrSurface *src, const SkIRect &srcRect, GrSamplerState::Filter) override
 
bool onRegenerateMipMapLevels (GrTexture *) override
 
void onResolveRenderTarget (GrRenderTarget *target, const SkIRect &) override
 
void addFinishedProc (GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext) override
 
GrOpsRenderPassonGetOpsRenderPass (GrRenderTarget *, bool useMSAASurface, GrAttachment *, GrSurfaceOrigin, const SkIRect &, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies, GrXferBarrierFlags renderPassXferBarriers) override
 
bool onSubmitToGpu (GrSyncCpu) override
 
sk_sp< GrAttachmentmakeStencilAttachment (const GrBackendFormat &, SkISize dimensions, int numStencilSamples) override
 
GrBackendFormat getPreferredStencilFormat (const GrBackendFormat &) override
 
sk_sp< GrAttachmentmakeMSAAAttachment (SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless isMemoryless) override
 
GrBackendTexture onCreateBackendTexture (SkISize dimensions, const GrBackendFormat &, GrRenderable, skgpu::Mipmapped, GrProtected, std::string_view label) override
 
bool onClearBackendTexture (const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, std::array< float, 4 > color) override
 
GrBackendTexture onCreateCompressedBackendTexture (SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, GrProtected) override
 
bool onUpdateCompressedBackendTexture (const GrBackendTexture &, sk_sp< skgpu::RefCntedCallback > finishedCallback, const void *, size_t) override
 
void deleteBackendTexture (const GrBackendTexture &) override
 
bool compile (const GrProgramDesc &, const GrProgramInfo &) override
 

Additional Inherited Members

- Public Types inherited from GrGpu
enum class  DisconnectType { kAbandon , kCleanup }
 
- 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 53 of file GrMockGpu.h.

Constructor & Destructor Documentation

◆ ~GrMockGpu()

GrMockGpu::~GrMockGpu ( )
override

Definition at line 92 of file GrMockGpu.cpp.

92{}

Member Function Documentation

◆ addFinishedProc()

void GrMockGpu::addFinishedProc ( GrGpuFinishedProc  finishedProc,
GrGpuFinishedContext  finishedContext 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 181 of file GrMockGpu.h.

182 {
183 SkASSERT(finishedProc);
184 finishedProc(finishedContext);
185 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ checkFinishProcs()

void GrMockGpu::checkFinishProcs ( )
inlineoverridevirtual

Implements GrGpu.

Definition at line 80 of file GrMockGpu.h.

80{}

◆ compile()

bool GrMockGpu::compile ( const GrProgramDesc ,
const GrProgramInfo  
)
inlineoverrideprivatevirtual

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

Implements GrGpu.

Definition at line 243 of file GrMockGpu.h.

243{ return false; }

◆ deleteBackendTexture()

void GrMockGpu::deleteBackendTexture ( const GrBackendTexture )
overrideprivatevirtual

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 298 of file GrMockGpu.cpp.

298 {
299 SkASSERT(GrBackendApi::kMock == tex.backend());
300
302 if (tex.getMockTextureInfo(&info)) {
303 fOutstandingTestingOnlyTextureIDs.remove(info.id());
304 }
305}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
void remove(const T &item)
Definition SkTHash.h:583

◆ finishOutstandingGpuWork()

void GrMockGpu::finishOutstandingGpuWork ( )
inlineoverridevirtual

Implements GrGpu.

Definition at line 81 of file GrMockGpu.h.

81{}

◆ getPreferredStencilFormat()

GrBackendFormat GrMockGpu::getPreferredStencilFormat ( const GrBackendFormat )
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 203 of file GrMockGpu.h.

203 {
205 true);
206 }
static GrBackendFormat MakeMock(GrColorType colorType, SkTextureCompressionType compression, bool isStencilFormat=false)

◆ insertSemaphore()

void GrMockGpu::insertSemaphore ( GrSemaphore semaphore)
inlineoverridevirtual

Implements GrGpu.

Definition at line 72 of file GrMockGpu.h.

72{}

◆ Make()

std::unique_ptr< GrGpu > GrMockGpu::Make ( const GrMockOptions mockOptions,
const GrContextOptions contextOptions,
GrDirectContext direct 
)
static

Definition at line 56 of file GrMockGpu.cpp.

58 {
59 static const GrMockOptions kDefaultOptions = GrMockOptions();
60 if (!mockOptions) {
61 mockOptions = &kDefaultOptions;
62 }
63 return std::unique_ptr<GrGpu>(new GrMockGpu(direct, *mockOptions, contextOptions));
64}

◆ makeMSAAAttachment()

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

Implements GrGpu.

Definition at line 208 of file GrMockGpu.h.

212 {
213 return nullptr;
214 }

◆ makeSemaphore()

std::unique_ptr< GrSemaphore > GrMockGpu::makeSemaphore ( bool  isOwned)
inlineoverridevirtual

Implements GrGpu.

Definition at line 64 of file GrMockGpu.h.

64 {
65 return nullptr;
66 }

◆ makeStencilAttachment()

sk_sp< GrAttachment > GrMockGpu::makeStencilAttachment ( const GrBackendFormat ,
SkISize  dimensions,
int  numStencilSamples 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 245 of file GrMockGpu.cpp.

246 {
249 dimensions,
251 numStencilSamples,
252 /*label=*/"MockGpu_MakeStencilAttachment"));
253}
void incStencilAttachmentCreates()
Definition GrGpu.h:539
Stats fStats
Definition GrGpu.h:703

◆ onClearBackendTexture()

bool GrMockGpu::onClearBackendTexture ( const GrBackendTexture ,
sk_sp< skgpu::RefCntedCallback finishedCallback,
std::array< float, 4 >  color 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 223 of file GrMockGpu.h.

225 {
226 return true;
227 }

◆ onCopySurface()

bool GrMockGpu::onCopySurface ( GrSurface dst,
const SkIRect dstRect,
GrSurface src,
const SkIRect srcRect,
GrSamplerState::Filter   
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 171 of file GrMockGpu.h.

173 {
174 return true;
175 }

◆ onCreateBackendTexture()

GrBackendTexture GrMockGpu::onCreateBackendTexture ( SkISize  dimensions,
const GrBackendFormat format,
GrRenderable  ,
skgpu::Mipmapped  mipmapped,
GrProtected  isProtected,
std::string_view  label 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 255 of file GrMockGpu.cpp.

260 {
261 SkTextureCompressionType compression = format.asMockCompressionType();
262 if (compression != SkTextureCompressionType::kNone) {
263 return {}; // should go through onCreateCompressedBackendTexture
264 }
265
266 auto colorType = format.asMockColorType();
267 if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
268 return GrBackendTexture(); // invalid
269 }
270
272 isProtected);
273
274 fOutstandingTestingOnlyTextureIDs.add(info.id());
275 return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info);
276}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
const GrCaps * caps() const
Definition GrGpu.h:73
void add(T item)
Definition SkTHash.h:573
uint32_t uint32_t * format
constexpr int32_t width() const
Definition SkSize.h:36
constexpr int32_t height() const
Definition SkSize.h:37

◆ onCreateBuffer()

sk_sp< GrGpuBuffer > GrMockGpu::onCreateBuffer ( size_t  sizeInBytes,
GrGpuBufferType  type,
GrAccessPattern  accessPattern 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 237 of file GrMockGpu.cpp.

239 {
240 return sk_sp<GrGpuBuffer>(
241 new GrMockBuffer(this, sizeInBytes, type, accessPattern,
242 /*label=*/"MockGpu_CreateBuffer"));
243}

◆ onCreateCompressedBackendTexture()

GrBackendTexture GrMockGpu::onCreateCompressedBackendTexture ( SkISize  dimensions,
const GrBackendFormat format,
skgpu::Mipmapped  mipmapped,
GrProtected  isProtected 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 278 of file GrMockGpu.cpp.

281 {
282 SkTextureCompressionType compression = format.asMockCompressionType();
283 if (compression == SkTextureCompressionType::kNone) {
284 return {}; // should go through onCreateBackendTexture
285 }
286
287 if (!this->caps()->isFormatTexturable(format, GrTextureType::k2D)) {
288 return {};
289 }
290
291 GrMockTextureInfo info(GrColorType::kUnknown, compression, NextExternalTextureID(),
292 isProtected);
293
294 fOutstandingTestingOnlyTextureIDs.add(info.id());
295 return GrBackendTexture(dimensions.width(), dimensions.height(), mipmapped, info);
296}

◆ onCreateCompressedTexture()

sk_sp< GrTexture > GrMockGpu::onCreateCompressedTexture ( SkISize  dimensions,
const GrBackendFormat format,
skgpu::Budgeted  budgeted,
skgpu::Mipmapped  mipmapped,
GrProtected  isProtected,
const void *  data,
size_t  dataSize 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 139 of file GrMockGpu.cpp.

145 {
146 if (fMockOptions.fFailTextureAllocations) {
147 return nullptr;
148 }
149
150#ifdef SK_DEBUG
151 // Uncompressed formats should go through onCreateTexture
152 SkTextureCompressionType compression = format.asMockCompressionType();
154#endif
155
156 GrMipmapStatus mipmapStatus = (mipmapped == skgpu::Mipmapped::kYes)
160 format.asMockCompressionType(),
161 NextInternalTextureID(),
162 isProtected);
163
165 this, budgeted, dimensions, mipmapStatus, texInfo,
166 /*label=*/"MockGpu_CreateCompressedTexture"));
167}
GrMipmapStatus
bool fFailTextureAllocations

◆ onCreateTexture()

sk_sp< GrTexture > GrMockGpu::onCreateTexture ( SkISize  dimensions,
const GrBackendFormat format,
GrRenderable  renderable,
int  renderTargetSampleCnt,
skgpu::Budgeted  budgeted,
GrProtected  isProtected,
int  mipLevelCount,
uint32_t  levelClearMask,
std::string_view  label 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 102 of file GrMockGpu.cpp.

110 {
111 if (fMockOptions.fFailTextureAllocations) {
112 return nullptr;
113 }
114
115 // Compressed formats should go through onCreateCompressedTexture
116 SkASSERT(format.asMockCompressionType() == SkTextureCompressionType::kNone);
117
118 GrColorType ct = format.asMockColorType();
120
121 GrMipmapStatus mipmapStatus =
123 GrMockTextureInfo texInfo(ct, SkTextureCompressionType::kNone, NextInternalTextureID(),
124 isProtected);
125 if (renderable == GrRenderable::kYes) {
126 GrMockRenderTargetInfo rtInfo(ct, NextInternalRenderTargetID(), isProtected);
127 return sk_sp<GrTexture>(new GrMockTextureRenderTarget(this, budgeted, dimensions,
128 renderTargetSampleCnt,
129 mipmapStatus,
130 texInfo,
131 rtInfo,
132 label));
133 }
135 this, budgeted, dimensions, mipmapStatus, texInfo, label));
136}
GrColorType

◆ onGetOpsRenderPass()

GrOpsRenderPass * GrMockGpu::onGetOpsRenderPass ( GrRenderTarget rt,
bool  useMSAASurface,
GrAttachment ,
GrSurfaceOrigin  origin,
const SkIRect bounds,
const GrOpsRenderPass::LoadAndStoreInfo colorInfo,
const GrOpsRenderPass::StencilLoadAndStoreInfo ,
const skia_private::TArray< GrSurfaceProxy *, true > &  sampledProxies,
GrXferBarrierFlags  renderPassXferBarriers 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 66 of file GrMockGpu.cpp.

74 {
75 return new GrMockOpsRenderPass(this, rt, origin, colorInfo);
76}

◆ onReadPixels()

bool GrMockGpu::onReadPixels ( GrSurface ,
SkIRect  ,
GrColorType  surfaceColorType,
GrColorType  dstColorType,
void *  ,
size_t  rowBytes 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 125 of file GrMockGpu.h.

130 {
131 return true;
132 }

◆ onRegenerateMipMapLevels()

bool GrMockGpu::onRegenerateMipMapLevels ( GrTexture )
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 177 of file GrMockGpu.h.

177{ return true; }

◆ onResolveRenderTarget()

void GrMockGpu::onResolveRenderTarget ( GrRenderTarget target,
const SkIRect  
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 179 of file GrMockGpu.h.

179{}

◆ onSubmitToGpu()

bool GrMockGpu::onSubmitToGpu ( GrSyncCpu  )
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 198 of file GrMockGpu.h.

198{ return true; }

◆ onTransferFromBufferToBuffer()

bool GrMockGpu::onTransferFromBufferToBuffer ( sk_sp< GrGpuBuffer src,
size_t  srcOffset,
sk_sp< GrGpuBuffer dst,
size_t  dstOffset,
size_t  size 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 144 of file GrMockGpu.h.

148 {
149 return true;
150 }

◆ onTransferPixelsFrom()

bool GrMockGpu::onTransferPixelsFrom ( GrSurface ,
SkIRect  ,
GrColorType  surfaceColorType,
GrColorType  bufferColorType,
sk_sp< GrGpuBuffer ,
size_t  offset 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 162 of file GrMockGpu.h.

167 {
168 return true;
169 }

◆ onTransferPixelsTo()

bool GrMockGpu::onTransferPixelsTo ( GrTexture ,
SkIRect  ,
GrColorType  surfaceColorType,
GrColorType  bufferColorType,
sk_sp< GrGpuBuffer ,
size_t  offset,
size_t  rowBytes 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 152 of file GrMockGpu.h.

158 {
159 return true;
160 }

◆ onUpdateCompressedBackendTexture()

bool GrMockGpu::onUpdateCompressedBackendTexture ( const GrBackendTexture ,
sk_sp< skgpu::RefCntedCallback finishedCallback,
const void *  ,
size_t   
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 234 of file GrMockGpu.h.

237 {
238 return true;
239 }

◆ onWrapBackendRenderTarget()

sk_sp< GrRenderTarget > GrMockGpu::onWrapBackendRenderTarget ( const GrBackendRenderTarget rt)
overrideprivatevirtual

Implements GrGpu.

Definition at line 224 of file GrMockGpu.cpp.

224 {
227
229 new GrMockRenderTarget(this,
231 rt.dimensions(),
232 rt.sampleCnt(),
233 info,
234 /*label=*/"MockGpu_WrapBackendRenderTarget"));
235}
#define SkAssertResult(cond)
Definition SkAssert.h:123
bool getMockRenderTargetInfo(GrMockRenderTargetInfo *) const
SkISize dimensions() const

◆ onWrapBackendTexture()

sk_sp< GrTexture > GrMockGpu::onWrapBackendTexture ( const GrBackendTexture tex,
GrWrapOwnership  ownership,
GrWrapCacheable  wrapType,
GrIOType  ioType 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 169 of file GrMockGpu.cpp.

172 {
173 GrMockTextureInfo texInfo;
174 SkAssertResult(tex.getMockTextureInfo(&texInfo));
175
176 SkTextureCompressionType compression = texInfo.compressionType();
177 if (compression != SkTextureCompressionType::kNone) {
178 return nullptr;
179 }
180
183 return sk_sp<GrTexture>(new GrMockTexture(this,
184 tex.dimensions(),
185 mipmapStatus,
186 texInfo,
187 wrapType,
188 ioType,
189 /*label=*/"MockGpu_WrapBackendTexture"));
190}
SkISize dimensions() const
bool hasMipmaps() const
bool getMockTextureInfo(GrMockTextureInfo *) const
SkTextureCompressionType compressionType() const
Definition GrMockTypes.h:49

◆ onWrapCompressedBackendTexture()

sk_sp< GrTexture > GrMockGpu::onWrapCompressedBackendTexture ( const GrBackendTexture tex,
GrWrapOwnership  ownership,
GrWrapCacheable  wrapType 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 192 of file GrMockGpu.cpp.

194 {
195 return nullptr;
196}

◆ onWrapRenderableBackendTexture()

sk_sp< GrTexture > GrMockGpu::onWrapRenderableBackendTexture ( const GrBackendTexture tex,
int  sampleCnt,
GrWrapOwnership  ownership,
GrWrapCacheable  cacheable 
)
overrideprivatevirtual

Implements GrGpu.

Definition at line 198 of file GrMockGpu.cpp.

201 {
202 GrMockTextureInfo texInfo;
203 SkAssertResult(tex.getMockTextureInfo(&texInfo));
205
206 GrMipmapStatus mipmapStatus =
208
209 // The client gave us the texture ID but we supply the render target ID.
210 GrMockRenderTargetInfo rtInfo(texInfo.colorType(), NextInternalRenderTargetID(),
211 texInfo.getProtected());
212
213 return sk_sp<GrTexture>(
215 tex.dimensions(),
216 sampleCnt,
217 mipmapStatus,
218 texInfo,
219 rtInfo,
220 cacheable,
221 /*label=*/"MockGpu_WrapRenderableBackendTexture"));
222}
GrColorType colorType() const
Definition GrMockTypes.h:51
skgpu::Protected getProtected() const
Definition GrMockTypes.h:58

◆ onWritePixels()

bool GrMockGpu::onWritePixels ( GrSurface ,
SkIRect  ,
GrColorType  surfaceColorType,
GrColorType  srcColorType,
const GrMipLevel  [],
int  mipLevelCount,
bool  prepForTexSampling 
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 134 of file GrMockGpu.h.

140 {
141 return true;
142 }

◆ pipelineBuilder()

GrThreadSafePipelineBuilder * GrMockGpu::pipelineBuilder ( )
overridevirtual

Implements GrGpu.

Definition at line 94 of file GrMockGpu.cpp.

94 {
95 return nullptr;
96}

◆ prepareTextureForCrossContextUsage()

std::unique_ptr< GrSemaphore > GrMockGpu::prepareTextureForCrossContextUsage ( GrTexture )
inlineoverridevirtual

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 74 of file GrMockGpu.h.

74 {
75 return nullptr;
76 }

◆ refPipelineBuilder()

sk_sp< GrThreadSafePipelineBuilder > GrMockGpu::refPipelineBuilder ( )
overridevirtual

Implements GrGpu.

Definition at line 98 of file GrMockGpu.cpp.

98 {
99 return nullptr;
100}

◆ submit()

void GrMockGpu::submit ( GrOpsRenderPass renderPass)
overridevirtual

Implements GrGpu.

Definition at line 78 of file GrMockGpu.cpp.

78 {
79 for (int i = 0; i < static_cast<GrMockOpsRenderPass*>(renderPass)->numDraws(); ++i) {
81 }
82 delete renderPass;
83}
void incNumDraws()
Definition GrGpu.h:541

◆ waitSemaphore()

void GrMockGpu::waitSemaphore ( GrSemaphore semaphore)
inlineoverridevirtual

Implements GrGpu.

Definition at line 73 of file GrMockGpu.h.

73{}

◆ wrapBackendSemaphore()

std::unique_ptr< GrSemaphore > GrMockGpu::wrapBackendSemaphore ( const GrBackendSemaphore ,
GrSemaphoreWrapType  ,
GrWrapOwnership   
)
inlineoverridevirtual

Implements GrGpu.

Definition at line 67 of file GrMockGpu.h.

69 {
70 return nullptr;
71 }

◆ xferBarrier()

void GrMockGpu::xferBarrier ( GrRenderTarget ,
GrXferBarrierType   
)
inlineoverrideprivatevirtual

Implements GrGpu.

Definition at line 86 of file GrMockGpu.h.

86{}

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