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