Skia
2D Graphics Library
GrTypes.h File Reference
Include dependency graph for GrTypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GrTFlagsMask< TFlags >
 Wraps a C++11 enum that we use as a bitfield, and enables a limited amount of masking with type safety. More...
 
struct  GrFlushInfo
 Struct to supply options to flush calls. More...
 

Macros

#define GR_MAKE_BITFIELD_OPS(X)
 Defines overloaded bitwise operators to make it easier to use an enum as a bitfield. More...
 
#define GR_DECL_BITFIELD_OPS_FRIENDS(X)
 
#define GR_MAKE_BITFIELD_CLASS_OPS(X)
 Defines bitwise operators that make it possible to use an enum class as a basic bitfield. More...
 
#define GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(X)
 

Typedefs

typedef GrBackendApi GrBackend
 Previously the above enum was not an enum class but a normal enum. More...
 
using GrMipMapped = GrMipmapped
 Deprecated legacy alias of GrMipmapped. More...
 
typedef void * GrGpuFinishedContext
 
typedef void(* GrGpuFinishedProc) (GrGpuFinishedContext finishedContext)
 
typedef void * GrGpuSubmittedContext
 
typedef void(* GrGpuSubmittedProc) (GrGpuSubmittedContext submittedContext, bool success)
 

Enumerations

enum  GrBackendApi : unsigned {
  GrBackendApi::kOpenGL, GrBackendApi::kVulkan, GrBackendApi::kMetal, GrBackendApi::kDirect3D,
  GrBackendApi::kDawn, GrBackendApi::kMock, GrBackendApi::kOpenGL_GrBackend = kOpenGL
}
 Possible 3D APIs that may be used by Ganesh. More...
 
enum  GrMipmapped : bool { GrMipmapped::kNo = false, GrMipmapped::kYes = true }
 Used to say whether a texture has mip levels allocated or not. More...
 
enum  GrRenderable : bool { GrRenderable::kNo = false, GrRenderable::kYes = true }
 
enum  GrProtected : bool { GrProtected::kNo = false, GrProtected::kYes = true }
 
enum  GrSurfaceOrigin : int { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }
 GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to either the top-left or bottom-left content pixel. More...
 
enum  GrGLBackendState {
  kRenderTarget_GrGLBackendState = 1 << 0, kTextureBinding_GrGLBackendState = 1 << 1, kView_GrGLBackendState = 1 << 2, kBlend_GrGLBackendState = 1 << 3,
  kMSAAEnable_GrGLBackendState = 1 << 4, kVertex_GrGLBackendState = 1 << 5, kStencil_GrGLBackendState = 1 << 6, kPixelStore_GrGLBackendState = 1 << 7,
  kProgram_GrGLBackendState = 1 << 8, kFixedFunction_GrGLBackendState = 1 << 9, kMisc_GrGLBackendState = 1 << 10, kPathRendering_GrGLBackendState = 1 << 11,
  kALL_GrGLBackendState = 0xffff
}
 A GrContext's cache of backend context state can be partially invalidated. More...
 
enum  GrSemaphoresSubmitted : bool { GrSemaphoresSubmitted::kNo = false, GrSemaphoresSubmitted::kYes = true }
 Enum used as return value when flush with semaphores so the client knows whether the valid semaphores will be submitted on the next GrContext::submit call. More...
 

Functions

template<typename TFlags >
constexpr GrTFlagsMask< TFlags > operator| (GrTFlagsMask< TFlags > a, GrTFlagsMask< TFlags > b)
 
template<typename TFlags >
constexpr GrTFlagsMask< TFlags > operator| (GrTFlagsMask< TFlags > a, TFlags b)
 
template<typename TFlags >
constexpr GrTFlagsMask< TFlags > operator| (TFlags a, GrTFlagsMask< TFlags > b)
 
template<typename TFlags >
GrTFlagsMask< TFlags > & operator|= (GrTFlagsMask< TFlags > &a, GrTFlagsMask< TFlags > b)
 
template<typename TFlags >
constexpr GrTFlagsMask< TFlags > operator& (GrTFlagsMask< TFlags > a, GrTFlagsMask< TFlags > b)
 
template<typename TFlags >
constexpr TFlags operator& (GrTFlagsMask< TFlags > a, TFlags b)
 
template<typename TFlags >
constexpr TFlags operator& (TFlags a, GrTFlagsMask< TFlags > b)
 
