Flutter Engine
The Flutter Engine
GrTypesPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrTypesPriv_DEFINED
9#define GrTypesPriv_DEFINED
10
13#include "include/core/SkData.h"
14#include "include/core/SkPath.h"
17#include "include/gpu/GrTypes.h"
22
23#include <cstddef>
24#include <cstdint>
25#include <functional>
26#include <type_traits>
27
28class GrSurfaceProxy;
29
30namespace skgpu {
31enum class Mipmapped : bool;
32}
33
34/**
35 * divide, rounding up
36 */
37
38static inline constexpr size_t GrSizeDivRoundUp(size_t x, size_t y) { return (x + (y - 1)) / y; }
39
40/**
41 * Geometric primitives used for drawing.
42 */
43enum class GrPrimitiveType : uint8_t {
44 kTriangles,
45 kTriangleStrip,
46 kPoints,
47 kLines, // 1 pix wide only
48 kLineStrip, // 1 pix wide only
49};
51
52static constexpr bool GrIsPrimTypeLines(GrPrimitiveType type) {
54}
55
56enum class GrPrimitiveRestart : bool {
57 kNo = false,
58 kYes = true
59};
60
61/**
62 * Should a created surface be texturable?
63 */
64enum class GrTexturable : bool {
65 kNo = false,
66 kYes = true
67};
68
69// A DDL recorder has its own proxy provider and proxy cache. This enum indicates if
70// a given proxy provider is one of these special ones.
71enum class GrDDLProvider : bool {
72 kNo = false,
73 kYes = true
74};
75
76/** Ownership rules for external GPU resources imported into Skia. */
78 /** Skia will assume the client will keep the resource alive and Skia will not free it. */
80
81 /** Skia will assume ownership of the resource and free it. */
83};
84
85enum class GrWrapCacheable : bool {
86 /**
87 * The wrapped resource will be removed from the cache as soon as it becomes purgeable. It may
88 * still be assigned and found by a unique key, but the presence of the key will not be used to
89 * keep the resource alive when it has no references.
90 */
91 kNo = false,
92 /**
93 * The wrapped resource is allowed to remain in the GrResourceCache when it has no references
94 * but has a unique key. Such resources should only be given unique keys when it is known that
95 * the key will eventually be removed from the resource or invalidated via the message bus.
96 */
97 kYes = true
98};
99
100enum class GrBudgetedType : uint8_t {
101 /** The resource is budgeted and is subject to purging under budget pressure. */
102 kBudgeted,
103 /**
104 * The resource is unbudgeted and is purged as soon as it has no refs regardless of whether
105 * it has a unique or scratch key.
106 */
108 /**
109 * The resource is unbudgeted and is allowed to remain in the cache with no refs if it
110 * has a unique key. Scratch keys are ignored.
111 */
113};
114
115enum class GrScissorTest : bool {
116 kDisabled = false,
117 kEnabled = true
118};
119
120/*
121 * Used to say whether texture is backed by memory.
122 */
123enum class GrMemoryless : bool {
124 /**
125 * The texture will be allocated normally and will affect memory budgets.
126 */
127 kNo = false,
128 /**
129 * The texture will be not use GPU memory and will not affect memory budgets.
130 */
131 kYes = true
132};
133
135 const void* fPixels = nullptr;
136 size_t fRowBytes = 0;
137 // This may be used to keep fPixels from being freed while a GrMipLevel exists.
139
140 static_assert(::sk_is_trivially_relocatable<decltype(fPixels)>::value);
142
143 using sk_is_trivially_relocatable = std::true_type;
144};
145
148 kWillWait,
149};
150
151/**
152 * This enum is used to specify the load operation to be used when an OpsTask/GrOpsRenderPass
153 * begins execution.
154 */
155enum class GrLoadOp {
156 kLoad,
157 kClear,
158 kDiscard,
159};
160
161/**
162 * This enum is used to specify the store operation to be used when an OpsTask/GrOpsRenderPass
163 * ends execution.
164 */
165enum class GrStoreOp {
166 kStore,
167 kDiscard,
168};
169
170/**
171 * Used to control antialiasing in draw calls.
172 */
173enum class GrAA : bool {
174 kNo = false,
175 kYes = true
176};
177
178enum class GrFillRule : bool {
179 kNonzero,
181};
182
184 switch (fillType) {
191 }
193}
194
196 return GrFillRuleForPathFillType(path.getFillType());
197}
198
199/** This enum indicates the type of antialiasing to be performed. */
200enum class GrAAType : unsigned {
201 /** No antialiasing */
202 kNone,
203 /** Use fragment shader code to blend with a fractional pixel coverage. */
204 kCoverage,
205 /** Use normal MSAA. */
206 kMSAA,
207
208 kLast = kMSAA
209};
210static const int kGrAATypeCount = static_cast<int>(GrAAType::kLast) + 1;
211
212static constexpr bool GrAATypeIsHW(GrAAType type) {
213 switch (type) {
214 case GrAAType::kNone:
215 return false;
217 return false;
218 case GrAAType::kMSAA:
219 return true;
220 }
222}
223
224/**
225 * Some pixel configs are inherently clamped to [0,1], some are allowed to go outside that range,
226 * and some are FP but manually clamped in the XP.
227 */
228enum class GrClampType {
229 kAuto, // Normalized, fixed-point configs
230 kManual, // Clamped FP configs
231 kNone, // Normal (unclamped) FP configs
232};
233
234/**
235 * A number of rectangle/quadrilateral drawing APIs can control anti-aliasing on a per edge basis.
236 * These masks specify which edges are AA'ed. The intent for this is to support tiling with seamless
237 * boundaries, where the inner edges are non-AA and the outer edges are AA. Regular rectangle draws
238 * simply use kAll or kNone depending on if they want anti-aliasing or not.
239 *
240 * In APIs that support per-edge AA, GrQuadAAFlags is the only AA-control parameter that is
241 * provided (compared to the typical GrAA parameter). kNone is equivalent to GrAA::kNo, and any
242 * other set of edge flags would require GrAA::kYes (with rendering output dependent on how that
243 * maps to GrAAType for a given SurfaceDrawContext).
244 *
245 * These values are identical to SkCanvas::QuadAAFlags.
246 */
247enum class GrQuadAAFlags {
248 kLeft = 0b0001,
249 kTop = 0b0010,
250 kRight = 0b0100,
251 kBottom = 0b1000,
252
253 kNone = 0b0000,
254 kAll = 0b1111,
255};
256
258
259static inline GrQuadAAFlags SkToGrQuadAAFlags(unsigned flags) {
260 return static_cast<GrQuadAAFlags>(flags);
261}
262
263/**
264 * The type of texture. Backends other than GL currently only use the 2D value but the type must
265 * still be known at the API-neutral layer as it used to determine whether MIP maps, renderability,
266 * and sampling parameters are legal for proxies that will be instantiated with wrapped textures.
267 */
268enum class GrTextureType {
269 kNone,
270 k2D,
271 /* Rectangle uses unnormalized texture coordinates. */
273 kExternal
274};
275
279
283
290
291/** Rectangle and external textures only support the clamp wrap mode and do not support
292 * MIP maps.
293 */
295 switch (type) {
297 return false;
299 return true;
301 return true;
302 default:
303 SK_ABORT("Unexpected texture type");
304 }
305}
306
307//////////////////////////////////////////////////////////////////////////////
308
309/**
310 * Types used to describe format of vertices in arrays.
311 */
320
321 kInt2_GrVertexAttribType, // vector of 2 32-bit ints
322 kInt3_GrVertexAttribType, // vector of 3 32-bit ints
323 kInt4_GrVertexAttribType, // vector of 4 32-bit ints
324
325
327 kByte2_GrVertexAttribType, // vector of 2 8-bit signed bytes
328 kByte4_GrVertexAttribType, // vector of 4 8-bit signed bytes
330 kUByte2_GrVertexAttribType, // vector of 2 8-bit unsigned bytes
331 kUByte4_GrVertexAttribType, // vector of 4 8-bit unsigned bytes
332
333 kUByte_norm_GrVertexAttribType, // unsigned byte, e.g. coverage, 0 -> 0.0f, 255 -> 1.0f.
334 kUByte4_norm_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors, 0 -> 0.0f,
335 // 255 -> 1.0f.
336
337 kShort2_GrVertexAttribType, // vector of 2 16-bit shorts.
338 kShort4_GrVertexAttribType, // vector of 4 16-bit shorts.
339
340 kUShort2_GrVertexAttribType, // vector of 2 unsigned shorts. 0 -> 0, 65535 -> 65535.
341 kUShort2_norm_GrVertexAttribType, // vector of 2 unsigned shorts. 0 -> 0.0f, 65535 -> 1.0f.
342
345
347
348 kUShort4_norm_GrVertexAttribType, // vector of 4 unsigned shorts. 0 -> 0.0f, 65535 -> 1.0f.
349
353
354//////////////////////////////////////////////////////////////////////////////
355
356/**
357 * We have coverage effects that clip rendering to the edge of some geometric primitive.
358 * This enum specifies how that clipping is performed. Not all factories that take a
359 * GrClipEdgeType will succeed with all values and it is up to the caller to verify success.
360 */
361enum class GrClipEdgeType {
362 kFillBW,
363 kFillAA,
366
367 kLast = kInverseFillAA
368};
370
371static constexpr bool GrClipEdgeTypeIsFill(const GrClipEdgeType edgeType) {
372 return (GrClipEdgeType::kFillAA == edgeType || GrClipEdgeType::kFillBW == edgeType);
373}
374
375static constexpr bool GrClipEdgeTypeIsInverseFill(const GrClipEdgeType edgeType) {
376 return (GrClipEdgeType::kInverseFillAA == edgeType ||
378}
379
380static constexpr bool GrClipEdgeTypeIsAA(const GrClipEdgeType edgeType) {
381 return (GrClipEdgeType::kFillBW != edgeType &&
383}
384
386 switch (edgeType) {
395 }
397}
398
399/**
400 * Indicates the type of pending IO operations that can be recorded for gpu resources.
401 */
407
408/**
409 * Indicates the type of data that a GPU buffer will be used for.
410 */
411enum class GrGpuBufferType {
412 kVertex,
413 kIndex,
417 kUniform,
418};
419static const constexpr int kGrGpuBufferTypeCount = static_cast<int>(GrGpuBufferType::kUniform) + 1;
420
421/**
422 * Provides a performance hint regarding the frequency at which a data store will be accessed.
423 */
425 /** Data store will be respecified repeatedly and used many times. */
427 /** Data store will be specified once and used many times. (Thus disqualified from caching.) */
429 /** Data store will be specified once and used at most a few times. (Also can't be cached.) */
431
434
435// Flags shared between the GrSurface & GrSurfaceProxy class hierarchies
437 kNone = 0,
438
439 // Texture-level
440
441 // Means the pixels in the texture are read-only. Cannot also be a GrRenderTarget[Proxy].
442 kReadOnly = 1 << 0,
443
444 // RT-level
445
446 // This flag is for use with GL only. It tells us that the internal render target wraps FBO 0.
447 kGLRTFBOIDIs0 = 1 << 1,
448
449 // This means the render target is multisampled, and internally holds a non-msaa texture for
450 // resolving into. The render target resolves itself by blitting into this internal texture.
451 // (asTexture() might or might not return the internal texture, but if it does, we always
452 // resolve the render target before accessing this texture's data.)
454
455 // This means the pixels in the render target are write-only. This is used for Dawn and Metal
456 // swap chain targets which can be rendered to, but not read or copied.
457 kFramebufferOnly = 1 << 3,
458
459 // This is a Vulkan only flag. If set the surface can be used as an input attachment in a
460 // shader. This is used for doing in shader blending where we want to sample from the same
461 // image we are drawing to.
463};
464
466
467// 'GR_MAKE_BITFIELD_CLASS_OPS' defines the & operator on GrInternalSurfaceFlags to return bool.
468// We want to find the bitwise & with these masks, so we declare them as ints.
469constexpr static int kGrInternalTextureFlagsMask = static_cast<int>(
470 GrInternalSurfaceFlags::kReadOnly);
471
472// We don't include kVkRTSupportsInputAttachment in this mask since we check it manually. We don't
473// require that both the surface and proxy have matching values for this flag. Instead we require
474// if the proxy has it set then the surface must also have it set. All other flags listed here must
475// match on the proxy and surface.
476// TODO: Add back kFramebufferOnly flag here once we update GrSurfaceCharacterization to take it
477// as a flag. skbug.com/10672
478constexpr static int kGrInternalRenderTargetFlagsMask = static_cast<int>(
479 GrInternalSurfaceFlags::kGLRTFBOIDIs0 |
480 GrInternalSurfaceFlags::kRequiresManualMSAAResolve/* |
481 GrInternalSurfaceFlags::kFramebufferOnly*/);
482
485
486#ifdef SK_DEBUG
487// Takes a pointer to a GrCaps, and will suppress prints if required
488#define GrCapsDebugf(caps, ...) if (!(caps)->suppressPrints()) SkDebugf(__VA_ARGS__)
489#else
490#define GrCapsDebugf(caps, ...) do {} while (0)
491#endif
492
493/**
494 * Specifies if the holder owns the backend, OpenGL or Vulkan, object.
495 */
496enum class GrBackendObjectOwnership : bool {
497 /** Holder does not destroy the backend object. */
498 kBorrowed = false,
499 /** Holder destroys the backend object. */
500 kOwned = true
501};
502
503/**
504 * Used to include or exclude specific GPU path renderers for testing purposes.
505 */
507 kNone = 0, // Always use software masks and/or DefaultPathRenderer.
508 kDashLine = 1 << 0,
509 kAtlas = 1 << 1,
510 kTessellation = 1 << 2,
511 kCoverageCounting = 1 << 3,
512 kAAHairline = 1 << 4,
513 kAAConvex = 1 << 5,
514 kAALinearizing = 1 << 6,
515 kSmall = 1 << 7,
516 kTriangulating = 1 << 8,
517 kDefault = ((1 << 9) - 1) // All path renderers.
518};
519
520/**
521 * Used to describe the current state of Mips on a GrTexture
522 */
523enum class GrMipmapStatus {
524 kNotAllocated, // Mips have not been allocated
525 kDirty, // Mips are allocated but the full mip tree does not have valid data
526 kValid, // All levels fully allocated and have valid data in them
527};
528
530
531/**
532 * Like SkColorType this describes a layout of pixel data in CPU memory. It specifies the channels,
533 * their type, and width. This exists so that the GPU backend can have private types that have no
534 * analog in the public facing SkColorType enum and omit types not implemented in the GPU backend.
535 * It does not refer to a texture format and the mapping to texture formats may be many-to-many.
536 * It does not specify the sRGB encoding of the stored values. The components are listed in order of
537 * where they appear in memory. In other words the first component listed is in the low bits and
538 * the last component in the high bits.
539 */
540enum class GrColorType {
541 kUnknown,
542 kAlpha_8,
543 kBGR_565,
544 kRGB_565,
545 kABGR_4444, // This name differs from SkColorType. kARGB_4444_SkColorType is misnamed.
548 kRGB_888x,
549 kRG_88,
554 kGray_8,
557 kRGBA_F16,
559 kRGBA_F32,
560
561 kAlpha_16,
562 kRG_1616,
563 kRG_F16,
565
566 // Unusual types that come up after reading back in cases where we are reassigning the meaning
567 // of a texture format's channels to use for a particular color format but have to read back the
568 // data to a full RGBA quadruple. (e.g. using a R8 texture format as A8 color type but the API
569 // only supports reading to RGBA8.) None of these have SkColorType equivalents.
573 kR_8xxx,
574
575 // Types used to initialize backend textures.
576 kRGB_888,
577 kR_8,
578 kR_16,
579 kR_F16,
580 kGray_F16,
583
584 kLast = kARGB_4444
585};
586
587static const int kGrColorTypeCnt = static_cast<int>(GrColorType::kLast) + 1;
588
590 switch (ct) {
625 }
627}
628
630 switch (ct) {
657 }
659}
660
661static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct) {
662 switch (ct) {
663 case GrColorType::kUnknown: return 0;
697 }
699}
700
701/**
702 * Describes the encoding of channel data in a GrColorType.
703 */
705 kUnorm,
707 // kSnorm,
708 kFloat,
709 // kSint
710 // kUint
711};
712
713/**
714 * Describes a GrColorType by how many bits are used for each color component and how they are
715 * encoded. Currently all the non-zero channels share a single GrColorTypeEncoding. This could be
716 * expanded to store separate encodings and to indicate which bits belong to which components.
717 */
719public:
721 return {rgba, rgba, rgba, rgba, 0, e};
722 }
723
724 static constexpr GrColorFormatDesc MakeRGBA(int rgb, int a, GrColorTypeEncoding e) {
725 return {rgb, rgb, rgb, a, 0, e};
726 }
727
728 static constexpr GrColorFormatDesc MakeRGB(int rgb, GrColorTypeEncoding e) {
729 return {rgb, rgb, rgb, 0, 0, e};
730 }
731
732 static constexpr GrColorFormatDesc MakeRGB(int r, int g, int b, GrColorTypeEncoding e) {
733 return {r, g, b, 0, 0, e};
734 }
735
737 return {0, 0, 0, a, 0, e};
738 }
739
741 return {r, 0, 0, 0, 0, e};
742 }
743
744 static constexpr GrColorFormatDesc MakeRG(int rg, GrColorTypeEncoding e) {
745 return {rg, rg, 0, 0, 0, e};
746 }
747
748 static constexpr GrColorFormatDesc MakeGray(int grayBits, GrColorTypeEncoding e) {
749 return {0, 0, 0, 0, grayBits, e};
750 }
751
752 static constexpr GrColorFormatDesc MakeGrayAlpha(int grayAlpha, GrColorTypeEncoding e) {
753 return {0, 0, 0, 0, grayAlpha, e};
754 }
755
756 static constexpr GrColorFormatDesc MakeInvalid() { return {}; }
757
758 constexpr int r() const { return fRBits; }
759 constexpr int g() const { return fGBits; }
760 constexpr int b() const { return fBBits; }
761 constexpr int a() const { return fABits; }
762 constexpr int operator[](int c) const {
763 switch (c) {
764 case 0: return this->r();
765 case 1: return this->g();
766 case 2: return this->b();
767 case 3: return this->a();
768 }
770 }
771
772 constexpr int gray() const { return fGrayBits; }
773
774 constexpr GrColorTypeEncoding encoding() const { return fEncoding; }
775
776private:
777 int fRBits = 0;
778 int fGBits = 0;
779 int fBBits = 0;
780 int fABits = 0;
781 int fGrayBits = 0;
783
784 constexpr GrColorFormatDesc() = default;
785
786 constexpr GrColorFormatDesc(int r, int g, int b, int a, int gray, GrColorTypeEncoding encoding)
787 : fRBits(r), fGBits(g), fBBits(b), fABits(a), fGrayBits(gray), fEncoding(encoding) {
788 SkASSERT(r >= 0 && g >= 0 && b >= 0 && a >= 0 && gray >= 0);
789 SkASSERT(!gray || (!r && !g && !b));
790 SkASSERT(r || g || b || a || gray);
791 }
792};
793
795 switch (ct) {
864 }
866}
867
871 return GrClampType::kAuto;
872 }
874}
875
876// Consider a color type "wider" than n if it has more than n bits for any its representable
877// channels.
878static constexpr bool GrColorTypeIsWiderThan(GrColorType colorType, int n) {
879 SkASSERT(n > 0);
881 return (desc.r() && desc.r() > n )||
882 (desc.g() && desc.g() > n) ||
883 (desc.b() && desc.b() > n) ||
884 (desc.a() && desc.a() > n) ||
885 (desc.gray() && desc.gray() > n);
886}
887
888static constexpr bool GrColorTypeIsAlphaOnly(GrColorType ct) {
890}
891
892static constexpr bool GrColorTypeHasAlpha(GrColorType ct) {
894}
895
896static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct) {
897 switch (ct) {
898 case GrColorType::kUnknown: return 0;
899 case GrColorType::kAlpha_8: return 1;
900 case GrColorType::kBGR_565: return 2;
901 case GrColorType::kRGB_565: return 2;
902 case GrColorType::kABGR_4444: return 2;
903 case GrColorType::kRGBA_8888: return 4;
904 case GrColorType::kRGBA_8888_SRGB: return 4;
905 case GrColorType::kRGB_888x: return 4;
906 case GrColorType::kRG_88: return 2;
907 case GrColorType::kBGRA_8888: return 4;
908 case GrColorType::kRGBA_1010102: return 4;
909 case GrColorType::kBGRA_1010102: return 4;
910 case GrColorType::kRGBA_10x6: return 8;
911 case GrColorType::kGray_8: return 1;
912 case GrColorType::kGrayAlpha_88: return 2;
913 case GrColorType::kAlpha_F16: return 2;
914 case GrColorType::kRGBA_F16: return 8;
915 case GrColorType::kRGBA_F16_Clamped: return 8;
916 case GrColorType::kRGBA_F32: return 16;
917 case GrColorType::kAlpha_8xxx: return 4;
918 case GrColorType::kAlpha_F32xxx: return 16;
919 case GrColorType::kGray_8xxx: return 4;
920 case GrColorType::kR_8xxx: return 4;
921 case GrColorType::kAlpha_16: return 2;
922 case GrColorType::kRG_1616: return 4;
923 case GrColorType::kRGBA_16161616: return 8;
924 case GrColorType::kRG_F16: return 4;
925 case GrColorType::kRGB_888: return 3;
926 case GrColorType::kR_8: return 1;
927 case GrColorType::kR_16: return 2;
928 case GrColorType::kR_F16: return 2;
929 case GrColorType::kGray_F16: return 2;
930 case GrColorType::kARGB_4444: return 2;
931 case GrColorType::kBGRA_4444: return 2;
932 }
934}
935
937 kNone = 0,
939 kAsInputAttachment = 1 << 1,
940};
942
944
945#if defined(SK_DEBUG) || defined(GR_TEST_UTILS) || defined(SK_ENABLE_DUMP_GPU)
946static constexpr const char* GrBackendApiToStr(GrBackendApi api) {
947 switch (api) {
948 case GrBackendApi::kOpenGL: return "OpenGL";
949 case GrBackendApi::kVulkan: return "Vulkan";
950 case GrBackendApi::kMetal: return "Metal";
951 case GrBackendApi::kDirect3D: return "Direct3D";
952 case GrBackendApi::kMock: return "Mock";
953 case GrBackendApi::kUnsupported: return "Unsupported";
954 }
956}
957
958static constexpr const char* GrColorTypeToStr(GrColorType ct) {
959 switch (ct) {
960 case GrColorType::kUnknown: return "kUnknown";
961 case GrColorType::kAlpha_8: return "kAlpha_8";
962 case GrColorType::kBGR_565: return "kBGR_565";
963 case GrColorType::kRGB_565: return "kRGB_565";
964 case GrColorType::kABGR_4444: return "kABGR_4444";
965 case GrColorType::kRGBA_8888: return "kRGBA_8888";
966 case GrColorType::kRGBA_8888_SRGB: return "kRGBA_8888_SRGB";
967 case GrColorType::kRGB_888x: return "kRGB_888x";
968 case GrColorType::kRG_88: return "kRG_88";
969 case GrColorType::kBGRA_8888: return "kBGRA_8888";
970 case GrColorType::kRGBA_1010102: return "kRGBA_1010102";
971 case GrColorType::kBGRA_1010102: return "kBGRA_1010102";
972 case GrColorType::kRGBA_10x6: return "kBGRA_10x6";
973 case GrColorType::kGray_8: return "kGray_8";
974 case GrColorType::kGrayAlpha_88: return "kGrayAlpha_88";
975 case GrColorType::kAlpha_F16: return "kAlpha_F16";
976 case GrColorType::kRGBA_F16: return "kRGBA_F16";
977 case GrColorType::kRGBA_F16_Clamped: return "kRGBA_F16_Clamped";
978 case GrColorType::kRGBA_F32: return "kRGBA_F32";
979 case GrColorType::kAlpha_8xxx: return "kAlpha_8xxx";
980 case GrColorType::kAlpha_F32xxx: return "kAlpha_F32xxx";
981 case GrColorType::kGray_8xxx: return "kGray_8xxx";
982 case GrColorType::kR_8xxx: return "kR_8xxx";
983 case GrColorType::kAlpha_16: return "kAlpha_16";
984 case GrColorType::kRG_1616: return "kRG_1616";
985 case GrColorType::kRGBA_16161616: return "kRGBA_16161616";
986 case GrColorType::kRG_F16: return "kRG_F16";
987 case GrColorType::kRGB_888: return "kRGB_888";
988 case GrColorType::kR_8: return "kR_8";
989 case GrColorType::kR_16: return "kR_16";
990 case GrColorType::kR_F16: return "kR_F16";
991 case GrColorType::kGray_F16: return "kGray_F16";
992 case GrColorType::kARGB_4444: return "kARGB_4444";
993 case GrColorType::kBGRA_4444: return "kBGRA_4444";
994 }
996}
997
998static constexpr const char* GrSurfaceOriginToStr(GrSurfaceOrigin origin) {
999 switch (origin) {
1000 case kTopLeft_GrSurfaceOrigin: return "kTopLeft";
1001 case kBottomLeft_GrSurfaceOrigin: return "kBottomLeft";
1002 }
1004}
1005#endif
1006
1007#endif
GrWrapCacheable
Definition: GrTypesPriv.h:85
static constexpr int kGrInternalTextureFlagsMask
Definition: GrTypesPriv.h:469
GrPrimitiveRestart
Definition: GrTypesPriv.h:56
GrClampType
Definition: GrTypesPriv.h:228
GrQuadAAFlags
Definition: GrTypesPriv.h:247
static constexpr bool GrColorTypeIsWiderThan(GrColorType colorType, int n)
Definition: GrTypesPriv.h:878
static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct)
Definition: GrTypesPriv.h:661
static constexpr int kGrInternalTextureRenderTargetFlagsMask
Definition: GrTypesPriv.h:483
static constexpr GrColorFormatDesc GrGetColorTypeDesc(GrColorType ct)
Definition: GrTypesPriv.h:794
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
Definition: GrTypesPriv.h:896
GrDDLProvider
Definition: GrTypesPriv.h:71
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
Definition: GrTypesPriv.h:943
static GrQuadAAFlags SkToGrQuadAAFlags(unsigned flags)
Definition: GrTypesPriv.h:259
GrIOType
Definition: GrTypesPriv.h:402
@ kRead_GrIOType
Definition: GrTypesPriv.h:403
@ kRW_GrIOType
Definition: GrTypesPriv.h:405
@ kWrite_GrIOType
Definition: GrTypesPriv.h:404
static constexpr size_t GrSizeDivRoundUp(size_t x, size_t y)
Definition: GrTypesPriv.h:38
static constexpr int kGrInternalRenderTargetFlagsMask
Definition: GrTypesPriv.h:478
static const int kGrClipEdgeTypeCnt
Definition: GrTypesPriv.h:369
GrDstSampleFlags
Definition: GrTypesPriv.h:936
GrShaderFlags
Definition: GrTypesPriv.h:284
@ kVertex_GrShaderFlag
Definition: GrTypesPriv.h:286
@ kNone_GrShaderFlags
Definition: GrTypesPriv.h:285
@ kFragment_GrShaderFlag
Definition: GrTypesPriv.h:287
GrFillRule GrFillRuleForPathFillType(SkPathFillType fillType)
Definition: GrTypesPriv.h:183
GrMipmapStatus
Definition: GrTypesPriv.h:523
GrWrapOwnership
Definition: GrTypesPriv.h:77
@ kAdopt_GrWrapOwnership
Definition: GrTypesPriv.h:82
@ kBorrow_GrWrapOwnership
Definition: GrTypesPriv.h:79
GrGpuBufferType
Definition: GrTypesPriv.h:411
static const constexpr int kGrGpuBufferTypeCount
Definition: GrTypesPriv.h:419
static const int kGrColorTypeCnt
Definition: GrTypesPriv.h:587
GrPrimitiveType
Definition: GrTypesPriv.h:43
GrMemoryless
Definition: GrTypesPriv.h:123
GrTexturable
Definition: GrTypesPriv.h:64
static constexpr bool GrClipEdgeTypeIsInverseFill(const GrClipEdgeType edgeType)
Definition: GrTypesPriv.h:375
GrShaderType
Definition: GrTypesPriv.h:276
@ kLast_GrShaderType
Definition: GrTypesPriv.h:280
@ kFragment_GrShaderType
Definition: GrTypesPriv.h:278
@ kVertex_GrShaderType
Definition: GrTypesPriv.h:277
GrSemaphoreWrapType
Definition: GrTypesPriv.h:146
static constexpr bool GrAATypeIsHW(GrAAType type)
Definition: GrTypesPriv.h:212
GrClipEdgeType
Definition: GrTypesPriv.h:361
static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct)
Definition: GrTypesPriv.h:589
GrTextureType
Definition: GrTypesPriv.h:268
GrColorTypeEncoding
Definition: GrTypesPriv.h:704
GrAAType
Definition: GrTypesPriv.h:200
static GrClipEdgeType GrInvertClipEdgeType(const GrClipEdgeType edgeType)
Definition: GrTypesPriv.h:385
static constexpr bool GrColorTypeIsAlphaOnly(GrColorType ct)
Definition: GrTypesPriv.h:888
GrStoreOp
Definition: GrTypesPriv.h:165
static constexpr bool GrClipEdgeTypeIsFill(const GrClipEdgeType edgeType)
Definition: GrTypesPriv.h:371
static const int kGrVertexAttribTypeCount
Definition: GrTypesPriv.h:352
static constexpr bool GrClipEdgeTypeIsAA(const GrClipEdgeType edgeType)
Definition: GrTypesPriv.h:380
static const int kGrAATypeCount
Definition: GrTypesPriv.h:210
static constexpr int kNumGrPrimitiveTypes
Definition: GrTypesPriv.h:50
GrAA
Definition: GrTypesPriv.h:173
GrFillRule GrFillRuleForSkPath(const SkPath &path)
Definition: GrTypesPriv.h:195
GrColorType
Definition: GrTypesPriv.h:540
GrInternalSurfaceFlags
Definition: GrTypesPriv.h:436
static constexpr bool GrIsPrimTypeLines(GrPrimitiveType type)
Definition: GrTypesPriv.h:52
GpuPathRenderers
Definition: GrTypesPriv.h:506
GrScissorTest
Definition: GrTypesPriv.h:115
static constexpr bool GrColorTypeHasAlpha(GrColorType ct)
Definition: GrTypesPriv.h:892
GrAccessPattern
Definition: GrTypesPriv.h:424
@ kDynamic_GrAccessPattern
Definition: GrTypesPriv.h:426
@ kLast_GrAccessPattern
Definition: GrTypesPriv.h:432
@ kStatic_GrAccessPattern
Definition: GrTypesPriv.h:428
@ kStream_GrAccessPattern
Definition: GrTypesPriv.h:430
GrLoadOp
Definition: GrTypesPriv.h:155
static bool GrTextureTypeHasRestrictedSampling(GrTextureType type)
Definition: GrTypesPriv.h:294
static constexpr GrClampType GrColorTypeClampType(GrColorType colorType)
Definition: GrTypesPriv.h:868
GrBudgetedType
Definition: GrTypesPriv.h:100
GrVertexAttribType
Definition: GrTypesPriv.h:312
@ kUShort_norm_GrVertexAttribType
Definition: GrTypesPriv.h:346
@ kFloat2_GrVertexAttribType
Definition: GrTypesPriv.h:314
@ kUShort2_GrVertexAttribType
Definition: GrTypesPriv.h:340
@ kUInt_GrVertexAttribType
Definition: GrTypesPriv.h:344
@ kUByte4_norm_GrVertexAttribType
Definition: GrTypesPriv.h:334
@ kUByte_GrVertexAttribType
Definition: GrTypesPriv.h:329
@ kShort2_GrVertexAttribType
Definition: GrTypesPriv.h:337
@ kUShort4_norm_GrVertexAttribType
Definition: GrTypesPriv.h:348
@ kInt_GrVertexAttribType
Definition: GrTypesPriv.h:343
@ kByte_GrVertexAttribType
Definition: GrTypesPriv.h:326
@ kLast_GrVertexAttribType
Definition: GrTypesPriv.h:350
@ kByte4_GrVertexAttribType
Definition: GrTypesPriv.h:328
@ kFloat3_GrVertexAttribType
Definition: GrTypesPriv.h:315
@ kFloat_GrVertexAttribType
Definition: GrTypesPriv.h:313
@ kByte2_GrVertexAttribType
Definition: GrTypesPriv.h:327
@ kFloat4_GrVertexAttribType
Definition: GrTypesPriv.h:316
@ kShort4_GrVertexAttribType
Definition: GrTypesPriv.h:338
@ kUShort2_norm_GrVertexAttribType
Definition: GrTypesPriv.h:341
@ kInt3_GrVertexAttribType
Definition: GrTypesPriv.h:322
@ kHalf2_GrVertexAttribType
Definition: GrTypesPriv.h:318
@ kHalf4_GrVertexAttribType
Definition: GrTypesPriv.h:319
@ kUByte4_GrVertexAttribType
Definition: GrTypesPriv.h:331
@ kUByte2_GrVertexAttribType
Definition: GrTypesPriv.h:330
@ kInt4_GrVertexAttribType
Definition: GrTypesPriv.h:323
@ kUByte_norm_GrVertexAttribType
Definition: GrTypesPriv.h:333
@ kInt2_GrVertexAttribType
Definition: GrTypesPriv.h:321
@ kHalf_GrVertexAttribType
Definition: GrTypesPriv.h:317
GrFillRule
Definition: GrTypesPriv.h:178
static const int kGrShaderTypeCount
Definition: GrTypesPriv.h:282
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
Definition: GrTypesPriv.h:629
GrBackendObjectOwnership
Definition: GrTypesPriv.h:496
#define GR_MAKE_BITFIELD_CLASS_OPS(X)
Definition: GrTypes.h:42
GrSurfaceOrigin
Definition: GrTypes.h:147
@ kBottomLeft_GrSurfaceOrigin
Definition: GrTypes.h:149
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
GrBackendApi
Definition: GrTypes.h:95
static const uint32_t rgba[kNumPixels]
#define SkUNREACHABLE
Definition: SkAssert.h:135
#define SK_ABORT(message,...)
Definition: SkAssert.h:70
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkColorType
Definition: SkColorType.h:19
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
Definition: SkColorType.h:50
@ kRGBA_10x6_SkColorType
pixel with 10 used bits (most significant) followed by 6 unused
Definition: SkColorType.h:33
@ kR8_unorm_SkColorType
Definition: SkColorType.h:54
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
Definition: SkColorType.h:30
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition: SkColorType.h:23
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
Definition: SkColorType.h:43
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
Definition: SkColorType.h:48
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition: SkColorType.h:38
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition: SkColorType.h:21
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
Definition: SkColorType.h:29
@ kSRGBA_8888_SkColorType
Definition: SkColorType.h:53
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition: SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
@ kBGRA_10101010_XR_SkColorType
pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
Definition: SkColorType.h:32
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition: SkColorType.h:25
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
Definition: SkColorType.h:28
@ kA16_float_SkColorType
pixel with a half float for alpha
Definition: SkColorType.h:45
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
Definition: SkColorType.h:40
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
Definition: SkColorType.h:27
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
Definition: SkColorType.h:31
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
Definition: SkColorType.h:49
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
Definition: SkColorType.h:36
@ kUnknown_SkColorType
uninitialized
Definition: SkColorType.h:20
@ kR16G16_float_SkColorType
pixel with a half float for red and green
Definition: SkColorType.h:46
@ kRGB_SkColorChannelFlags
Definition: SkColor.h:247
@ kRGBA_SkColorChannelFlags
Definition: SkColor.h:248
@ kRed_SkColorChannelFlag
Definition: SkColor.h:239
@ kGrayAlpha_SkColorChannelFlags
Definition: SkColor.h:245
@ kRG_SkColorChannelFlags
Definition: SkColor.h:246
@ kAlpha_SkColorChannelFlag
Definition: SkColor.h:242
@ kGray_SkColorChannelFlag
Definition: SkColor.h:243
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
#define SK_MAKE_BITFIELD_OPS(X)
Definition: SkMacros.h:66
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
SkPathFillType
Definition: SkPathTypes.h:11
GLenum type
constexpr GrColorTypeEncoding encoding() const
Definition: GrTypesPriv.h:774
constexpr int operator[](int c) const
Definition: GrTypesPriv.h:762
constexpr int gray() const
Definition: GrTypesPriv.h:772
static constexpr GrColorFormatDesc MakeInvalid()
Definition: GrTypesPriv.h:756
constexpr int a() const
Definition: GrTypesPriv.h:761
static constexpr GrColorFormatDesc MakeRGBA(int rgba, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:720
static constexpr GrColorFormatDesc MakeRGB(int r, int g, int b, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:732
constexpr int r() const
Definition: GrTypesPriv.h:758
static constexpr GrColorFormatDesc MakeRGBA(int rgb, int a, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:724
static constexpr GrColorFormatDesc MakeAlpha(int a, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:736
static constexpr GrColorFormatDesc MakeGray(int grayBits, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:748
static constexpr GrColorFormatDesc MakeRG(int rg, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:744
constexpr int g() const
Definition: GrTypesPriv.h:759
static constexpr GrColorFormatDesc MakeRGB(int rgb, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:728
static constexpr GrColorFormatDesc MakeGrayAlpha(int grayAlpha, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:752
constexpr int b() const
Definition: GrTypesPriv.h:760
static constexpr GrColorFormatDesc MakeR(int r, GrColorTypeEncoding e)
Definition: GrTypesPriv.h:740
Definition: SkPath.h:59
FlutterSemanticsFlag flags
@ kDefault
uint8_t value
Dart_NativeFunction function
Definition: fuchsia.cc:51
double y
double x
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
Definition: switches.h:57
Definition: GpuTools.h:21
Mipmapped
Definition: GpuTypes.h:53
Definition: ref_ptr.h:256
std::true_type sk_is_trivially_relocatable
Definition: GrTypesPriv.h:143
const void * fPixels
Definition: GrTypesPriv.h:135
sk_sp< SkData > fOptionalStorage
Definition: GrTypesPriv.h:138
size_t fRowBytes
Definition: GrTypesPriv.h:136