• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 #include "GrGLConfig.h"
13 #include "SkRefCnt.h"
14 
15 /**
16  * Classifies GL contexts by which standard they implement (currently as OpenGL vs. OpenGL ES).
17  */
18 enum GrGLStandard {
19     kNone_GrGLStandard,
20     kGL_GrGLStandard,
21     kGLES_GrGLStandard,
22 };
23 static const int kGrGLStandardCnt = 3;
24 
25 ///////////////////////////////////////////////////////////////////////////////
26 
27 /**
28  * Declares typedefs for all the GL functions used in GrGLInterface
29  */
30 
31 typedef unsigned int GrGLenum;
32 typedef unsigned char GrGLboolean;
33 typedef unsigned int GrGLbitfield;
34 typedef signed char GrGLbyte;
35 typedef char GrGLchar;
36 typedef short GrGLshort;
37 typedef int GrGLint;
38 typedef int GrGLsizei;
39 typedef int64_t GrGLint64;
40 typedef unsigned char GrGLubyte;
41 typedef unsigned short GrGLushort;
42 typedef unsigned int GrGLuint;
43 typedef uint64_t GrGLuint64;
44 typedef float GrGLfloat;
45 typedef float GrGLclampf;
46 typedef double GrGLdouble;
47 typedef double GrGLclampd;
48 typedef void GrGLvoid;
49 #ifndef SK_IGNORE_64BIT_OPENGL_CHANGES
50 #ifdef _WIN64
51 typedef signed long long int GrGLintptr;
52 typedef signed long long int GrGLsizeiptr;
53 #else
54 typedef signed long int GrGLintptr;
55 typedef signed long int GrGLsizeiptr;
56 #endif
57 #else
58 typedef signed long int GrGLintptr;
59 typedef signed long int GrGLsizeiptr;
60 #endif
61 typedef void* GrGLeglImage;
62 typedef struct __GLsync* GrGLsync;
63 
64 struct GrGLDrawArraysIndirectCommand {
65     GrGLuint fCount;
66     GrGLuint fInstanceCount;
67     GrGLuint fFirst;
68     GrGLuint fBaseInstance;  // Requires EXT_base_instance on ES.
69 };
70 
71 GR_STATIC_ASSERT(16 == sizeof(GrGLDrawArraysIndirectCommand));
72 
73 struct GrGLDrawElementsIndirectCommand {
74     GrGLuint fCount;
75     GrGLuint fInstanceCount;
76     GrGLuint fFirstIndex;
77     GrGLuint fBaseVertex;
78     GrGLuint fBaseInstance;  // Requires EXT_base_instance on ES.
79 };
80 
81 GR_STATIC_ASSERT(20 == sizeof(GrGLDrawElementsIndirectCommand));
82 
83 /**
84  * KHR_debug
85  */
86 typedef void (GR_GL_FUNCTION_TYPE* GRGLDEBUGPROC)(GrGLenum source,
87                                                   GrGLenum type,
88                                                   GrGLuint id,
89                                                   GrGLenum severity,
90                                                   GrGLsizei length,
91                                                   const GrGLchar* message,
92                                                   const void* userParam);
93 
94 /**
95  * EGL types.
96  */
97 typedef void* GrEGLImage;
98 typedef void* GrEGLDisplay;
99 typedef void* GrEGLContext;
100 typedef void* GrEGLClientBuffer;
101 typedef unsigned int GrEGLenum;
102 typedef int32_t GrEGLint;
103 typedef unsigned int GrEGLBoolean;
104 
105 ///////////////////////////////////////////////////////////////////////////////
106 /**
107  * Types for interacting with GL resources created externally to Skia. GrBackendObjects for GL
108  * textures are really const GrGLTexture*
109  */
110 
111 struct GrGLTextureInfo {
112     GrGLenum fTarget;
113     GrGLuint fID;
114 };
115 
116 GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrGLTextureInfo*));
117 
118 struct GrGLFramebufferInfo {
119     GrGLuint fFBOID;
120 };
121 
122 GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrGLFramebufferInfo*));
123 
124 #endif
125