template<typename TFlags >
TFlags & operator&= (TFlags &a, GrTFlagsMask< TFlags > b)
 

Variables

static constexpr GrBackendApi kMetal_GrBackend = GrBackendApi::kMetal
 
static constexpr GrBackendApi kVulkan_GrBackend = GrBackendApi::kVulkan
 
static constexpr GrBackendApi kMock_GrBackend = GrBackendApi::kMock
 
static const uint32_t kAll_GrBackendState = 0xffffffff
 This value translates to reseting all the context state for any backend. More...
 

Macro Definition Documentation

◆ GR_DECL_BITFIELD_CLASS_OPS_FRIENDS

#define GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (   X)
Value:
friend constexpr GrTFlagsMask<X> operator ~(X); \
friend constexpr X operator |(X, X); \
friend X& operator |=(X&, X); \
friend constexpr bool operator &(X, X)

◆ GR_DECL_BITFIELD_OPS_FRIENDS

#define GR_DECL_BITFIELD_OPS_FRIENDS (   X)
Value:
friend X operator |(X a, X b); \
friend X& operator |=(X& a, X b); \
\
friend X operator &(X a, X b); \
friend X& operator &=(X& a, X b); \
\
template <typename T> \
friend X operator &(T a, X b); \
\
template <typename T> \
friend X operator &(X a, T b); \

◆ GR_MAKE_BITFIELD_CLASS_OPS

#define GR_MAKE_BITFIELD_CLASS_OPS (   X)
Value:
constexpr GrTFlagsMask<X> operator~(X a) { \
return GrTFlagsMask<X>(~static_cast<int>(a)); \
} \
constexpr X operator|(X a, X b) { \
return static_cast<X>(static_cast<int>(a) | static_cast<int>(b)); \
} \
inline X& operator|=(X& a, X b) { \
return (a = a | b); \
} \
constexpr bool operator&(X a, X b) { \
return SkToBool(static_cast<int>(a) & static_cast<int>(b)); \
} \

Defines bitwise operators that make it possible to use an enum class as a basic bitfield.

◆ GR_MAKE_BITFIELD_OPS

#define GR_MAKE_BITFIELD_OPS (   X)
Value:
inline X operator |(X a, X b) { \
return (X) (+a | +b); \
} \
inline X& operator |=(X& a, X b) { \
return (a = a | b); \
} \
inline X operator &(X a, X b) { \
return (X) (+a & +b); \
} \
inline X& operator &=(X& a, X b) { \
return (a = a & b); \
} \
template <typename T> \
inline X operator &(T a, X b) { \
return (X) (+a & +b); \
} \
template <typename T> \
inline X operator &(X a, T b) { \
return (X) (+a & +b); \
} \

Defines overloaded bitwise operators to make it easier to use an enum as a bitfield.

Typedef Documentation

◆ GrBackend

Previously the above enum was not an enum class but a normal enum.

To support the legacy use of the enum values we define them below so that no clients break.

◆ GrGpuFinishedContext

typedef void* GrGpuFinishedContext

◆ GrGpuFinishedProc

typedef void(* GrGpuFinishedProc) (GrGpuFinishedContext finishedContext)

◆ GrGpuSubmittedContext

typedef void* GrGpuSubmittedContext

◆ GrGpuSubmittedProc

typedef void(* GrGpuSubmittedProc) (GrGpuSubmittedContext submittedContext, bool success)

◆ GrMipMapped

Deprecated legacy alias of GrMipmapped.

Enumeration Type Documentation

◆ GrBackendApi

enum GrBackendApi : unsigned
strong

Possible 3D APIs that may be used by Ganesh.

Enumerator
kOpenGL 
kVulkan 
kMetal 
kDirect3D 
kDawn 
kMock 

Mock is a backend that does not draw anything.

It is used for unit tests and to measure CPU overhead.

kOpenGL_GrBackend 

Added here to support the legacy GrBackend enum value and clients who referenced it using GrBackend::kOpenGL_GrBackend.

◆ GrGLBackendState

A GrContext's cache of backend context state can be partially invalidated.

These enums are specific to the GL backend and we'd add a new set for an alternative backend.

