epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 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. |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 10 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 11 | #ifndef GrGLInterface_DEFINED |
| 12 | #define GrGLInterface_DEFINED |
| 13 | |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 14 | #include "GrGLConfig.h" |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 15 | #include "GrRefCnt.h" |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 16 | |
| 17 | #if !defined(GR_GL_FUNCTION_TYPE) |
| 18 | #define GR_GL_FUNCTION_TYPE |
| 19 | #endif |
| 20 | |
| 21 | //////////////////////////////////////////////////////////////////////////////// |
| 22 | |
| 23 | /** |
| 24 | * Helpers for glGetString() |
| 25 | */ |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 26 | |
bsalomon@google.com | 4d06214 | 2011-09-22 14:31:24 +0000 | [diff] [blame] | 27 | typedef uint32_t GrGLVersion; |
bsalomon@google.com | edfe1aa | 2011-09-29 14:40:26 +0000 | [diff] [blame] | 28 | typedef uint32_t GrGLSLVersion; |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 29 | |
bsalomon@google.com | edfe1aa | 2011-09-29 14:40:26 +0000 | [diff] [blame] | 30 | #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 31 | static_cast<int>(minor)) |
| 32 | #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 33 | static_cast<int>(minor)) |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 34 | |
bsalomon@google.com | 2c17fcd | 2011-07-06 17:47:02 +0000 | [diff] [blame] | 35 | // these variants assume caller already has a string from glGetString() |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 36 | GrGLVersion GrGLGetVersionFromString(const char* versionString); |
bsalomon@google.com | edfe1aa | 2011-09-29 14:40:26 +0000 | [diff] [blame] | 37 | GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString); |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 38 | bool GrGLHasExtensionFromString(const char* ext, const char* extensionString); |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 39 | |
bsalomon@google.com | 2c17fcd | 2011-07-06 17:47:02 +0000 | [diff] [blame] | 40 | // these variants call glGetString() |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 41 | bool GrGLHasExtension(const GrGLInterface*, const char* ext); |
bsalomon@google.com | c82b889 | 2011-09-22 14:10:33 +0000 | [diff] [blame] | 42 | GrGLVersion GrGLGetVersion(const GrGLInterface*); |
bsalomon@google.com | edfe1aa | 2011-09-29 14:40:26 +0000 | [diff] [blame] | 43 | GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*); |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 44 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 45 | //////////////////////////////////////////////////////////////////////////////// |
| 46 | |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 47 | /** |
| 48 | * Rather than depend on platform-specific GL headers and libraries, we require |
| 49 | * the client to provide a struct of GL function pointers. This struct can be |
| 50 | * specified per-GrContext as a parameter to GrContext::Create. If NULL is |
| 51 | * passed to Create then the "default" GL interface is used. If the default is |
| 52 | * also NULL GrContext creation will fail. |
| 53 | * |
bsalomon@google.com | 6fb736f | 2011-09-16 18:51:57 +0000 | [diff] [blame] | 54 | * The default interface is returned by GrGLDefaultInterface. This function's |
| 55 | * implementation is platform-specifc. Several have been provided, along with an |
| 56 | * implementation that simply returns NULL. It is implementation-specific |
| 57 | * whether the same GrGLInterface is returned or whether a new one is created |
| 58 | * at each call. Some platforms may not be able to use a single GrGLInterface |
| 59 | * because extension function ptrs vary across contexts. Note that GrGLInterface |
| 60 | * is ref-counted. So if the same object is returned by multiple calls to |
| 61 | * GrGLDefaultInterface, each should bump the ref count. |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 62 | * |
| 63 | * By defining GR_GL_PER_GL_CALL_IFACE_CALLBACK to 1 the client can specify a |
| 64 | * callback function that will be called prior to each GL function call. See |
| 65 | * comments in GrGLConfig.h |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 66 | */ |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 67 | |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 68 | struct GrGLInterface; |
| 69 | |
bsalomon@google.com | 6fb736f | 2011-09-16 18:51:57 +0000 | [diff] [blame] | 70 | const GrGLInterface* GrGLDefaultInterface(); |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 71 | |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 72 | /** |
| 73 | * Creates a GrGLInterface for a "native" GL context (e.g. WGL on windows, |
| 74 | * GLX on linux, AGL on Mac). On platforms that have context-specific function |
| 75 | * pointers for GL extensions (e.g. windows) the returned interface is only |
| 76 | * valid for the context that was current at creation. |
| 77 | */ |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 78 | const GrGLInterface* GrGLCreateNativeInterface(); |
| 79 | |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 80 | /** |
| 81 | * Creates a GrGLInterface for an OSMesa context. |
| 82 | */ |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 83 | const GrGLInterface* GrGLCreateMesaInterface(); |
| 84 | |
bsalomon@google.com | 7491372 | 2011-10-27 20:44:19 +0000 | [diff] [blame] | 85 | /** |
| 86 | * Creates a null GrGLInterface that doesn't draw anything. Used for measuring |
| 87 | * CPU overhead. |
| 88 | */ |
| 89 | const GrGLInterface* GrGLCreateNullInterface(); |
| 90 | |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 91 | typedef unsigned int GrGLenum; |
| 92 | typedef unsigned char GrGLboolean; |
| 93 | typedef unsigned int GrGLbitfield; |
| 94 | typedef signed char GrGLbyte; |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 95 | typedef char GrGLchar; |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 96 | typedef short GrGLshort; |
| 97 | typedef int GrGLint; |
| 98 | typedef int GrGLsizei; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 99 | typedef int64_t GrGLint64; |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 100 | typedef unsigned char GrGLubyte; |
| 101 | typedef unsigned short GrGLushort; |
| 102 | typedef unsigned int GrGLuint; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 103 | typedef uint64_t GrGLuint64; |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 104 | typedef float GrGLfloat; |
| 105 | typedef float GrGLclampf; |
| 106 | typedef double GrGLdouble; |
| 107 | typedef double GrGLclampd; |
| 108 | typedef void GrGLvoid; |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 109 | typedef long GrGLintptr; |
| 110 | typedef long GrGLsizeiptr; |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 111 | |
twiz@google.com | b65e0cb | 2011-03-18 20:41:44 +0000 | [diff] [blame] | 112 | enum GrGLBinding { |
| 113 | kDesktop_GrGLBinding = 0x01, |
| 114 | kES1_GrGLBinding = 0x02, |
| 115 | kES2_GrGLBinding = 0x04 |
| 116 | }; |
| 117 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 118 | extern "C" { |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 119 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLActiveTextureProc)(GrGLenum texture); |
| 120 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLAttachShaderProc)(GrGLuint program, GrGLuint shader); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 121 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBeginQueryProc)(GrGLenum target, GrGLuint id); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 122 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindAttribLocationProc)(GrGLuint program, GrGLuint index, const char* name); |
| 123 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindBufferProc)(GrGLenum target, GrGLuint buffer); |
| 124 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindTextureProc)(GrGLenum target, GrGLuint texture); |
| 125 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha); |
bsalomon@google.com | bc5cf51 | 2011-09-21 16:21:07 +0000 | [diff] [blame] | 126 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationProc)(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 127 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendFuncProc)(GrGLenum sfactor, GrGLenum dfactor); |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 128 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferDataProc)(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage); |
| 129 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferSubDataProc)(GrGLenum target, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid* data); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 130 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearProc)(GrGLbitfield mask); |
| 131 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearColorProc)(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha); |
| 132 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClearStencilProc)(GrGLint s); |
| 133 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLClientActiveTextureProc)(GrGLenum texture); |
| 134 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColor4ubProc)(GrGLubyte red, GrGLubyte green, GrGLubyte blue, GrGLubyte alpha); |
| 135 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha); |
| 136 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLColorPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer); |
| 137 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCompileShaderProc)(GrGLuint shader); |
| 138 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data); |
| 139 | typedef GrGLuint (GR_GL_FUNCTION_TYPE *GrGLCreateProgramProc)(void); |
| 140 | typedef GrGLuint (GR_GL_FUNCTION_TYPE *GrGLCreateShaderProc)(GrGLenum type); |
| 141 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLCullFaceProc)(GrGLenum mode); |
| 142 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteBuffersProc)(GrGLsizei n, const GrGLuint* buffers); |
| 143 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteProgramProc)(GrGLuint program); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 144 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteQueriesProc)(GrGLsizei n, const GrGLuint *ids); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 145 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteShaderProc)(GrGLuint shader); |
| 146 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteTexturesProc)(GrGLsizei n, const GrGLuint* textures); |
| 147 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDepthMaskProc)(GrGLboolean flag); |
| 148 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableProc)(GrGLenum cap); |
| 149 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableClientStateProc)(GrGLenum array); |
| 150 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDisableVertexAttribArrayProc)(GrGLuint index); |
| 151 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawArraysProc)(GrGLenum mode, GrGLint first, GrGLsizei count); |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 152 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawBufferProc)(GrGLenum mode); |
| 153 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawBuffersProc)(GrGLsizei n, const GrGLenum* bufs); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 154 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices); |
| 155 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableProc)(GrGLenum cap); |
| 156 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableClientStateProc)(GrGLenum cap); |
| 157 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEnableVertexAttribArrayProc)(GrGLuint index); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 158 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLEndQueryProc)(GrGLenum target); |
| 159 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFinishProc)(); |
| 160 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFlushProc)(); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 161 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFrontFaceProc)(GrGLenum mode); |
| 162 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenBuffersProc)(GrGLsizei n, GrGLuint* buffers); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 163 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenQueriesProc)(GrGLsizei n, GrGLuint *ids); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 164 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenTexturesProc)(GrGLsizei n, GrGLuint* textures); |
| 165 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetBufferParameterivProc)(GrGLenum target, GrGLenum pname, GrGLint* params); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 166 | typedef GrGLenum (GR_GL_FUNCTION_TYPE *GrGLGetErrorProc)(); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 167 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetIntegervProc)(GrGLenum pname, GrGLint* params); |
| 168 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramInfoLogProc)(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog); |
| 169 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetProgramivProc)(GrGLuint program, GrGLenum pname, GrGLint* params); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 170 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetQueryivProc)(GrGLenum GLtarget, GrGLenum pname, GrGLint *params); |
| 171 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetQueryObjecti64vProc)(GrGLuint id, GrGLenum pname, GrGLint64 *params); |
| 172 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetQueryObjectivProc)(GrGLuint id, GrGLenum pname, GrGLint *params); |
| 173 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetQueryObjectui64vProc)(GrGLuint id, GrGLenum pname, GrGLuint64 *params); |
| 174 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetQueryObjectuivProc)(GrGLuint id, GrGLenum pname, GrGLuint *params); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 175 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderInfoLogProc)(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog); |
| 176 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetShaderivProc)(GrGLuint shader, GrGLenum pname, GrGLint* params); |
| 177 | typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE *GrGLGetStringProc)(GrGLenum name); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 178 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetTexLevelParameterivProc)(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 179 | typedef GrGLint (GR_GL_FUNCTION_TYPE *GrGLGetUniformLocationProc)(GrGLuint program, const char* name); |
| 180 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLineWidthProc)(GrGLfloat width); |
| 181 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLinkProgramProc)(GrGLuint program); |
| 182 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLLoadMatrixfProc)(const GrGLfloat* m); |
| 183 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLMatrixModeProc)(GrGLenum mode); |
| 184 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLPixelStoreiProc)(GrGLenum pname, GrGLint param); |
| 185 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLPointSizeProc)(GrGLfloat size); |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 186 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLQueryCounterProc)(GrGLuint id, GrGLenum target); |
bsalomon@google.com | c49d66b | 2011-08-03 14:22:30 +0000 | [diff] [blame] | 187 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLReadBufferProc)(GrGLenum src); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 188 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLReadPixelsProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels); |
| 189 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLScissorProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); |
| 190 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLShadeModelProc)(GrGLenum mode); |
| 191 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLShaderSourceProc)(GrGLuint shader, GrGLsizei count, const char** str, const GrGLint* length); |
| 192 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncProc)(GrGLenum func, GrGLint ref, GrGLuint mask); |
| 193 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilFuncSeparateProc)(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask); |
| 194 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskProc)(GrGLuint mask); |
| 195 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilMaskSeparateProc)(GrGLenum face, GrGLuint mask); |
| 196 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpProc)(GrGLenum fail, GrGLenum zfail, GrGLenum zpass); |
| 197 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLStencilOpSeparateProc)(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass); |
| 198 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexCoordPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer); |
| 199 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexEnviProc)(GrGLenum target, GrGLenum pname, GrGLint param); |
| 200 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexImage2DProc)(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels); |
| 201 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param); |
| 202 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels); |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 203 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1fProc)(GrGLint location, GrGLfloat v0); |
| 204 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1iProc)(GrGLint location, GrGLint v0); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 205 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v); |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 206 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform1ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v); |
| 207 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2fProc)(GrGLint location, GrGLfloat v0, GrGLfloat v1); |
| 208 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2iProc)(GrGLint location, GrGLint v0, GrGLint v1); |
| 209 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v); |
| 210 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform2ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v); |
| 211 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3fProc)(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2); |
| 212 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3iProc)(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2); |
| 213 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v); |
| 214 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform3ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v); |
| 215 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4fProc)(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2, GrGLfloat v3); |
| 216 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4iProc)(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 217 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4fvProc)(GrGLint location, GrGLsizei count, const GrGLfloat* v); |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 218 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniform4ivProc)(GrGLint location, GrGLsizei count, const GrGLint* v); |
| 219 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix2fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 220 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix3fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value); |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 221 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUniformMatrix4fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 222 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLUseProgramProc)(GrGLuint program); |
| 223 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttrib4fvProc)(GrGLuint indx, const GrGLfloat* values); |
| 224 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexAttribPointerProc)(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr); |
| 225 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLVertexPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer); |
| 226 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLViewportProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 227 | |
| 228 | // FBO Extension Functions |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 229 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFramebufferProc)(GrGLenum target, GrGLuint framebuffer); |
| 230 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindRenderbufferProc)(GrGLenum target, GrGLuint renderbuffer); |
| 231 | typedef GrGLenum (GR_GL_FUNCTION_TYPE *GrGLCheckFramebufferStatusProc)(GrGLenum target); |
| 232 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteFramebuffersProc)(GrGLsizei n, const GrGLuint *framebuffers); |
| 233 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLDeleteRenderbuffersProc)(GrGLsizei n, const GrGLuint *renderbuffers); |
| 234 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferRenderbufferProc)(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer); |
| 235 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level); |
| 236 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenFramebuffersProc)(GrGLsizei n, GrGLuint *framebuffers); |
| 237 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGenRenderbuffersProc)(GrGLsizei n, GrGLuint *renderbuffers); |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 238 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetFramebufferAttachmentParameterivProc)(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params); |
| 239 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLGetRenderbufferParameterivProc)(GrGLenum target, GrGLenum pname, GrGLint* params); |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 240 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageProc)(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height); |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 241 | |
| 242 | // Multisampling Extension Functions |
| 243 | // same prototype for ARB_FBO, EXT_FBO, GL 3.0, & Apple ES extension |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 244 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLRenderbufferStorageMultisampleProc)(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height); |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 245 | // desktop: ext_fbo_blit, arb_fbo, gl 3.0 |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 246 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBlitFramebufferProc)(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter); |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 247 | // apple's es extension |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 248 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLResolveMultisampleFramebufferProc)(); |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 249 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 250 | // Buffer mapping (extension in ES). |
twiz@google.com | 0f31ca7 | 2011-03-18 17:38:11 +0000 | [diff] [blame] | 251 | typedef GrGLvoid* (GR_GL_FUNCTION_TYPE *GrGLMapBufferProc)(GrGLenum target, GrGLenum access); |
| 252 | typedef GrGLboolean (GR_GL_FUNCTION_TYPE *GrGLUnmapBufferProc)(GrGLenum target); |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 253 | |
| 254 | // Dual source blending |
| 255 | typedef GrGLvoid (GR_GL_FUNCTION_TYPE *GrGLBindFragDataLocationIndexedProc)(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name); |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 256 | } // extern "C" |
| 257 | |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 258 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 259 | typedef void (*GrGLInterfaceCallbackProc)(const GrGLInterface*); |
| 260 | typedef intptr_t GrGLInterfaceCallbackData; |
| 261 | #endif |
| 262 | |
| 263 | |
tomhudson@google.com | e67bd3f | 2011-06-16 14:08:04 +0000 | [diff] [blame] | 264 | enum GrGLCapability { |
| 265 | kProbe_GrGLCapability = -1 |
tomhudson@google.com | 30e4bb6 | 2011-06-15 19:41:46 +0000 | [diff] [blame] | 266 | }; |
| 267 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 268 | /* |
| 269 | * The following interface exports the OpenGL entry points used by the system. |
| 270 | * Use of OpenGL calls is disallowed. All calls should be invoked through |
| 271 | * the global instance of this struct, defined above. |
| 272 | * |
| 273 | * IMPORTANT NOTE: The OpenGL entry points exposed here include both core GL |
| 274 | * functions, and extensions. The system assumes that the address of the |
| 275 | * extension pointer will be valid across contexts. |
| 276 | */ |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 277 | struct GR_API GrGLInterface : public GrRefCnt { |
| 278 | |
| 279 | GrGLInterface(); |
| 280 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 281 | bool validate(GrEngine engine) const; |
bsalomon@google.com | 0b77d68 | 2011-08-19 13:28:54 +0000 | [diff] [blame] | 282 | bool supportsDesktop() const { |
| 283 | return 0 != (kDesktop_GrGLBinding & fBindingsExported); |
| 284 | } |
| 285 | bool supportsES1() const { |
| 286 | return 0 != (kES1_GrGLBinding & fBindingsExported); |
| 287 | } |
| 288 | bool supportsES2() const { |
| 289 | return 0 != (kES2_GrGLBinding & fBindingsExported); |
| 290 | } |
| 291 | bool supportsES() const { |
| 292 | return 0 != ((kES1_GrGLBinding | kES2_GrGLBinding) & |
| 293 | fBindingsExported); |
| 294 | } |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 295 | |
twiz@google.com | b65e0cb | 2011-03-18 20:41:44 +0000 | [diff] [blame] | 296 | // Indicator variable specifying the type of GL implementation |
| 297 | // exported: GLES{1|2} or Desktop. |
| 298 | GrGLBinding fBindingsExported; |
| 299 | |
tomhudson@google.com | 747bf29 | 2011-06-14 18:16:52 +0000 | [diff] [blame] | 300 | /// Does this GL support NPOT textures on FBOs? |
tomhudson@google.com | e67bd3f | 2011-06-16 14:08:04 +0000 | [diff] [blame] | 301 | /// boolean value, or kProbe_GrGLCapability to probe (slowly) at context creation. |
tomhudson@google.com | 747bf29 | 2011-06-14 18:16:52 +0000 | [diff] [blame] | 302 | int fNPOTRenderTargetSupport; |
| 303 | |
| 304 | /// Some GL implementations (PowerVR SGX devices like the iPhone 4) |
| 305 | /// have restrictions on the size of small render targets. |
tomhudson@google.com | e67bd3f | 2011-06-16 14:08:04 +0000 | [diff] [blame] | 306 | /// kProbe_GrGLCapability to probe (slowly) at context creation. |
tomhudson@google.com | 747bf29 | 2011-06-14 18:16:52 +0000 | [diff] [blame] | 307 | int fMinRenderTargetHeight; |
| 308 | int fMinRenderTargetWidth; |
| 309 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 310 | GrGLActiveTextureProc fActiveTexture; |
| 311 | GrGLAttachShaderProc fAttachShader; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 312 | GrGLBeginQueryProc fBeginQuery; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 313 | GrGLBindAttribLocationProc fBindAttribLocation; |
| 314 | GrGLBindBufferProc fBindBuffer; |
bsalomon@google.com | bc5cf51 | 2011-09-21 16:21:07 +0000 | [diff] [blame] | 315 | GrGLBindFragDataLocationProc fBindFragDataLocation; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 316 | GrGLBindTextureProc fBindTexture; |
bsalomon@google.com | 080773c | 2011-03-15 19:09:25 +0000 | [diff] [blame] | 317 | GrGLBlendColorProc fBlendColor; |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 318 | GrGLBlendFuncProc fBlendFunc; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 319 | GrGLBufferDataProc fBufferData; |
| 320 | GrGLBufferSubDataProc fBufferSubData; |
| 321 | GrGLClearProc fClear; |
| 322 | GrGLClearColorProc fClearColor; |
| 323 | GrGLClearStencilProc fClearStencil; |
| 324 | GrGLClientActiveTextureProc fClientActiveTexture; |
| 325 | GrGLColor4ubProc fColor4ub; |
| 326 | GrGLColorMaskProc fColorMask; |
| 327 | GrGLColorPointerProc fColorPointer; |
| 328 | GrGLCompileShaderProc fCompileShader; |
| 329 | GrGLCompressedTexImage2DProc fCompressedTexImage2D; |
| 330 | GrGLCreateProgramProc fCreateProgram; |
| 331 | GrGLCreateShaderProc fCreateShader; |
| 332 | GrGLCullFaceProc fCullFace; |
| 333 | GrGLDeleteBuffersProc fDeleteBuffers; |
| 334 | GrGLDeleteProgramProc fDeleteProgram; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 335 | GrGLDeleteQueriesProc fDeleteQueries; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 336 | GrGLDeleteShaderProc fDeleteShader; |
| 337 | GrGLDeleteTexturesProc fDeleteTextures; |
| 338 | GrGLDepthMaskProc fDepthMask; |
| 339 | GrGLDisableProc fDisable; |
| 340 | GrGLDisableClientStateProc fDisableClientState; |
| 341 | GrGLDisableVertexAttribArrayProc fDisableVertexAttribArray; |
| 342 | GrGLDrawArraysProc fDrawArrays; |
bsalomon@google.com | d32c5f5 | 2011-08-02 19:29:03 +0000 | [diff] [blame] | 343 | GrGLDrawBufferProc fDrawBuffer; |
| 344 | GrGLDrawBuffersProc fDrawBuffers; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 345 | GrGLDrawElementsProc fDrawElements; |
| 346 | GrGLEnableProc fEnable; |
| 347 | GrGLEnableClientStateProc fEnableClientState; |
| 348 | GrGLEnableVertexAttribArrayProc fEnableVertexAttribArray; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 349 | GrGLEndQueryProc fEndQuery; |
| 350 | GrGLFinishProc fFinish; |
| 351 | GrGLFlushProc fFlush; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 352 | GrGLFrontFaceProc fFrontFace; |
| 353 | GrGLGenBuffersProc fGenBuffers; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 354 | GrGLGenQueriesProc fGenQueries; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 355 | GrGLGenTexturesProc fGenTextures; |
| 356 | GrGLGetBufferParameterivProc fGetBufferParameteriv; |
| 357 | GrGLGetErrorProc fGetError; |
| 358 | GrGLGetIntegervProc fGetIntegerv; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 359 | GrGLGetQueryObjecti64vProc fGetQueryObjecti64v; |
| 360 | GrGLGetQueryObjectivProc fGetQueryObjectiv; |
| 361 | GrGLGetQueryObjectui64vProc fGetQueryObjectui64v; |
| 362 | GrGLGetQueryObjectuivProc fGetQueryObjectuiv; |
| 363 | GrGLGetQueryivProc fGetQueryiv; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 364 | GrGLGetProgramInfoLogProc fGetProgramInfoLog; |
| 365 | GrGLGetProgramivProc fGetProgramiv; |
| 366 | GrGLGetShaderInfoLogProc fGetShaderInfoLog; |
| 367 | GrGLGetShaderivProc fGetShaderiv; |
| 368 | GrGLGetStringProc fGetString; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 369 | GrGLGetTexLevelParameterivProc fGetTexLevelParameteriv; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 370 | GrGLGetUniformLocationProc fGetUniformLocation; |
| 371 | GrGLLineWidthProc fLineWidth; |
| 372 | GrGLLinkProgramProc fLinkProgram; |
| 373 | GrGLLoadMatrixfProc fLoadMatrixf; |
| 374 | GrGLMatrixModeProc fMatrixMode; |
| 375 | GrGLPixelStoreiProc fPixelStorei; |
| 376 | GrGLPointSizeProc fPointSize; |
bsalomon@google.com | 373a663 | 2011-10-19 20:43:20 +0000 | [diff] [blame] | 377 | GrGLQueryCounterProc fQueryCounter; |
bsalomon@google.com | c49d66b | 2011-08-03 14:22:30 +0000 | [diff] [blame] | 378 | GrGLReadBufferProc fReadBuffer; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 379 | GrGLReadPixelsProc fReadPixels; |
| 380 | GrGLScissorProc fScissor; |
| 381 | GrGLShadeModelProc fShadeModel; |
| 382 | GrGLShaderSourceProc fShaderSource; |
| 383 | GrGLStencilFuncProc fStencilFunc; |
| 384 | GrGLStencilFuncSeparateProc fStencilFuncSeparate; |
| 385 | GrGLStencilMaskProc fStencilMask; |
| 386 | GrGLStencilMaskSeparateProc fStencilMaskSeparate; |
| 387 | GrGLStencilOpProc fStencilOp; |
| 388 | GrGLStencilOpSeparateProc fStencilOpSeparate; |
| 389 | GrGLTexCoordPointerProc fTexCoordPointer; |
| 390 | GrGLTexEnviProc fTexEnvi; |
| 391 | GrGLTexImage2DProc fTexImage2D; |
| 392 | GrGLTexParameteriProc fTexParameteri; |
| 393 | GrGLTexSubImage2DProc fTexSubImage2D; |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 394 | GrGLUniform1fProc fUniform1f; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 395 | GrGLUniform1iProc fUniform1i; |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 396 | GrGLUniform1fvProc fUniform1fv; |
| 397 | GrGLUniform1ivProc fUniform1iv; |
| 398 | GrGLUniform2fProc fUniform2f; |
| 399 | GrGLUniform2iProc fUniform2i; |
| 400 | GrGLUniform2fvProc fUniform2fv; |
| 401 | GrGLUniform2ivProc fUniform2iv; |
| 402 | GrGLUniform3fProc fUniform3f; |
| 403 | GrGLUniform3iProc fUniform3i; |
| 404 | GrGLUniform3fvProc fUniform3fv; |
| 405 | GrGLUniform3ivProc fUniform3iv; |
| 406 | GrGLUniform4fProc fUniform4f; |
| 407 | GrGLUniform4iProc fUniform4i; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 408 | GrGLUniform4fvProc fUniform4fv; |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 409 | GrGLUniform4ivProc fUniform4iv; |
| 410 | GrGLUniformMatrix2fvProc fUniformMatrix2fv; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 411 | GrGLUniformMatrix3fvProc fUniformMatrix3fv; |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 412 | GrGLUniformMatrix4fvProc fUniformMatrix4fv; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 413 | GrGLUseProgramProc fUseProgram; |
| 414 | GrGLVertexAttrib4fvProc fVertexAttrib4fv; |
| 415 | GrGLVertexAttribPointerProc fVertexAttribPointer; |
| 416 | GrGLVertexPointerProc fVertexPointer; |
| 417 | GrGLViewportProc fViewport; |
| 418 | |
| 419 | // FBO Extension Functions |
| 420 | GrGLBindFramebufferProc fBindFramebuffer; |
| 421 | GrGLBindRenderbufferProc fBindRenderbuffer; |
| 422 | GrGLCheckFramebufferStatusProc fCheckFramebufferStatus; |
| 423 | GrGLDeleteFramebuffersProc fDeleteFramebuffers; |
| 424 | GrGLDeleteRenderbuffersProc fDeleteRenderbuffers; |
| 425 | GrGLFramebufferRenderbufferProc fFramebufferRenderbuffer; |
| 426 | GrGLFramebufferTexture2DProc fFramebufferTexture2D; |
| 427 | GrGLGenFramebuffersProc fGenFramebuffers; |
| 428 | GrGLGenRenderbuffersProc fGenRenderbuffers; |
bsalomon@google.com | cee661a | 2011-07-26 12:32:36 +0000 | [diff] [blame] | 429 | GrGLGetFramebufferAttachmentParameterivProc fGetFramebufferAttachmentParameteriv; |
| 430 | GrGLGetRenderbufferParameterivProc fGetRenderbufferParameteriv; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 431 | GrGLRenderbufferStorageProc fRenderbufferStorage; |
| 432 | |
| 433 | // Multisampling Extension Functions |
| 434 | // same prototype for ARB_FBO, EXT_FBO, GL 3.0, & Apple ES extension |
| 435 | GrGLRenderbufferStorageMultisampleProc fRenderbufferStorageMultisample; |
| 436 | // desktop: ext_fbo_blit, arb_fbo, gl 3.0 |
| 437 | GrGLBlitFramebufferProc fBlitFramebuffer; |
| 438 | // apple's es extension |
| 439 | GrGLResolveMultisampleFramebufferProc fResolveMultisampleFramebuffer; |
| 440 | |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 441 | // Buffer mapping (extension in ES). |
| 442 | GrGLMapBufferProc fMapBuffer; |
| 443 | GrGLUnmapBufferProc fUnmapBuffer; |
bsalomon@google.com | f987d1b | 2011-04-04 17:13:52 +0000 | [diff] [blame] | 444 | |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 445 | // Dual Source Blending |
| 446 | GrGLBindFragDataLocationIndexedProc fBindFragDataLocationIndexed; |
| 447 | |
bsalomon@google.com | 56bfc5a | 2011-09-01 13:28:16 +0000 | [diff] [blame] | 448 | // Per-GL func callback |
| 449 | #if GR_GL_PER_GL_FUNC_CALLBACK |
| 450 | GrGLInterfaceCallbackProc fCallback; |
| 451 | GrGLInterfaceCallbackData fCallbackData; |
| 452 | #endif |
| 453 | |
bsalomon@google.com | bf2a469 | 2011-05-04 12:35:39 +0000 | [diff] [blame] | 454 | private: |
| 455 | bool validateShaderFunctions() const; |
| 456 | bool validateFixedFunctions() const; |
| 457 | }; |
twiz@google.com | 59a190b | 2011-03-14 21:23:01 +0000 | [diff] [blame] | 458 | |
| 459 | #endif |