27int GrMockGpu::NextInternalTextureID() {
28 static std::atomic<int> nextID{1};
31 id = nextID.fetch_add(1, std::memory_order_relaxed);
36int GrMockGpu::NextExternalTextureID() {
39 static std::atomic<int> nextID{-1};
40 return nextID.fetch_add(-1, std::memory_order_relaxed);
43int GrMockGpu::NextInternalRenderTargetID() {
46 static std::atomic<int> nextID{
SK_MaxS32};
47 return nextID.fetch_add(-1, std::memory_order_relaxed);
50int GrMockGpu::NextExternalRenderTargetID() {
53 static std::atomic<int> nextID{
SK_MinS32};
54 return nextID.fetch_add(1, std::memory_order_relaxed);
62 mockOptions = &kDefaultOptions;
64 return std::unique_ptr<GrGpu>(
new GrMockGpu(direct, *mockOptions, contextOptions));
80 for (
int i = 0; i < static_cast<GrMockOpsRenderPass*>(renderPass)->numDraws(); ++
i) {
106 int renderTargetSampleCnt,
110 uint32_t levelClearMask,
111 std::string_view label) {
129 renderTargetSampleCnt,
136 this, budgeted, dimensions, mipmapStatus, texInfo, label));
161 format.asMockCompressionType(),
162 NextInternalTextureID(),
166 this, budgeted, dimensions, mipmapStatus, texInfo,
167 "MockGpu_CreateCompressedTexture"));
190 "MockGpu_WrapBackendTexture"));
222 "MockGpu_WrapRenderableBackendTexture"));
235 "MockGpu_WrapBackendRenderTarget"));
243 "MockGpu_CreateBuffer"));
247 SkISize dimensions,
int numStencilSamples) {
253 "MockGpu_MakeStencilAttachment"));
261 std::string_view label) {
275 fOutstandingTestingOnlyTextureIDs.
add(
info.id());
295 fOutstandingTestingOnlyTextureIDs.
add(
info.id());
304 fOutstandingTestingOnlyTextureIDs.
remove(
info.id());
308#if defined(GR_TEST_UTILS)
309bool GrMockGpu::isTestingOnlyBackendTexture(
const GrBackendTexture& tex)
const {
317 return fOutstandingTestingOnlyTextureIDs.
contains(
info.id());
325 static constexpr int kStencilBits = 8;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr int32_t SK_MinS32
static constexpr int32_t SK_MaxS32
#define INHERITED(method,...)
bool getMockRenderTargetInfo(GrMockRenderTargetInfo *) const
SkISize dimensions() const
SkISize dimensions() const
bool getMockTextureInfo(GrMockTextureInfo *) const
GrBackendApi backend() const
void incStencilAttachmentCreates()
const GrCaps * caps() const
void initCaps(sk_sp< const GrCaps > caps)
sk_sp< GrThreadSafePipelineBuilder > refPipelineBuilder() override
static std::unique_ptr< GrGpu > Make(const GrMockOptions *, const GrContextOptions &, GrDirectContext *)
void submit(GrOpsRenderPass *renderPass) override
GrThreadSafePipelineBuilder * pipelineBuilder() override
bool contains(const T &item) const
void remove(const T &item)
uint32_t uint32_t * format
Optional< SkRect > bounds
bool fFailTextureAllocations
SkTextureCompressionType compressionType() const
GrColorType colorType() const
skgpu::Protected getProtected() const
constexpr int32_t width() const
constexpr int32_t height() const
std::shared_ptr< const fml::Mapping > data