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