diff options
author | 2012-05-07 17:09:37 +0000 | |
---|---|---|
committer | 2012-05-07 17:09:37 +0000 | |
commit | 9c1f1ac5d399c73f5f331bdf7b392ea7f0c44daf (patch) | |
tree | ef55b84bceb9039ecd7ac7da54e3efac35d15e64 /src/gpu/gl/GrGLUtil.h | |
parent | aa99c9e85fb5b27e3373cf4fd72bf7e47b37a2ec (diff) |
Move function decls and macros out of public headers that are meant for internal use.
git-svn-id: http://skia.googlecode.com/svn/trunk@3849 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGLUtil.h')
-rw-r--r-- | src/gpu/gl/GrGLUtil.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h new file mode 100644 index 0000000000..4b89301005 --- /dev/null +++ b/src/gpu/gl/GrGLUtil.h @@ -0,0 +1,81 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrGLUtil_DEFINED +#define GrGLUtil_DEFINED + +#include "gl/GrGLInterface.h" +#include "GrGLDefines.h" + +//////////////////////////////////////////////////////////////////////////////// + +typedef uint32_t GrGLVersion; +typedef uint32_t GrGLSLVersion; + +#define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ + static_cast<int>(minor)) +#define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ + static_cast<int>(minor)) + +//////////////////////////////////////////////////////////////////////////////// + +/** + * Some drivers want the var-int arg to be zero-initialized on input. + */ +#define GR_GL_INIT_ZERO 0 +#define GR_GL_GetIntegerv(gl, e, p) \ + do { \ + *(p) = GR_GL_INIT_ZERO; \ + GR_GL_CALL(gl, GetIntegerv(e, p)); \ + } while (0) + +#define GR_GL_GetFramebufferAttachmentParameteriv(gl, t, a, pname, p) \ + do { \ + *(p) = GR_GL_INIT_ZERO; \ + GR_GL_CALL(gl, GetFramebufferAttachmentParameteriv(t, a, pname, p)); \ + } while (0) + +#define GR_GL_GetRenderbufferParameteriv(gl, t, pname, p) \ + do { \ + *(p) = GR_GL_INIT_ZERO; \ + GR_GL_CALL(gl, GetRenderbufferParameteriv(t, pname, p)); \ + } while (0) +#define GR_GL_GetTexLevelParameteriv(gl, t, l, pname, p) \ + do { \ + *(p) = GR_GL_INIT_ZERO; \ + GR_GL_CALL(gl, GetTexLevelParameteriv(t, l, pname, p)); \ + } while (0) + +//////////////////////////////////////////////////////////////////////////////// + +/** + * Helpers for glGetString() + */ + +// these variants assume caller already has a string from glGetString() +GrGLVersion GrGLGetVersionFromString(const char* versionString); +GrGLBinding GrGLGetBindingInUseFromString(const char* versionString); +GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString); +bool GrGLHasExtensionFromString(const char* ext, const char* extensionString); + +// these variants call glGetString() +bool GrGLHasExtension(const GrGLInterface*, const char* ext); +GrGLBinding GrGLGetBindingInUse(const GrGLInterface*); +GrGLVersion GrGLGetVersion(const GrGLInterface*); +GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*); + +/** + * Helpers for glGetError() + */ + +extern void GrGLCheckErr(const GrGLInterface* gl, + const char* location, + const char* call); + +extern void GrGLClearErr(const GrGLInterface* gl); + +#endif |