Enumerator
kRenderTarget_GrGLBackendState 
kTextureBinding_GrGLBackendState 
kView_GrGLBackendState 
kBlend_GrGLBackendState 
kMSAAEnable_GrGLBackendState 
kVertex_GrGLBackendState 
kStencil_GrGLBackendState 
kPixelStore_GrGLBackendState 
kProgram_GrGLBackendState 
kFixedFunction_GrGLBackendState 
kMisc_GrGLBackendState 
kPathRendering_GrGLBackendState 
kALL_GrGLBackendState 

◆ GrMipmapped

enum GrMipmapped : bool
strong

Used to say whether a texture has mip levels allocated or not.

Enumerator
kNo 
kYes 

◆ GrProtected

enum GrProtected : bool
strong
Enumerator
kNo 
kYes 

◆ GrRenderable

enum GrRenderable : bool
strong
Enumerator
kNo 
kYes 

◆ GrSemaphoresSubmitted

enum GrSemaphoresSubmitted : bool
strong

Enum used as return value when flush with semaphores so the client knows whether the valid semaphores will be submitted on the next GrContext::submit call.

Enumerator
kNo 
kYes 

◆ GrSurfaceOrigin

enum GrSurfaceOrigin : int

GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to either the top-left or bottom-left content pixel.

Enumerator
kTopLeft_GrSurfaceOrigin 
kBottomLeft_GrSurfaceOrigin 

Function Documentation

◆ operator&() [1/3]

template<typename TFlags >
constexpr GrTFlagsMask<TFlags> operator& ( GrTFlagsMask< TFlags >  a,
GrTFlagsMask< TFlags >  b 
)
constexpr

◆ operator&() [2/3]

template<typename TFlags >
constexpr TFlags operator& ( GrTFlagsMask< TFlags >  a,
TFlags  b 
)
constexpr

◆ operator&() [3/3]

template<typename TFlags >
constexpr TFlags operator& ( TFlags  a,
GrTFlagsMask< TFlags >  b 
)
constexpr

◆ operator&=()

template<typename TFlags >
TFlags& operator&= ( TFlags &  a,
GrTFlagsMask< TFlags >  b 
)
inline

◆ operator|() [1/3]

template<typename TFlags >
constexpr GrTFlagsMask<TFlags> operator| ( GrTFlagsMask< TFlags >  a,
GrTFlagsMask< TFlags >  b 
)
constexpr

◆ operator|() [2/3]

template<typename TFlags >
constexpr GrTFlagsMask<TFlags> operator| ( GrTFlagsMask< TFlags >  a,
TFlags  b 
)
constexpr

◆ operator|() [3/3]

template<typename TFlags >
constexpr GrTFlagsMask<TFlags> operator| ( TFlags  a,
GrTFlagsMask< TFlags >  b 
)
constexpr

◆ operator|=()

template<typename TFlags >
GrTFlagsMask<TFlags>& operator|= ( GrTFlagsMask< TFlags > &  a,
GrTFlagsMask< TFlags >  b 
)
inline

Variable Documentation

◆ kAll_GrBackendState

const uint32_t kAll_GrBackendState = 0xffffffff
static

This value translates to reseting all the context state for any backend.

◆ kMetal_GrBackend

constexpr GrBackendApi kMetal_GrBackend = GrBackendApi::kMetal
staticconstexpr

◆ kMock_GrBackend

constexpr GrBackendApi kMock_GrBackend = GrBackendApi::kMock
staticconstexpr

◆ kVulkan_GrBackend

constexpr GrBackendApi kVulkan_GrBackend = GrBackendApi::kVulkan
staticconstexpr
operator&=
TFlags & operator&=(TFlags &a, GrTFlagsMask< TFlags > b)
Definition: GrTypes.h:102
operator|
constexpr GrTFlagsMask< TFlags > operator|(GrTFlagsMask< TFlags > a, GrTFlagsMask< TFlags > b)
Definition: GrTypes.h:74
SkToBool
static constexpr bool SkToBool(const T &x)
Definition: SkTypes.h:497
GrTFlagsMask
Wraps a C++11 enum that we use as a bitfield, and enables a limited amount of masking with type safet...
Definition: GrTypes.h:64
operator|=
GrTFlagsMask< TFlags > & operator|=(GrTFlagsMask< TFlags > &a, GrTFlagsMask< TFlags > b)
Definition: GrTypes.h:86
operator&
constexpr GrTFlagsMask< TFlags > operator&(GrTFlagsMask< TFlags > a, GrTFlagsMask< TFlags > b)
Definition: GrTypes.h:92