Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrGLTypes.h
Go to the documentation of this file.
1
2/*
3 * Copyright 2015 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#ifndef GrGLTypes_DEFINED
10#define GrGLTypes_DEFINED
11
15
16/**
17 * Classifies GL contexts by which standard they implement (currently as OpenGL vs. OpenGL ES).
18 */
25static const int kGrGLStandardCnt = 4;
26
27// The following allow certain interfaces to be turned off at compile time
28// (for example, to lower code size).
29#if SK_ASSUME_GL_ES
30 #define GR_IS_GR_GL(standard) false
31 #define GR_IS_GR_GL_ES(standard) true
32 #define GR_IS_GR_WEBGL(standard) false
33 #define SK_DISABLE_GL_INTERFACE 1
34 #define SK_DISABLE_WEBGL_INTERFACE 1
35#elif SK_ASSUME_GL
36 #define GR_IS_GR_GL(standard) true
37 #define GR_IS_GR_GL_ES(standard) false
38 #define GR_IS_GR_WEBGL(standard) false
39 #define SK_DISABLE_GL_ES_INTERFACE 1
40 #define SK_DISABLE_WEBGL_INTERFACE 1
41#elif SK_ASSUME_WEBGL
42 #define GR_IS_GR_GL(standard) false
43 #define GR_IS_GR_GL_ES(standard) false
44 #define GR_IS_GR_WEBGL(standard) true
45 #define SK_DISABLE_GL_ES_INTERFACE 1
46 #define SK_DISABLE_GL_INTERFACE 1
47#else
48 #define GR_IS_GR_GL(standard) (kGL_GrGLStandard == standard)
49 #define GR_IS_GR_GL_ES(standard) (kGLES_GrGLStandard == standard)
50 #define GR_IS_GR_WEBGL(standard) (kWebGL_GrGLStandard == standard)
51#endif
52
53///////////////////////////////////////////////////////////////////////////////
54
55/**
56 * The supported GL formats represented as an enum. Actual support by GrContext depends on GL
57 * context version and extensions.
58 */
96
97///////////////////////////////////////////////////////////////////////////////
98/**
99 * Declares typedefs for all the GL functions used in GrGLInterface
100 */
101
102typedef unsigned int GrGLenum;
103typedef unsigned char GrGLboolean;
104typedef unsigned int GrGLbitfield;
105typedef signed char GrGLbyte;
106typedef char GrGLchar;
107typedef short GrGLshort;
108typedef int GrGLint;
109typedef int GrGLsizei;
110typedef int64_t GrGLint64;
111typedef unsigned char GrGLubyte;
112typedef unsigned short GrGLushort;
113typedef unsigned int GrGLuint;
114typedef uint64_t GrGLuint64;
115typedef unsigned short int GrGLhalf;
116typedef float GrGLfloat;
117typedef float GrGLclampf;
118typedef double GrGLdouble;
119typedef double GrGLclampd;
120typedef void GrGLvoid;
121#ifdef _WIN64
122typedef signed long long int GrGLintptr;
123typedef signed long long int GrGLsizeiptr;
124#else
125typedef signed long int GrGLintptr;
126typedef signed long int GrGLsizeiptr;
127#endif
128typedef void* GrGLeglImage;
129typedef struct __GLsync* GrGLsync;
130
137
138// static_asserts must have messages in this file because its included in C++14 client code.
139static_assert(16 == sizeof(GrGLDrawArraysIndirectCommand), "");
140
148
149static_assert(20 == sizeof(GrGLDrawElementsIndirectCommand), "");
150
151/**
152 * KHR_debug
153 */
156 GrGLuint id,
157 GrGLenum severity,
159 const GrGLchar* message,
160 const void* userParam);
161
162/**
163 * EGL types.
164 */
165typedef void* GrEGLImage;
166typedef void* GrEGLDisplay;
167typedef void* GrEGLContext;
168typedef void* GrEGLClientBuffer;
169typedef unsigned int GrEGLenum;
170typedef int32_t GrEGLint;
171typedef unsigned int GrEGLBoolean;
172
173///////////////////////////////////////////////////////////////////////////////
174/**
175 * Types for interacting with GL resources created externally to Skia. GrBackendObjects for GL
176 * textures are really const GrGLTexture*. The fFormat here should be a sized, internal format
177 * for the texture. We will try to use the sized format if the GL Context supports it, otherwise
178 * we will internally fall back to using the base internal formats.
179 */
184 skgpu::Protected fProtected = skgpu::Protected::kNo;
185
186 bool operator==(const GrGLTextureInfo& that) const {
187 return fTarget == that.fTarget &&
188 fID == that.fID &&
189 fFormat == that.fFormat &&
190 fProtected == that.fProtected;
191 }
192
193 bool isProtected() const { return fProtected == skgpu::Protected::kYes; }
194};
195
199 skgpu::Protected fProtected = skgpu::Protected::kNo;
200
201 bool operator==(const GrGLFramebufferInfo& that) const {
202 return fFBOID == that.fFBOID &&
203 fFormat == that.fFormat &&
204 fProtected == that.fProtected;
205 }
206
207 bool isProtected() const { return fProtected == skgpu::Protected::kYes; }
208};
209
211 uint32_t fSampleCount = 1;
212 uint32_t fLevelCount = 0;
213 skgpu::Protected fProtected = skgpu::Protected::kNo;
214
217};
218
219#endif
#define GR_GL_FUNCTION_TYPE
Definition GrGLConfig.h:27
double GrGLclampd
Definition GrGLTypes.h:119
GrGLFormat
Definition GrGLTypes.h:59
@ kCOMPRESSED_ETC1_RGB8
@ kCOMPRESSED_RGB8_BC1
@ kCOMPRESSED_RGB8_ETC2
@ kCOMPRESSED_RGBA8_BC1
@ kLUMINANCE8_ALPHA8
unsigned int GrGLuint
Definition GrGLTypes.h:113
float GrGLclampf
Definition GrGLTypes.h:117
unsigned char GrGLboolean
Definition GrGLTypes.h:103
GrGLStandard
Definition GrGLTypes.h:19
@ kNone_GrGLStandard
Definition GrGLTypes.h:20
@ kGLES_GrGLStandard
Definition GrGLTypes.h:22
@ kWebGL_GrGLStandard
Definition GrGLTypes.h:23
@ kGL_GrGLStandard
Definition GrGLTypes.h:21
unsigned short int GrGLhalf
Definition GrGLTypes.h:115
short GrGLshort
Definition GrGLTypes.h:107
static const int kGrGLStandardCnt
Definition GrGLTypes.h:25
int GrGLsizei
Definition GrGLTypes.h:109
int64_t GrGLint64
Definition GrGLTypes.h:110
float GrGLfloat
Definition GrGLTypes.h:116
unsigned int GrGLbitfield
Definition GrGLTypes.h:104
char GrGLchar
Definition GrGLTypes.h:106
void(GR_GL_FUNCTION_TYPE * GRGLDEBUGPROC)(GrGLenum source, GrGLenum type, GrGLuint id, GrGLenum severity, GrGLsizei length, const GrGLchar *message, const void *userParam)
Definition GrGLTypes.h:154
int GrGLint
Definition GrGLTypes.h:108
void * GrEGLContext
Definition GrGLTypes.h:167
unsigned int GrGLenum
Definition GrGLTypes.h:102
void * GrEGLImage
Definition GrGLTypes.h:165
unsigned short GrGLushort
Definition GrGLTypes.h:112
void * GrEGLDisplay
Definition GrGLTypes.h:166
signed long int GrGLintptr
Definition GrGLTypes.h:125
unsigned int GrEGLenum
Definition GrGLTypes.h:169
unsigned char GrGLubyte
Definition GrGLTypes.h:111
void * GrGLeglImage
Definition GrGLTypes.h:128
void GrGLvoid
Definition GrGLTypes.h:120
uint64_t GrGLuint64
Definition GrGLTypes.h:114
int32_t GrEGLint
Definition GrGLTypes.h:170
struct __GLsync * GrGLsync
Definition GrGLTypes.h:129
void * GrEGLClientBuffer
Definition GrGLTypes.h:168
signed char GrGLbyte
Definition GrGLTypes.h:105
unsigned int GrEGLBoolean
Definition GrGLTypes.h:171
double GrGLdouble
Definition GrGLTypes.h:118
signed long int GrGLsizeiptr
Definition GrGLTypes.h:126
SkBitmap source
Definition examples.cpp:28
size_t length
Win32Message message
Protected
Definition GpuTypes.h:61
bool isProtected() const
Definition GrGLTypes.h:207
skgpu::Protected fProtected
Definition GrGLTypes.h:199
bool operator==(const GrGLFramebufferInfo &that) const
Definition GrGLTypes.h:201
uint32_t fLevelCount
Definition GrGLTypes.h:212
GrGLenum fFormat
Definition GrGLTypes.h:216
GrGLenum fTarget
Definition GrGLTypes.h:215
uint32_t fSampleCount
Definition GrGLTypes.h:211
skgpu::Protected fProtected
Definition GrGLTypes.h:213
skgpu::Protected fProtected
Definition GrGLTypes.h:184
bool operator==(const GrGLTextureInfo &that) const
Definition GrGLTypes.h:186
GrGLenum fFormat
Definition GrGLTypes.h:183
bool isProtected() const
Definition GrGLTypes.h:193
GrGLenum fTarget
Definition GrGLTypes.h:181
const uintptr_t id