46#define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(fSingleOwner)
65 int renderTargetSampleCnt,
70 std::string_view label) {
73 if (this->isAbandoned()) {
85 renderTargetSampleCnt,
91 bool hasPixels = texels[0].
fPixels;
92 auto scratch = this->getExactScratch(
dimensions,
96 renderTargetSampleCnt,
112 &tmpTexels, &tmpDatas);
121 renderTargetSampleCnt,
135 int renderTargetSampleCnt,
139 std::string_view label) {
144 renderTargetSampleCnt,
149 tex->resourcePriv().makeUnbudgeted();
160 int renderTargetSampleCnt,
165 std::string_view label) {
173 if (this->isAbandoned()) {
179 renderTargetSampleCnt,
189 renderTargetSampleCnt,
202 renderTargetSampleCnt,
217 std::string_view label) {
219 if (this->isAbandoned()) {
235 int renderTargetSampleCnt,
239 std::string_view label) {
241 if (this->isAbandoned()) {
246 mipmapped, textureType)) {
260 renderTargetSampleCnt,
273 renderTargetSampleCnt,
284 int renderTargetSampleCnt,
286 std::string_view label) {
289 if (this->isAbandoned()) {
300 renderTargetSampleCnt,
312 renderTargetSampleCnt,
323 renderTargetSampleCnt,
331 std::string_view label) {
339 resource->setLabel(std::move(label));
349 int renderTargetSampleCnt,
352 std::string_view label) {
359 renderTargetSampleCnt,
368 renderTargetSampleCnt, mipmapped, isProtected, &
key);
380 if (this->isAbandoned()) {
390 if (this->isAbandoned()) {
403 if (this->isAbandoned()) {
426 if (this->isAbandoned() || !
resource) {
434 return this->isAbandoned() ? nullptr
440 const void* staticData,
442 if (
auto buffer = this->findByUniqueKey<GrGpuBuffer>(
key)) {
455 buffer->resourcePriv().setUniqueKey(
key);
465 if (
auto buffer = this->findByUniqueKey<GrGpuBuffer>(uniqueKey)) {
481 buffer->resourcePriv().setUniqueKey(uniqueKey);
491 initializeBufferFn(std::move(vertexWriter),
size);
496 buffer->updateData(stagingBuffer, 0,
size,
false);
503 const uint16_t* pattern,
508 size_t bufferSize = patternSize * reps *
sizeof(uint16_t);
520 temp.
reset(reps * patternSize);
523 for (
int i = 0;
i < reps; ++
i) {
524 int baseIdx =
i * patternSize;
525 uint16_t baseVert = (uint16_t)(
i * vertCount);
526 for (
int j = 0; j < patternSize; ++j) {
527 data[baseIdx+j] = baseVert + pattern[j];
531 if (!
buffer->updateData(
data, 0, bufferSize,
false)) {
552 static const uint16_t kNonAAQuadIndexPattern[] = {
575 static const uint16_t kAAQuadIndexPattern[] = {
600 if (this->isAbandoned()) {
604 if (this->
caps()->buffersAreInitiallyZero()) {
614 static const size_t MIN_SIZE = 1 << 12;
615 static const size_t MIN_UNIFORM_SIZE = 1 << 7;
619 size_t floorPow2 = ceilPow2 >> 1;
620 size_t mid = floorPow2 + (floorPow2 >> 1);
621 allocSize = (allocSize <= mid) ? mid : ceilPow2;
629 if (this->
caps()->buffersAreInitiallyZero()) {
657 if (numSamples == 1 && useMSAASurface) {
678 if (this->
caps()->oversizedStencilSupport()) {
684 if (!stencilFormat.
isValid()) {
698 auto keyedStencil = this->findByUniqueKey<GrAttachment>(sbKey);
713 return stencil !=
nullptr;
725 if (this->isAbandoned()) {
748 auto msaaAttachment = this->findByUniqueKey<GrAttachment>(
key);
749 if (msaaAttachment) {
750 return msaaAttachment;
754 if (msaaAttachment) {
757 return msaaAttachment;
769 if (this->isAbandoned()) {
782 auto scratch = this->refScratchMSAAAttachment(
dimensions,
787 "MakeMSAAAttachment");
800 std::string_view label) {
825 resource->setLabel(std::move(label));
833 return this->isAbandoned() ? nullptr : fGpu->
makeSemaphore(isOwned);
850 bool rowBytesSupport,
854 std::unique_ptr<
char[]>*
data) {
862 if (actualRB < minRB) {
865 if (origColorType == allowedColorType && (actualRB == minRB || rowBytesSupport)) {
885 TempLevels* tempLevels,
886 TempLevelDatas* tempLevelDatas)
const {
887 SkASSERT(mipLevelCount && texels && texels[0].fPixels);
889 auto allowedColorType =
895 tempLevels->reset(mipLevelCount);
896 tempLevelDatas->reset(mipLevelCount);
897 auto size = baseSize;
898 for (
int i = 0;
i < mipLevelCount; ++
i) {
900 &(*tempLevels)[
i], &(*tempLevelDatas)[
i])) {
905 return allowedColorType;
912 int mipLevelCount)
const {
916 SkASSERT(mipLevelCount && texels && texels[0].fPixels);
920 auto tempColorType = this->prepareLevels(
texture->backendFormat(),
colorType, baseSize, texels,
921 mipLevelCount, &tmpTexels, &tmpDatas);
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
bool GrConvertPixels(const GrPixmap &dst, const GrCPixmap &src, bool flipY)
static const int kIndicesPerNonAAQuad
static int num_stencil_samples(const GrRenderTarget *rt, bool useMSAASurface, const GrCaps &caps)
static constexpr int kMaxNumAAQuads
static const int kVertsPerAAQuad
static constexpr int kMaxNumNonAAQuads
static const int kIndicesPerAAQuad
static bool prepare_level(const GrMipLevel &inLevel, SkISize dimensions, bool rowBytesSupport, GrColorType origColorType, GrColorType allowedColorType, GrMipLevel *outLevel, std::unique_ptr< char[]> *data)
static const int kVertsPerNonAAQuad
#define ASSERT_SINGLE_OWNER
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
@ kDynamic_GrAccessPattern
@ kStatic_GrAccessPattern
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static int SkNextPow2(int value)
static size_t GrNextSizePow2(size_t n)
static SkString resource(SkPDFResourceType type, int index)
sk_sp< T > sk_ref_sp(T *obj)
static void ComputeScratchKey(const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, UsageFlags requiredUsage, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected, GrMemoryless, skgpu::ScratchKey *key)
static void ComputeSharedAttachmentUniqueKey(const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, UsageFlags requiredUsage, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, GrMemoryless memoryless, skgpu::UniqueKey *key)
virtual SupportedWrite supportedWritePixelsColorType(GrColorType surfaceColorType, const GrBackendFormat &surfaceFormat, GrColorType srcColorType) const =0
bool validateSurfaceParams(const SkISize &, const GrBackendFormat &, GrRenderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped, GrTextureType) const
bool writePixelsRowBytesSupport() const
bool reuseScratchTextures() const
int internalMultisampleCount(const GrBackendFormat &format) const
static void ComputeScratchKeyForDynamicBuffer(size_t size, GrGpuBufferType, skgpu::ScratchKey *)
bool wasDestroyed() const
void incNumScratchTexturesReused()
void incNumScratchMSAAAttachmentsReused()
virtual std::unique_ptr< GrSemaphore > makeSemaphore(bool isOwned=true)=0
bool writePixels(GrSurface *surface, SkIRect rect, GrColorType surfaceColorType, GrColorType srcColorType, const GrMipLevel texels[], int mipLevelCount, bool prepForTexSampling=false)
const GrCaps * caps() const
virtual sk_sp< GrAttachment > makeStencilAttachment(const GrBackendFormat &colorFormat, SkISize dimensions, int numStencilSamples)=0
sk_sp< GrTexture > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType)
virtual sk_sp< GrAttachment > makeMSAAAttachment(SkISize dimensions, const GrBackendFormat &format, int numSamples, GrProtected isProtected, GrMemoryless isMemoryless)=0
sk_sp< GrGpuBuffer > createBuffer(size_t size, GrGpuBufferType intendedType, GrAccessPattern accessPattern)
virtual GrBackendFormat getPreferredStencilFormat(const GrBackendFormat &)=0
sk_sp< GrRenderTarget > wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo &, const GrVkDrawableInfo &)
sk_sp< GrRenderTarget > wrapBackendRenderTarget(const GrBackendRenderTarget &)
sk_sp< GrTexture > wrapCompressedBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable)
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, GrRenderable renderable, int renderTargetSampleCnt, skgpu::Budgeted budgeted, GrProtected isProtected, GrColorType textureColorType, GrColorType srcColorType, const GrMipLevel texels[], int texelLevelCount, std::string_view label)
virtual std::unique_ptr< GrSemaphore > wrapBackendSemaphore(const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership)=0
sk_sp< GrTexture > createCompressedTexture(SkISize dimensions, const GrBackendFormat &format, skgpu::Budgeted budgeted, skgpu::Mipmapped mipmapped, GrProtected isProtected, const void *data, size_t dataSize)
sk_sp< GrTexture > wrapRenderableBackendTexture(const GrBackendTexture &, int sampleCnt, GrWrapOwnership, GrWrapCacheable)
void attachStencilAttachment(sk_sp< GrAttachment > stencil, bool useMSAASurface)
GrAttachment * getStencilAttachment(bool useMSAASurface) const
virtual bool canAttemptStencilAttachment(bool useMSAASurface) const =0
GrGpuResource * findAndRefScratchResource(const skgpu::ScratchKey &scratchKey)
GrGpuResource * findAndRefUniqueResource(const skgpu::UniqueKey &key)
bool attachStencilAttachment(GrRenderTarget *rt, bool useMSAASurface)
static int NumIndicesPerNonAAQuad()
sk_sp< GrRenderTarget > wrapBackendRenderTarget(const GrBackendRenderTarget &)
static int MaxNumNonAAQuads()
sk_sp< GrAttachment > getDiscardableMSAAAttachment(SkISize dimensions, const GrBackendFormat &format, int sampleCnt, skgpu::Protected isProtected, GrMemoryless memoryless)
GrResourceProvider(GrGpu *, GrResourceCache *, skgpu::SingleOwner *)
sk_sp< GrTexture > createApproxTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Protected isProtected, std::string_view label)
void assignUniqueKeyToResource(const skgpu::UniqueKey &, GrGpuResource *)
std::unique_ptr< GrSemaphore > makeSemaphore(bool isOwned=true)
void(*)(skgpu::VertexWriter, size_t bufferSize) InitializeBufferFn
static int MaxNumAAQuads()
std::unique_ptr< GrSemaphore > wrapBackendSemaphore(const GrBackendSemaphore &, GrSemaphoreWrapType, GrWrapOwnership=kBorrow_GrWrapOwnership)
sk_sp< GrTexture > wrapBackendTexture(const GrBackendTexture &tex, GrWrapOwnership, GrWrapCacheable, GrIOType)
static int NumIndicesPerAAQuad()
sk_sp< GrGpuBuffer > createBuffer(size_t size, GrGpuBufferType, GrAccessPattern, ZeroInit)
sk_sp< GrTexture > findAndRefScratchTexture(const skgpu::ScratchKey &, std::string_view label)
static int NumVertsPerAAQuad()
static int NumVertsPerNonAAQuad()
sk_sp< GrTexture > createTexture(SkISize dimensions, const GrBackendFormat &format, GrTextureType textureType, skgpu::Renderable renderable, int renderTargetSampleCnt, skgpu::Mipmapped mipmapped, skgpu::Budgeted budgeted, skgpu::Protected isProtected, std::string_view label)
sk_sp< const GrGpuBuffer > findOrMakeStaticBuffer(GrGpuBufferType intendedType, size_t size, const skgpu::UniqueKey &key, InitializeBufferFn)
sk_sp< GrRenderTarget > wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo &, const GrVkDrawableInfo &)
sk_sp< GrTexture > createCompressedTexture(SkISize dimensions, const GrBackendFormat &, skgpu::Budgeted, skgpu::Mipmapped, skgpu::Protected, SkData *data, std::string_view label)
sk_sp< GrAttachment > makeMSAAAttachment(SkISize dimensions, const GrBackendFormat &format, int sampleCnt, skgpu::Protected isProtected, GrMemoryless isMemoryless)
sk_sp< GrTexture > wrapCompressedBackendTexture(const GrBackendTexture &tex, GrWrapOwnership, GrWrapCacheable)
sk_sp< GrTexture > wrapRenderableBackendTexture(const GrBackendTexture &tex, int sampleCnt, GrWrapOwnership, GrWrapCacheable)
const GrCaps * caps() const
virtual GrBackendFormat backendFormat() const =0
SkISize dimensions() const
static void ComputeScratchKey(const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, GrRenderable, int sampleCnt, skgpu::Mipmapped, GrProtected, skgpu::ScratchKey *key)
static int ComputeLevelCount(int baseWidth, int baseHeight)
void reset(size_t count=0)
T * reset(size_t count=0)
uint32_t uint32_t * format
static float max(float r, float g, float b)
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
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
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
SkISize GetApproxSize(SkISize size)
static constexpr SkIRect MakeSize(const SkISize &size)
SkISize dimensions() const
std::shared_ptr< const fml::Mapping > data