diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-20 16:32:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-20 16:32:22 +0300 |
commit | dcd7364559e20e7d89ffeee0740b60a65c8d5362 (patch) | |
tree | d53978130f4b5121041a1e0ef22afebee69e6f6b /src/render/opengl | |
parent | 45561c45f374cf8511b755da74c1786be6a3f85c (diff) | |
download | ManaVerse-dcd7364559e20e7d89ffeee0740b60a65c8d5362.tar.gz ManaVerse-dcd7364559e20e7d89ffeee0740b60a65c8d5362.tar.bz2 ManaVerse-dcd7364559e20e7d89ffeee0740b60a65c8d5362.tar.xz ManaVerse-dcd7364559e20e7d89ffeee0740b60a65c8d5362.zip |
Move OpenGL functions related files into opengl directory.
Diffstat (limited to 'src/render/opengl')
-rw-r--r-- | src/render/opengl/mgl.cpp | 32 | ||||
-rw-r--r-- | src/render/opengl/mgl.h | 38 | ||||
-rw-r--r-- | src/render/opengl/mgl.hpp | 141 | ||||
-rw-r--r-- | src/render/opengl/mglcheck.h | 31 | ||||
-rw-r--r-- | src/render/opengl/mgldefines.h | 131 | ||||
-rw-r--r-- | src/render/opengl/mglemu.cpp | 47 | ||||
-rw-r--r-- | src/render/opengl/mglemu.h | 41 | ||||
-rw-r--r-- | src/render/opengl/mglfunctions.h | 99 | ||||
-rw-r--r-- | src/render/opengl/mgltypes.h | 209 | ||||
-rw-r--r-- | src/render/opengl/naclglfunctions.h | 322 | ||||
-rw-r--r-- | src/render/opengl/opengldebug.h | 36 |
11 files changed, 1127 insertions, 0 deletions
diff --git a/src/render/opengl/mgl.cpp b/src/render/opengl/mgl.cpp new file mode 100644 index 000000000..d60c8c1f6 --- /dev/null +++ b/src/render/opengl/mgl.cpp @@ -0,0 +1,32 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "render/opengl/mgl.h" + +#ifdef USE_OPENGL + +#include "debug.h" + +#define defName(name) name##_t m##name = nullptr + +// include function defines +#include "render/opengl/mgl.hpp" + +#endif diff --git a/src/render/opengl/mgl.h b/src/render/opengl/mgl.h new file mode 100644 index 000000000..626e88d13 --- /dev/null +++ b/src/render/opengl/mgl.h @@ -0,0 +1,38 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGLMGL_H +#define RENDER_OPENGLMGL_H + +#include "main.h" + +#ifdef USE_OPENGL + +#include "render/opengl/mgldefines.h" +#include "render/opengl/mgltypes.h" + +#define defName(name) extern name##_t m##name + +#include "render/opengl/mgl.hpp" + +#undef defName + +#endif // USE_OPENGL +#endif // RENDER_OPENGLMGL_H diff --git a/src/render/opengl/mgl.hpp b/src/render/opengl/mgl.hpp new file mode 100644 index 000000000..edf3882cf --- /dev/null +++ b/src/render/opengl/mgl.hpp @@ -0,0 +1,141 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +defName(glGenRenderbuffers); +defName(glBindRenderbuffer); +defName(glRenderbufferStorage); +defName(glGenFramebuffers); +defName(glBindFramebuffer); +defName(glFramebufferTexture2D); +defName(glFramebufferRenderbuffer); +defName(glDeleteFramebuffers); +defName(glDeleteRenderbuffers); +defName(glGetStringi); +defName(glGenSamplers); +defName(glDeleteSamplers); +defName(glBindSampler); +defName(glSamplerParameteri); +defName(glDebugMessageControl); +defName(glDebugMessageCallback); +defName(glFrameTerminator); +defName(glLabelObject); +defName(glGetObjectLabel); +defName(glInsertEventMarker); +defName(glPushGroupMarker); +defName(glPopGroupMarker); +defName(glGenVertexArrays); +defName(glBindVertexArray); +defName(glDeleteVertexArrays); +defName(glDisableVertexAttribArray); +defName(glDeleteShader); +defName(glGetShaderInfoLog); +defName(glGetShaderSource); +defName(glDetachShader); +defName(glGetAttachedShaders); +defName(glGetActiveUniform); +defName(glBindFragDataLocation); +#ifndef __native_client__ +defName(glDeleteProgram); +defName(glCreateProgram); +defName(glGetProgramiv); +defName(glLinkProgram); +defName(glAttachShader); +defName(glGetShaderiv); +defName(glCompileShader); +defName(glShaderSource); +defName(glCreateShader); +defName(glGetUniformLocation); +defName(glGenBuffers); +defName(glDeleteBuffers); +defName(glBindBuffer); +defName(glBufferData); +defName(glEnableVertexAttribArray); +defName(glVertexAttribPointer); +defName(glUseProgram); +defName(glUniform1f); +defName(glUniform2f); +defName(glUniform4f); +defName(glValidateProgram); +defName(glGetProgramInfoLog); +defName(glBindAttribLocation); +defName(glActiveTexture); + +#define mglDrawArrays(...) \ + glDrawArrays(__VA_ARGS__) +#define mglDisable(...) \ + glDisable(__VA_ARGS__) +#define mglHint(...) \ + glHint(__VA_ARGS__) +#define mglScissor(...) \ + glScissor(__VA_ARGS__) +#define mglEnable(...) \ + glEnable(__VA_ARGS__) +#define mglBindTexture(...) \ + glBindTexture(__VA_ARGS__) +#define mglGetIntegerv(...) \ + glGetIntegerv(__VA_ARGS__) +#define mglClear(...) \ + glClear(__VA_ARGS__) +#define mglGetString(...) \ + glGetString(__VA_ARGS__) +#define mglTexParameteri(...) \ + glTexParameteri(__VA_ARGS__) +#define mglTexImage2D(...) \ + glTexImage2D(__VA_ARGS__) +#define mglGenTextures(...) \ + glGenTextures(__VA_ARGS__) +#define mglPixelStorei(...) \ + glPixelStorei(__VA_ARGS__) +#define mglReadPixels(...) \ + glReadPixels(__VA_ARGS__) + +#endif +defName(glGetAttribLocation); +defName(glUniform3f); +defName(glCheckFramebufferStatus); +defName(glProgramUniform1f); +defName(glProgramUniform2f); +defName(glProgramUniform3f); +defName(glProgramUniform4f); +defName(glBindVertexBuffer); +defName(glVertexAttribBinding); +defName(glVertexAttribFormat); +defName(glBindVertexBuffers); +defName(glIsBuffer); +defName(glVertexAttribIFormat); +defName(glVertexAttribIPointer); +defName(glInvalidateTexImage); +defName(glCopyImageSubData); +defName(glPushDebugGroup); +defName(glPopDebugGroup); +defName(glObjectLabel); +defName(glTexStorage2D); +defName(glGenQueries); +defName(glBeginQuery); +defName(glEndQuery); +defName(glDeleteQueries); +defName(glGetQueryObjectiv); +defName(glGetQueryObjectui64v); +defName(glTextureSubImage2D); +defName(glClearTexImage); +defName(glClearTexSubImage); +#ifdef WIN32 +defName(wglGetExtensionsString); +#endif diff --git a/src/render/opengl/mglcheck.h b/src/render/opengl/mglcheck.h new file mode 100644 index 000000000..3c7cdc73c --- /dev/null +++ b/src/render/opengl/mglcheck.h @@ -0,0 +1,31 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_MGLCHECK_H +#define RENDER_OPENGL_MGLCHECK_H + +#include "main.h" +#ifdef USE_OPENGL + +#define isGLNull(func) (!(func)) +#define isGLNotNull(func) ((func) != nullptr) + +#endif // USE_OPENGL +#endif // RENDER_OPENGL_MGLCHECK_H diff --git a/src/render/opengl/mgldefines.h b/src/render/opengl/mgldefines.h new file mode 100644 index 000000000..4cf0b05d5 --- /dev/null +++ b/src/render/opengl/mgldefines.h @@ -0,0 +1,131 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_MGLDEFINES_H +#define RENDER_OPENGL_MGLDEFINES_H + +#ifdef USE_OPENGL + +#ifndef GL_NUM_EXTENSIONS +#define GL_NUM_EXTENSIONS 0x821D +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#endif + +#ifndef GL_COMPRESSED_RGBA_ARB +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif +#ifndef GL_MAX_ELEMENTS_VERTICES +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#endif + +#ifndef GL_DEBUG_OUTPUT +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826a +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#endif + +#ifndef GL_EXT_debug_label +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#endif + +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#endif + +#ifndef GL_STREAM_DRAW +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 +#endif + +#ifndef GL_COMPILE_STATUS +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#endif + +#ifndef GL_DEPTH_CLAMP +#define GL_DEPTH_CLAMP 0x864F +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_SAMPLE_MASK 0x8E51 +#endif + +#ifndef GL_POLYGON_SMOOTH +#define GL_POLYGON_SMOOTH 0x0B41 +#endif + +#ifndef GL_DEPTH_BOUNDS_TEST_EXT +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#endif + +#ifndef GL_TEXTURE_COMPRESSION_HINT_ARB +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#endif + +#ifndef GLX_CONTEXT_PROFILE_MASK_ARB +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#endif + +#ifndef GLX_CONTEXT_MAJOR_VERSION_ARB +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#endif + +#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM_ARB +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#endif + +#endif // USE_OPENGL + +#endif // RENDER_OPENGL_MGLDEFINES_H diff --git a/src/render/opengl/mglemu.cpp b/src/render/opengl/mglemu.cpp new file mode 100644 index 000000000..347180f2d --- /dev/null +++ b/src/render/opengl/mglemu.cpp @@ -0,0 +1,47 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifdef USE_OPENGL + +#include "render/opengl/mglemu.h" + +#include "resources/openglimagehelper.h" + +#include "debug.h" + +void APIENTRY emuglTextureSubImage2D(GLuint texture, GLenum target, + GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const void *pixels) +{ + OpenGLImageHelper::bindTexture(texture); + glTexSubImage2D(target, level, + xoffset, yoffset, + width, height, + format, type, pixels); +} + +void APIENTRY emuglActiveTexture(GLenum texture A_UNUSED) +{ +} + +#endif diff --git a/src/render/opengl/mglemu.h b/src/render/opengl/mglemu.h new file mode 100644 index 000000000..f55f81013 --- /dev/null +++ b/src/render/opengl/mglemu.h @@ -0,0 +1,41 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_MGLEMU_H +#define RENDER_OPENGL_MGLEMU_H +#ifdef USE_OPENGL + +#include "render/opengl/mgltypes.h" + +void APIENTRY emuglTextureSubImage2D(GLuint texture, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels); + +void APIENTRY emuglActiveTexture(GLenum texture); + +#endif // USE_OPENGL +#endif // RENDER_OPENGL_MGLEMU_H diff --git a/src/render/opengl/mglfunctions.h b/src/render/opengl/mglfunctions.h new file mode 100644 index 000000000..faf8e9300 --- /dev/null +++ b/src/render/opengl/mglfunctions.h @@ -0,0 +1,99 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_MGLFUNCTIONS_H +#define RENDER_OPENGL_MGLFUNCTIONS_H + +#ifdef USE_OPENGL + +#include "logger.h" + +#ifdef WIN32 +#define getFunction(name) wglGetProcAddress(name) +#elif defined ANDROID +#define getFunction(name) eglGetProcAddress(name) +#elif defined __APPLE__ +#define getFunction(name) nullptr +#elif defined __native_client__ +#define getFunction(name) glGetProcAddressREGAL(name) +#else +#define getFunction(name) glXGetProcAddress(\ + reinterpret_cast<const GLubyte*>(name)) +#endif + +#define assignFunction(func) \ + { \ + m##func = reinterpret_cast<func##_t>(getFunction(#func)); \ + if (m##func == nullptr) \ + logger->log("function not found: " #func); \ + else \ + logger->log("assigned function: " #func); \ + } + +#define assignFunction3(func, ext) \ + { \ + m##func = reinterpret_cast<func##_t>(getFunction(#func#ext)); \ + if (m##func == nullptr) \ + { \ + logger->log("function not found: " #func#ext); \ + m##func = reinterpret_cast<func##_t>(getFunction(#func)); \ + if (m##func == nullptr) \ + logger->log("function not found: " #func); \ + else \ + logger->log("assigned function: " #func); \ + } \ + else \ + { \ + logger->log("assigned function: " #func#ext); \ + } \ + } + +#define assignFunctionARB(func) assignFunction3(func, ARB) + +#define assignFunctionEXT(func) assignFunction3(func, EXT) + +#define assignFunction2(func, name) \ + { \ + m##func = reinterpret_cast<func##_t>(getFunction(name)); \ + if (m##func == nullptr) \ + logger->log(std::string("function not found: ") + name); \ + else \ + logger->log(std::string("assigned function: ") + name); \ + } + +#define assignFunctionEmu2(func, name) \ + { \ + m##func = reinterpret_cast<func##_t>(getFunction(name)); \ + if (m##func == nullptr) \ + { \ + m##func = emu##func; \ + logger->log(std::string("emulated function: ") + name); \ + } \ + else \ + { \ + logger->log(std::string("assigned function: ") + name); \ + } \ + } + +#define emulateFunction(func) m##func = emu##func; \ + logger->log("emulated function: " #func) + +#endif // USE_OPENGL +#endif // RENDER_OPENGL_MGLFUNCTIONS_H diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h new file mode 100644 index 000000000..5969dbeec --- /dev/null +++ b/src/render/opengl/mgltypes.h @@ -0,0 +1,209 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_MGLTYPES_H +#define RENDER_OPENGL_MGLTYPES_H + +#include "main.h" + +#ifdef USE_OPENGL + +#include "render/opengl/mgldefines.h" + +#ifdef ANDROID +#include <GLES/gl.h> +#include <GLES/glext.h> +#define APIENTRY GL_APIENTRY +#else +#ifndef USE_SDL2 +#define GL_GLEXT_PROTOTYPES 1 +#endif +#include <SDL_opengl.h> +#ifdef __native_client__ +#include <GL/Regal.h> +#else +#include <GL/glext.h> +#endif +#endif + +#if defined(__GXX_EXPERIMENTAL_CXX0X__) +#include <cstdint> +#else +#include <stdint.h> +#endif + +typedef void (APIENTRY *glGenRenderbuffers_t)(GLsizei, GLuint *); +typedef void (APIENTRY *glBindRenderbuffer_t)(GLenum target, + GLuint renderbuffer); +typedef void (APIENTRY *glRenderbufferStorage_t)(GLenum target, + GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRY *glGenFramebuffers_t)(GLsizei n, GLuint *framebuffers); +typedef void (APIENTRY *glBindFramebuffer_t)(GLenum target, + GLuint framebuffer); +typedef void (APIENTRY *glFramebufferTexture2D_t)(GLenum target, + GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRY *glFramebufferRenderbuffer_t)(GLenum target, + GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRY *glDeleteFramebuffers_t) (GLsizei, const GLuint *); +typedef void (APIENTRY *glDeleteRenderbuffers_t) (GLsizei, const GLuint *); +typedef const GLubyte *(APIENTRY *glGetStringi_t) (GLenum, GLuint); +typedef void (APIENTRY *glGenSamplers_t) (GLsizei count, GLuint *samplers); +typedef void (APIENTRY *glDeleteSamplers_t) + (GLsizei count, const GLuint * samplers); +typedef void (APIENTRY *glBindSampler_t) (GLuint unit, GLuint sampler); +typedef void (APIENTRY *glSamplerParameteri_t) + (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRY *glDebugMessageControl_t) (GLenum source, GLenum type, + GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); +typedef void (APIENTRY *glFrameTerminator_t) (void); +typedef void (APIENTRY *glLabelObject_t) (GLenum type, GLuint object, + GLsizei length, const GLchar *label); +typedef void (APIENTRY *glGetObjectLabel_t) (GLenum type, GLuint object, + GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRY *glInsertEventMarker_t) + (GLsizei length, const char *marker); +typedef void (APIENTRY *glPushGroupMarker_t) + (GLsizei length, const char *marker); +typedef void (APIENTRY *glPopGroupMarker_t) (void); +typedef void (APIENTRY *glGenVertexArrays_t) (GLsizei n, GLuint *arrays); +typedef void (APIENTRY *glBindVertexArray_t) (GLuint array); +typedef void (APIENTRY *glDeleteVertexArrays_t) (GLsizei n, GLuint *arrays); +typedef void (APIENTRY *glDisableVertexAttribArray_t) (GLuint index); +typedef void (APIENTRY *glDeleteShader_t) (GLenum shader); +typedef void (APIENTRY *glGetShaderInfoLog_t) (GLuint shader, + GLsizei maxLength, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRY *glGetShaderSource_t) (GLuint shader, + GLsizei bufSize, GLsizei *length, GLchar *source); +typedef void (APIENTRY *glDetachShader_t) (GLuint program, GLuint shader); +typedef void (APIENTRY *glGetAttachedShaders_t) (GLuint program, + GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef void (APIENTRY *glGetActiveUniform_t) (GLuint program, GLuint index, + GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef GLint (APIENTRY *glBindFragDataLocation_t) (GLuint program, + GLuint colorNumber, const char *name); +#ifndef __native_client__ +typedef void (APIENTRY *glDeleteProgram_t) (GLuint program); +typedef GLuint (APIENTRY *glCreateProgram_t) (void); +typedef void (APIENTRY *glGetProgramiv_t) (GLuint program, + GLenum pname, GLint *params); +typedef void (APIENTRY *glLinkProgram_t) (GLuint program); +typedef void (APIENTRY *glAttachShader_t) (GLuint program, GLuint shader); +typedef void (APIENTRY *glGetShaderiv_t) (GLuint shader, + GLenum pname, GLint *params); +typedef void (APIENTRY *glCompileShader_t) (GLuint shader); +typedef void (APIENTRY *glShaderSource_t) (GLuint shader, + GLsizei count, const GLchar **string, const GLint *length); +typedef GLuint (APIENTRY *glCreateShader_t) (GLenum shaderType); +typedef GLint (APIENTRY *glGetUniformLocation_t) (GLuint program, + const GLchar *name); +typedef void (APIENTRY *glGenBuffers_t) (GLsizei n, GLuint *buffers); +typedef void (APIENTRY *glDeleteBuffers_t) (GLsizei n, GLuint *buffers); +typedef void (APIENTRY *glBindBuffer_t) (GLenum target, GLuint buffer); +typedef void (APIENTRY *glBufferData_t) (GLenum target, GLsizeiptr size, + const GLvoid *data, GLenum usage); +typedef void (APIENTRY *glEnableVertexAttribArray_t) (GLuint index); +typedef void (APIENTRY *glVertexAttribPointer_t) (GLuint index, GLint size, + GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRY *glUseProgram_t) (GLuint program); +typedef void (APIENTRY *glUniform1f_t) (GLint location, GLfloat v0); +typedef void (APIENTRY *glUniform2f_t) (GLint location, + GLfloat v0, GLfloat v1); +typedef void (APIENTRY *glUniform4f_t) (GLint location, + GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRY *glValidateProgram_t) (GLuint program); +typedef void (APIENTRY *glGetProgramInfoLog_t) (GLuint program, + GLsizei maxLength, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRY *glBindAttribLocation_t) (GLuint program, + GLuint index, const GLchar *name); +typedef void (APIENTRY *glActiveTexture_t) (GLenum texture); +#endif +typedef GLint (APIENTRY *glGetAttribLocation_t) (GLuint program, + const GLchar *name); +typedef void (APIENTRY *glUniform3f_t) (GLint location, + GLfloat v0, GLfloat v1, GLfloat v2); +typedef GLenum (APIENTRY *glCheckFramebufferStatus_t) (GLenum target); +typedef void (APIENTRY *glProgramUniform1f_t) (GLuint program, + GLint location, GLfloat v0); +typedef void (APIENTRY *glProgramUniform2f_t) (GLuint program, + GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRY *glProgramUniform3f_t) (GLuint program, + GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRY *glProgramUniform4f_t) (GLuint program, + GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRY *glBindVertexBuffer_t) (GLuint bindingindex, + GLuint buffer, GLintptr offset, GLintptr stride); +typedef void (APIENTRY *glVertexAttribBinding_t) (GLuint attribindex, + GLuint bindingindex); +typedef void (APIENTRY *glVertexAttribFormat_t) (GLuint attribindex, + GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRY *glBindVertexBuffers_t) (GLuint first, GLsizei count, + const GLuint *buffers, const GLuint *offsets, const GLsizei *strides); +typedef GLboolean (APIENTRY *glIsBuffer_t) (GLuint buffer); +typedef void (APIENTRY *glVertexAttribIFormat_t) (GLuint attribindex, + GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRY *glVertexAttribIPointer_t) (GLuint index, GLint size, + GLenum type, GLsizei stride, const GLvoid * pointer); +typedef void (APIENTRY *glInvalidateTexImage_t) (GLuint texture, GLint level); +typedef void (APIENTRY *glCopyImageSubData_t) (GLuint srcName, + GLenum srcTarget, GLint srcLevel, + GLint srcX, GLint srcY, GLint srcZ, + GLuint dstName, GLenum dstTarget, GLint dstLevel, + GLint dstX, GLint dstY, GLint dstZ, + GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRY *glPushDebugGroup_t) (GLenum source, GLuint id, + GLsizei length, const GLchar * message); +typedef void (APIENTRY *glPopDebugGroup_t) (void); +typedef void (APIENTRY *glObjectLabel_t) (GLenum identifier, GLuint name, + GLsizei length, const GLchar *label); +typedef void (APIENTRY *glTexStorage2D_t) (GLenum target, GLsizei levels, + GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRY *glGenQueries_t) (GLsizei n, GLuint *ids); +typedef void (APIENTRY *glBeginQuery_t) (GLenum target, GLuint id); +typedef void (APIENTRY *glEndQuery_t) (GLenum target); +typedef void (APIENTRY *glDeleteQueries_t) (GLsizei n, const GLuint *ids); +typedef void (APIENTRY *glGetQueryObjectiv_t) (GLuint id, + GLenum pname, GLint *params); +typedef void (APIENTRY *glGetQueryObjectui64v_t) (GLuint id, + GLenum pname, uint64_t *params); +typedef void (APIENTRY *glTextureSubImage2D_t) (GLuint texture, GLenum target, + GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRY *glClearTexImage_t) (GLuint texture, GLint level, + GLenum format, GLenum type, const void * data); +typedef void (APIENTRY *glClearTexSubImage_t) (GLuint texture, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, + GLsizei depth, GLenum format, GLenum type, const void * data); + +// callback +typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam); + +typedef void (APIENTRY *glDebugMessageCallback_t) (GLDEBUGPROC_t callback, + const void *userParam); + + +#ifdef WIN32 +typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc); +#else +#define CALLBACK +#endif + +#endif // USE_OPENGL +#endif // RENDER_OPENGL_MGLTYPES_H diff --git a/src/render/opengl/naclglfunctions.h b/src/render/opengl/naclglfunctions.h new file mode 100644 index 000000000..d1dad707b --- /dev/null +++ b/src/render/opengl/naclglfunctions.h @@ -0,0 +1,322 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_NACLGLFUNCTIONS_H +#define RENDER_OPENGL_NACLGLFUNCTIONS_H + +#if defined(__native_client__) && defined(USE_OPENGL) + +#include <ppapi/c/ppb_opengles2.h> + +extern const struct PPB_OpenGLES2* gles2Interface; +extern PP_Resource gles2Context; + +#define mglDrawArrays(...) \ + gles2Interface->DrawArrays(gles2Context, __VA_ARGS__) +#define mglEnableVertexAttribArray(...) \ + gles2Interface->EnableVertexAttribArray(gles2Context, __VA_ARGS__) +#define mglVertexAttribPointer(...) \ + gles2Interface->VertexAttribPointer(gles2Context, __VA_ARGS__) +#define mglUseProgram(...) \ + gles2Interface->UseProgram(gles2Context, __VA_ARGS__) +#define mglViewport(...) \ + gles2Interface->Viewport(gles2Context, __VA_ARGS__) +#define mglGenBuffers(...) \ + gles2Interface->GenBuffers(gles2Context, __VA_ARGS__) +#define mglBindBuffer(...) \ + gles2Interface->BindBuffer(gles2Context, __VA_ARGS__) +#define mglBufferData(...) \ + gles2Interface->BufferData(gles2Context, __VA_ARGS__) +#define mglDeleteBuffers(...) \ + gles2Interface->DeleteBuffers(gles2Context, __VA_ARGS__) +#define mglGetUniformLocation(...) \ + gles2Interface->GetUniformLocation(gles2Context, __VA_ARGS__) +#define mglCreateShader(...) \ + gles2Interface->CreateShader(gles2Context, __VA_ARGS__) +#define mglShaderSource(...) \ + gles2Interface->ShaderSource(gles2Context, __VA_ARGS__) +#define mglCompileShader(...) \ + gles2Interface->CompileShader(gles2Context, __VA_ARGS__) +#define mglGetShaderiv(...) \ + gles2Interface->GetShaderiv(gles2Context, __VA_ARGS__) +#define mglAttachShader(...) \ + gles2Interface->AttachShader(gles2Context, __VA_ARGS__) +#define mglBindAttribLocation(...) \ + gles2Interface->BindAttribLocation(gles2Context, __VA_ARGS__) +#define mglLinkProgram(...) \ + gles2Interface->LinkProgram(gles2Context, __VA_ARGS__) +#define mglGetProgramiv(...) \ + gles2Interface->GetProgramiv(gles2Context, __VA_ARGS__) +#define mglClearColor(...) \ + gles2Interface->ClearColor(gles2Context, __VA_ARGS__) +#define mglUniform1f(...) \ + gles2Interface->Uniform1f(gles2Context, __VA_ARGS__) +#define mglUniform2f(...) \ + gles2Interface->Uniform2f(gles2Context, __VA_ARGS__) +#define mglUniform3f(...) \ + gles2Interface->Uniform3f(gles2Context, __VA_ARGS__) +#define mglUniform4f(...) \ + gles2Interface->Uniform4f(gles2Context, __VA_ARGS__) +#define mglUniform1i(...) \ + gles2Interface->Uniform1i(gles2Context, __VA_ARGS__) +#define mglUniform2i(...) \ + gles2Interface->Uniform2i(gles2Context, __VA_ARGS__) +#define mglUniform3i(...) \ + gles2Interface->Uniform3i(gles2Context, __VA_ARGS__) +#define mglUniform4i(...) \ + gles2Interface->Uniform4i(gles2Context, __VA_ARGS__) +#define mglUniform1fv(...) \ + gles2Interface->Uniform1fv(gles2Context, __VA_ARGS__) +#define mglUniform2fv(...) \ + gles2Interface->Uniform2fv(gles2Context, __VA_ARGS__) +#define mglUniform3fv(...) \ + gles2Interface->Uniform3fv(gles2Context, __VA_ARGS__) +#define mglUniform4fv(...) \ + gles2Interface->Uniform4fv(gles2Context, __VA_ARGS__) +#define mglUniform1iv(...) \ + gles2Interface->Uniform1iv(gles2Context, __VA_ARGS__) +#define mglUniform2iv(...) \ + gles2Interface->Uniform2iv(gles2Context, __VA_ARGS__) +#define mglUniform3iv(...) \ + gles2Interface->Uniform3iv(gles2Context, __VA_ARGS__) +#define mglUniform4iv(...) \ + gles2Interface->Uniform4iv(gles2Context, __VA_ARGS__) +#define mglActiveTexture(...) \ + gles2Interface->ActiveTexture(gles2Context, __VA_ARGS__) +#define mglBindTexture(...) \ + gles2Interface->BindTexture(gles2Context, __VA_ARGS__) +#define mglEnable(...) \ + gles2Interface->Enable(gles2Context, __VA_ARGS__) +#define mglClear(...) \ + gles2Interface->Clear(gles2Context, __VA_ARGS__) +#define mglValidateProgram(...) \ + gles2Interface->ValidateProgram(gles2Context, __VA_ARGS__) +#define mglDeleteProgram(...) \ + gles2Interface->DeleteProgram(gles2Context, __VA_ARGS__) +#define mglCreateProgram() \ + gles2Interface->CreateProgram(gles2Context) +#define mglGetProgramInfoLog(...) \ + gles2Interface->GetProgramInfoLog(gles2Context, __VA_ARGS__) +#define mglDisable(...) \ + gles2Interface->Disable(gles2Context, __VA_ARGS__) +#define mglHint(...) \ + gles2Interface->Hint(gles2Context, __VA_ARGS__) +#define mglScissor(...) \ + gles2Interface->Scissor(gles2Context, __VA_ARGS__) +#define mglEnable(...) \ + gles2Interface->Enable(gles2Context, __VA_ARGS__) +#define mglGetIntegerv(...) \ + gles2Interface->GetIntegerv(gles2Context, __VA_ARGS__) +#define mglGetString(...) \ + gles2Interface->GetString(gles2Context, __VA_ARGS__) +#define mglBindFramebuffer(...) \ + gles2Interface->BindFramebuffer(gles2Context, __VA_ARGS__) +#define mglBindRenderbuffer(...) \ + gles2Interface->BindRenderbuffer(gles2Context, __VA_ARGS__) +#define mglBlendColor(...) \ + gles2Interface->BlendColor(gles2Context, __VA_ARGS__) +#define mglBlendEquation(...) \ + gles2Interface->BlendEquation(gles2Context, __VA_ARGS__) +#define mglBlendEquationSeparate(...) \ + gles2Interface->BlendEquationSeparate(gles2Context, __VA_ARGS__) +#define mglBlendFunc(...) \ + gles2Interface->BlendFunc(gles2Context, __VA_ARGS__) +#define mglBlendFuncSeparate(...) \ + gles2Interface->BlendFuncSeparate(gles2Context, __VA_ARGS__) +#define mglBufferSubData(...) \ + gles2Interface->BufferSubData(gles2Context, __VA_ARGS__) +#define mglCheckFramebufferStatus(...) \ + gles2Interface->CheckFramebufferStatus(gles2Context, __VA_ARGS__) +#define mglClearDepthf(...) \ + gles2Interface->ClearDepthf(gles2Context, __VA_ARGS__) +#define mglClearStencil(...) \ + gles2Interface->ClearStencil(gles2Context, __VA_ARGS__) +#define mglColorMask(...) \ + gles2Interface->ColorMask(gles2Context, __VA_ARGS__) +#define mglCompressedTexImage2D(...) \ + gles2Interface->CompressedTexImage2D(gles2Context, __VA_ARGS__) +#define mglCompressedTexSubImage2D(...) \ + gles2Interface->CompressedTexSubImage2D(gles2Context, __VA_ARGS__) +#define mglCopyTexImage2D(...) \ + gles2Interface->CopyTexImage2D(gles2Context, __VA_ARGS__) +#define mglCopyTexSubImage2D(...) \ + gles2Interface->CopyTexSubImage2D(gles2Context, __VA_ARGS__) +#define mglCullFace(...) \ + gles2Interface->CullFace(gles2Context, __VA_ARGS__) +#define mglDeleteFramebuffers(...) \ + gles2Interface->DeleteFramebuffers(gles2Context, __VA_ARGS__) +#define mglDeleteRenderbuffers(...) \ + gles2Interface->DeleteRenderbuffers(gles2Context, __VA_ARGS__) +#define mglDeleteShader(...) \ + gles2Interface->DeleteShader(gles2Context, __VA_ARGS__) +#define mglDeleteTextures(...) \ + gles2Interface->DeleteTextures(gles2Context, __VA_ARGS__) +#define mglDepthFunc(...) \ + gles2Interface->DepthFunc(gles2Context, __VA_ARGS__) +#define mglDepthMask(...) \ + gles2Interface->DepthMask(gles2Context, __VA_ARGS__) +#define mglDepthRangef(...) \ + gles2Interface->DepthRangef(gles2Context, __VA_ARGS__) +#define mglDetachShader(...) \ + gles2Interface->DetachShader(gles2Context, __VA_ARGS__) +#define mglDisableVertexAttribArray(...) \ + gles2Interface->DisableVertexAttribArray(gles2Context, __VA_ARGS__) +#define mglDrawElements(...) \ + gles2Interface->DrawElements(gles2Context, __VA_ARGS__) +#define mglFinish(...) \ + gles2Interface->Finish(gles2Context, __VA_ARGS__) +#define mglFlush(...) \ + gles2Interface->Flush(gles2Context, __VA_ARGS__) +#define mglFramebufferRenderbuffer(...) \ + gles2Interface->FramebufferRenderbuffer(gles2Context, __VA_ARGS__) +#define mglFramebufferTexture2D(...) \ + gles2Interface->FramebufferTexture2D(gles2Context, __VA_ARGS__) +#define mglFrontFace(...) \ + gles2Interface->FrontFace(gles2Context, __VA_ARGS__) +#define mglGenerateMipmap(...) \ + gles2Interface->GenerateMipmap(gles2Context, __VA_ARGS__) +#define mglGenFramebuffers(...) \ + gles2Interface->GenFramebuffers(gles2Context, __VA_ARGS__) +#define mglGenRenderbuffers(...) \ + gles2Interface->GenRenderbuffers(gles2Context, __VA_ARGS__) +#define mglGenTextures(...) \ + gles2Interface->GenTextures(gles2Context, __VA_ARGS__) +#define mglGetActiveAttrib(...) \ + gles2Interface->GetActiveAttrib(gles2Context, __VA_ARGS__) +#define mglGetActiveUniform(...) \ + gles2Interface->GetActiveUniform(gles2Context, __VA_ARGS__) +#define mglGetAttachedShaders(...) \ + gles2Interface->GetAttachedShaders(gles2Context, __VA_ARGS__) +#define mglGetAttribLocation(...) \ + gles2Interface->GetAttribLocation(gles2Context, __VA_ARGS__) +#define mglGetBooleanv(...) \ + gles2Interface->GetBooleanv(gles2Context, __VA_ARGS__) +#define mglGetBufferParameteriv(...) \ + gles2Interface->GetBufferParameteriv(gles2Context, __VA_ARGS__) +#define mglGetError(...) \ + gles2Interface->GetError(gles2Context, __VA_ARGS__) +#define mglGetFloatv(...) \ + gles2Interface->GetFloatv(gles2Context, __VA_ARGS__) +#define mglGetFramebufferAttachmentParameteriv(...) \ + gles2Interface->GetFramebufferAttachmentParameteriv(gles2Context, \ + __VA_ARGS__) +#define mglGetIntegerv(...) \ + gles2Interface->GetIntegerv(gles2Context, __VA_ARGS__) +#define mglGetRenderbufferParameteriv(...) \ + gles2Interface->GetRenderbufferParameteriv(gles2Context, __VA_ARGS__) +#define mglGetShaderInfoLog(...) \ + gles2Interface->GetShaderInfoLog(gles2Context, __VA_ARGS__) +#define mglGetShaderPrecisionFormat(...) \ + gles2Interface->GetShaderPrecisionFormat(gles2Context, __VA_ARGS__) +#define mglGetShaderSource(...) \ + gles2Interface->GetShaderSource(gles2Context, __VA_ARGS__) +#define mglGetTexParameterfv(...) \ + gles2Interface->GetTexParameterfv(gles2Context, __VA_ARGS__) +#define mglGetTexParameteriv(...) \ + gles2Interface->GetTexParameteriv(gles2Context, __VA_ARGS__) +#define mglGetUniformfv(...) \ + gles2Interface->GetUniformfv(gles2Context, __VA_ARGS__) +#define mglGetUniformiv(...) \ + gles2Interface->GetUniformiv(gles2Context, __VA_ARGS__) +#define mglGetVertexAttribfv(...) \ + gles2Interface->GetVertexAttribfv(gles2Context, __VA_ARGS__) +#define mglGetVertexAttribiv(...) \ + gles2Interface->GetVertexAttribiv(gles2Context, __VA_ARGS__) +#define mglGetVertexAttribPointerv(...) \ + gles2Interface->GetVertexAttribPointerv(gles2Context, __VA_ARGS__) +#define mglIsBuffer(...) \ + gles2Interface->IsBuffer(gles2Context, __VA_ARGS__) +#define mglIsEnabled(...) \ + gles2Interface->IsEnabled(gles2Context, __VA_ARGS__) +#define mglIsFramebuffer(...) \ + gles2Interface->IsFramebuffer(gles2Context, __VA_ARGS__) +#define mglIsProgram(...) \ + gles2Interface->IsProgram(gles2Context, __VA_ARGS__) +#define mglIsRenderbuffer(...) \ + gles2Interface->IsRenderbuffer(gles2Context, __VA_ARGS__) +#define mglIsShader(...) \ + gles2Interface->IsShader(gles2Context, __VA_ARGS__) +#define mglIsTexture(...) \ + gles2Interface->IsTexture(gles2Context, __VA_ARGS__) +#define mglLineWidth(...) \ + gles2Interface->LineWidth(gles2Context, __VA_ARGS__) +#define mglPixelStorei(...) \ + gles2Interface->PixelStorei(gles2Context, __VA_ARGS__) +#define mglPolygonOffset(...) \ + gles2Interface->PolygonOffset(gles2Context, __VA_ARGS__) +#define mglReadPixels(...) \ + gles2Interface->ReadPixels(gles2Context, __VA_ARGS__) +#define mglReleaseShaderCompiler(...) \ + gles2Interface->ReleaseShaderCompiler(gles2Context, __VA_ARGS__) +#define mglRenderbufferStorage(...) \ + gles2Interface->RenderbufferStorage(gles2Context, __VA_ARGS__) +#define mglSampleCoverage(...) \ + gles2Interface->SampleCoverage(gles2Context, __VA_ARGS__) +#define mglShaderBinary(...) \ + gles2Interface->ShaderBinary(gles2Context, __VA_ARGS__) +#define mglStencilFunc(...) \ + gles2Interface->StencilFunc(gles2Context, __VA_ARGS__) +#define mglStencilFuncSeparate(...) \ + gles2Interface->StencilFuncSeparate(gles2Context, __VA_ARGS__) +#define mglStencilMask(...) \ + gles2Interface->StencilMask(gles2Context, __VA_ARGS__) +#define mglStencilMaskSeparate(...) \ + gles2Interface->StencilMaskSeparate(gles2Context, __VA_ARGS__) +#define mglStencilOp(...) \ + gles2Interface->StencilOp(gles2Context, __VA_ARGS__) +#define mglStencilOpSeparate(...) \ + gles2Interface->StencilOpSeparate(gles2Context, __VA_ARGS__) +#define mglTexImage2D(...) \ + gles2Interface->TexImage2D(gles2Context, __VA_ARGS__) +#define mglTexParameterf(...) \ + gles2Interface->TexParameterf(gles2Context, __VA_ARGS__) +#define mglTexParameterfv(...) \ + gles2Interface->TexParameterfv(gles2Context, __VA_ARGS__) +#define mglTexParameteri(...) \ + gles2Interface->TexParameteri(gles2Context, __VA_ARGS__) +#define mglTexParameteriv(...) \ + gles2Interface->TexParameteriv(gles2Context, __VA_ARGS__) +#define mglTexSubImage2D(...) \ + gles2Interface->TexSubImage2D(gles2Context, __VA_ARGS__) +#define mglUniformMatrix2fv(...) \ + gles2Interface->UniformMatrix2fv(gles2Context, __VA_ARGS__) +#define mglUniformMatrix3fv(...) \ + gles2Interface->UniformMatrix3fv(gles2Context, __VA_ARGS__) +#define mglUniformMatrix4fv(...) \ + gles2Interface->UniformMatrix4fv(gles2Context, __VA_ARGS__) +#define mglVertexAttrib1f(...) \ + gles2Interface->VertexAttrib1f(gles2Context, __VA_ARGS__) +#define mglVertexAttrib2f(...) \ + gles2Interface->VertexAttrib2f(gles2Context, __VA_ARGS__) +#define mglVertexAttrib3f(...) \ + gles2Interface->VertexAttrib3f(gles2Context, __VA_ARGS__) +#define mglVertexAttrib4f(...) \ + gles2Interface->VertexAttrib4f(gles2Context, __VA_ARGS__) +#define mglVertexAttrib1fv(...) \ + gles2Interface->VertexAttrib1fv(gles2Context, __VA_ARGS__) +#define mglVertexAttrib2fv(...) \ + gles2Interface->VertexAttrib2fv(gles2Context, __VA_ARGS__) +#define mglVertexAttrib3fv(...) \ + gles2Interface->VertexAttrib3fv(gles2Context, __VA_ARGS__) +#define mglVertexAttrib4fv(...) \ + gles2Interface->VertexAttrib4fv(gles2Context, __VA_ARGS__) + +#endif // defined(__native_client__) && defined(USE_OPENGL) +#endif // RENDER_OPENGL_NACLGLFUNCTIONS_H diff --git a/src/render/opengl/opengldebug.h b/src/render/opengl/opengldebug.h new file mode 100644 index 000000000..b648c9b22 --- /dev/null +++ b/src/render/opengl/opengldebug.h @@ -0,0 +1,36 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RENDER_OPENGL_OPENGLDEBUG_H +#define RENDER_OPENGL_OPENGLDEBUG_H + +#include "render/opengl/mgl.h" + +#if defined(DEBUG_OPENGL) && defined(USE_OPENGL) +#define GLDEBUG_START(text) if (mglPushGroupMarker) \ + mglPushGroupMarker(sizeof(text), text); +#define GLDEBUG_END() if (mglPopGroupMarker) \ + mglPopGroupMarker(); +#else +#define GLDEBUG_START(text) +#define GLDEBUG_END() +#endif + +#endif // RENDER_OPENGL_OPENGLDEBUG_H |