From c74c107e7f51a09a584c1ae0172686e42a83ce85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 20 Dec 2013 13:24:59 +0100 Subject: [PATCH 01/64] Add Mesh::id() for consistency. --- src/Mesh.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Mesh.h b/src/Mesh.h index 57af67504..bc61c2956 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -407,6 +407,14 @@ class MAGNUM_EXPORT Mesh { /** @brief Move assignment */ Mesh& operator=(Mesh&& other) noexcept; + /** + * @brief OpenGL mesh ID + * + * If @extension{APPLE,vertex_array_object} is not available, returns + * 0. + */ + GLuint id() const { return _id; } + /** * @brief Index size * From f0ec6ffb21f2cd69fc52408815d7be541b5b2093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 20 Dec 2013 22:43:14 +0100 Subject: [PATCH 02/64] Xlib.h, I hate you sincerely. --- src/Framebuffer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 7318c83cb..c1c5ebffc 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -31,6 +31,10 @@ #include "AbstractFramebuffer.h" #include "CubeMapTexture.h" +#ifdef _X11_XLIB_H_ /* Xlib.h, I hate you sincerely */ +#undef Status +#endif + namespace Magnum { /** From bfe6033348176a768fbf39072ab38722f896b3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 20 Dec 2013 22:45:02 +0100 Subject: [PATCH 03/64] Minor cleanup. --- src/Shader.cpp | 8 ++++---- src/Test/ContextGLTest.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Shader.cpp b/src/Shader.cpp index 2b928309d..f0e345744 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -437,8 +437,8 @@ Int Shader::maxUniformBlocks(const Type type) { GL_MAX_VERTEX_UNIFORM_BLOCKS, GL_MAX_FRAGMENT_UNIFORM_BLOCKS, #ifndef MAGNUM_TARGET_GLES - /** @todo Fix this when glLoadGen has GL_MAX_GEOMETRY_UNIFORM_BLOCKS enum */ - 0x8A2C /*GL_MAX_GEOMETRY_UNIFORM_BLOCKS*/, + /** @todo Fix this when glLoadGen has `GL_MAX_GEOMETRY_UNIFORM_BLOCKS` enum */ + 0x8A2C, //GL_MAX_GEOMETRY_UNIFORM_BLOCKS, GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS, GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS, GL_MAX_COMPUTE_UNIFORM_BLOCKS @@ -520,8 +520,8 @@ Int Shader::maxCombinedUniformComponents(const Type type) { GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, #ifndef MAGNUM_TARGET_GLES - /** @todo Fix this when glLoadGen has GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS enum */ - 0x8A32 /*GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS*/, + /** @todo Fix this when glLoadGen has `GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS` enum */ + 0x8A32, //GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS, GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS, GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS diff --git a/src/Test/ContextGLTest.cpp b/src/Test/ContextGLTest.cpp index f957e24fe..74c74d49d 100644 --- a/src/Test/ContextGLTest.cpp +++ b/src/Test/ContextGLTest.cpp @@ -22,9 +22,9 @@ DEALINGS IN THE SOFTWARE. */ -#include "Test/AbstractOpenGLTester.h" #include "Context.h" #include "Extensions.h" +#include "Test/AbstractOpenGLTester.h" namespace Magnum { namespace Test { From 0d262bda4170884b1b4579307db50977a763fe8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 21 Dec 2013 02:23:14 +0100 Subject: [PATCH 04/64] Added EXT_debug_label extension to the list. --- src/Context.cpp | 2 ++ src/Extensions.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Context.cpp b/src/Context.cpp index 02d041a50..97f50eb4a 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -86,6 +86,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,EXT,texture_filter_anisotropic), // done _extension(GL,EXT,texture_mirror_clamp), _extension(GL,EXT,direct_state_access), + _extension(GL,EXT,debug_label), _extension(GL,GREMEDY,string_marker)}; // done static const std::vector extensions300{ /** @@ -217,6 +218,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,EXT,texture_filter_anisotropic), _extension(GL,EXT,texture_format_BGRA8888), _extension(GL,EXT,read_format_bgra), + _extension(GL,EXT,debug_label), _extension(GL,EXT,debug_marker), _extension(GL,EXT,disjoint_timer_query), _extension(GL,EXT,separate_shader_objects), diff --git a/src/Extensions.h b/src/Extensions.h index beef67726..2f0105993 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -181,6 +181,7 @@ namespace GL { _extension(GL,EXT,transform_feedback, GL210, GL300) // #352 _extension(GL,EXT,direct_state_access, GL210, None) // #353 _extension(GL,EXT,texture_snorm, GL300, GL310) // #365 + _extension(GL,EXT,debug_label, GL210, None) // #439 } namespace GREMEDY { _extension(GL,GREMEDY,string_marker, GL210, None) // #311 } namespace INTEL { @@ -215,6 +216,7 @@ namespace GL { _extension(GL,EXT,discard_framebuffer, GLES200, GLES300) // #64 _extension(GL,EXT,blend_minmax, GLES200, GLES300) // #65 _extension(GL,EXT,read_format_bgra, GLES200, None) // #66 + _extension(GL,EXT,debug_label, GLES200, None) // #98 _extension(GL,EXT,debug_marker, GLES200, None) // #99 _extension(GL,EXT,occlusion_query_boolean, GLES200, GLES300) // #100 _extension(GL,EXT,separate_shader_objects, GLES200, None) // #101 From 11da68aff42fe01270322ed682973589fe564947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 21 Dec 2013 02:22:23 +0100 Subject: [PATCH 05/64] external: updated glLoadGen-generated GL headers. Added EXT_debug_label to them. --- external/OpenGL/GL/extensions.txt | 1 + external/OpenGL/GL/gl_magnum.c | 403 ++++++++++++++++-------------- external/OpenGL/GL/gl_magnum.h | 230 +++++++++-------- 3 files changed, 344 insertions(+), 290 deletions(-) diff --git a/external/OpenGL/GL/extensions.txt b/external/OpenGL/GL/extensions.txt index 9baf6b203..fea40a9d5 100644 --- a/external/OpenGL/GL/extensions.txt +++ b/external/OpenGL/GL/extensions.txt @@ -9,4 +9,5 @@ EXT_texture_filter_anisotropic EXT_texture_mirror_clamp EXT_direct_state_access + EXT_debug_label GREMEDY_string_marker diff --git a/external/OpenGL/GL/gl_magnum.c b/external/OpenGL/GL/gl_magnum.c index 7de5af8a4..b695ff5e0 100644 --- a/external/OpenGL/GL/gl_magnum.c +++ b/external/OpenGL/GL/gl_magnum.c @@ -90,41 +90,42 @@ int ogl_ext_ATI_texture_mirror_once = ogl_LOAD_FAILED; int ogl_ext_EXT_texture_filter_anisotropic = ogl_LOAD_FAILED; int ogl_ext_EXT_texture_mirror_clamp = ogl_LOAD_FAILED; int ogl_ext_EXT_direct_state_access = ogl_LOAD_FAILED; +int ogl_ext_EXT_debug_label = ogl_LOAD_FAILED; int ogl_ext_GREMEDY_string_marker = ogl_LOAD_FAILED; GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glGetGraphicsResetStatusARB)() = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnColorTableARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnCompressedTexImageARB)(GLenum, GLint, GLsizei, GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnHistogramARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnColorTableARB)(GLenum, GLenum, GLenum, GLsizei, void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnCompressedTexImageARB)(GLenum, GLint, GLsizei, void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnHistogramARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMapdvARB)(GLenum, GLenum, GLsizei, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMapfvARB)(GLenum, GLenum, GLsizei, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMapivARB)(GLenum, GLenum, GLsizei, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMinmaxARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMinmaxARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPixelMapfvARB)(GLenum, GLsizei, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPixelMapuivARB)(GLenum, GLsizei, GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPixelMapusvARB)(GLenum, GLsizei, GLushort *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPolygonStippleARB)(GLsizei, GLubyte *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnSeparableFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnTexImageARB)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnSeparableFilterARB)(GLenum, GLenum, GLenum, GLsizei, void *, GLsizei, void *, void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnTexImageARB)(GLenum, GLint, GLenum, GLenum, GLsizei, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformdvARB)(GLuint, GLint, GLsizei, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformfvARB)(GLuint, GLint, GLsizei, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformivARB)(GLuint, GLint, GLsizei, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformuivARB)(GLuint, GLint, GLsizei, GLuint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadnPixelsARB)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadnPixelsARB)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void *) = NULL; static int Load_ARB_robustness() { int numFailed = 0; _ptrc_glGetGraphicsResetStatusARB = (GLenum (CODEGEN_FUNCPTR *)())IntGetProcAddress("glGetGraphicsResetStatusARB"); if(!_ptrc_glGetGraphicsResetStatusARB) numFailed++; - _ptrc_glGetnColorTableARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, GLvoid *))IntGetProcAddress("glGetnColorTableARB"); + _ptrc_glGetnColorTableARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, void *))IntGetProcAddress("glGetnColorTableARB"); if(!_ptrc_glGetnColorTableARB) numFailed++; - _ptrc_glGetnCompressedTexImageARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLsizei, GLvoid *))IntGetProcAddress("glGetnCompressedTexImageARB"); + _ptrc_glGetnCompressedTexImageARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLsizei, void *))IntGetProcAddress("glGetnCompressedTexImageARB"); if(!_ptrc_glGetnCompressedTexImageARB) numFailed++; - _ptrc_glGetnConvolutionFilterARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, GLvoid *))IntGetProcAddress("glGetnConvolutionFilterARB"); + _ptrc_glGetnConvolutionFilterARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, void *))IntGetProcAddress("glGetnConvolutionFilterARB"); if(!_ptrc_glGetnConvolutionFilterARB) numFailed++; - _ptrc_glGetnHistogramARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *))IntGetProcAddress("glGetnHistogramARB"); + _ptrc_glGetnHistogramARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLboolean, GLenum, GLenum, GLsizei, void *))IntGetProcAddress("glGetnHistogramARB"); if(!_ptrc_glGetnHistogramARB) numFailed++; _ptrc_glGetnMapdvARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLsizei, GLdouble *))IntGetProcAddress("glGetnMapdvARB"); if(!_ptrc_glGetnMapdvARB) numFailed++; @@ -132,7 +133,7 @@ static int Load_ARB_robustness() if(!_ptrc_glGetnMapfvARB) numFailed++; _ptrc_glGetnMapivARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLsizei, GLint *))IntGetProcAddress("glGetnMapivARB"); if(!_ptrc_glGetnMapivARB) numFailed++; - _ptrc_glGetnMinmaxARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *))IntGetProcAddress("glGetnMinmaxARB"); + _ptrc_glGetnMinmaxARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLboolean, GLenum, GLenum, GLsizei, void *))IntGetProcAddress("glGetnMinmaxARB"); if(!_ptrc_glGetnMinmaxARB) numFailed++; _ptrc_glGetnPixelMapfvARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLfloat *))IntGetProcAddress("glGetnPixelMapfvARB"); if(!_ptrc_glGetnPixelMapfvARB) numFailed++; @@ -142,9 +143,9 @@ static int Load_ARB_robustness() if(!_ptrc_glGetnPixelMapusvARB) numFailed++; _ptrc_glGetnPolygonStippleARB = (void (CODEGEN_FUNCPTR *)(GLsizei, GLubyte *))IntGetProcAddress("glGetnPolygonStippleARB"); if(!_ptrc_glGetnPolygonStippleARB) numFailed++; - _ptrc_glGetnSeparableFilterARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *))IntGetProcAddress("glGetnSeparableFilterARB"); + _ptrc_glGetnSeparableFilterARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, void *, GLsizei, void *, void *))IntGetProcAddress("glGetnSeparableFilterARB"); if(!_ptrc_glGetnSeparableFilterARB) numFailed++; - _ptrc_glGetnTexImageARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *))IntGetProcAddress("glGetnTexImageARB"); + _ptrc_glGetnTexImageARB = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLenum, GLsizei, void *))IntGetProcAddress("glGetnTexImageARB"); if(!_ptrc_glGetnTexImageARB) numFailed++; _ptrc_glGetnUniformdvARB = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLsizei, GLdouble *))IntGetProcAddress("glGetnUniformdvARB"); if(!_ptrc_glGetnUniformdvARB) numFailed++; @@ -154,7 +155,7 @@ static int Load_ARB_robustness() if(!_ptrc_glGetnUniformivARB) numFailed++; _ptrc_glGetnUniformuivARB = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLsizei, GLuint *))IntGetProcAddress("glGetnUniformuivARB"); if(!_ptrc_glGetnUniformuivARB) numFailed++; - _ptrc_glReadnPixelsARB = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *))IntGetProcAddress("glReadnPixelsARB"); + _ptrc_glReadnPixelsARB = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void *))IntGetProcAddress("glReadnPixelsARB"); if(!_ptrc_glReadnPixelsARB) numFailed++; return numFailed; } @@ -162,20 +163,20 @@ static int Load_ARB_robustness() GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBindMultiTextureEXT)(GLenum, GLenum, GLuint) = NULL; GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glCheckNamedFramebufferStatusEXT)(GLuint, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClearNamedBufferDataEXT)(GLuint, GLenum, GLenum, GLenum, const void *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClearNamedBufferSubDataEXT)(GLuint, GLenum, GLenum, GLenum, GLsizeiptr, GLsizeiptr, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClearNamedBufferSubDataEXT)(GLuint, GLenum, GLsizeiptr, GLsizeiptr, GLenum, GLenum, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClientAttribDefaultEXT)(GLbitfield) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage1DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage2DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage3DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage1DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage2DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage3DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei) = NULL; @@ -203,8 +204,8 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glFramebufferReadBufferEXT)(GLuint GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenerateMultiTexMipmapEXT)(GLenum, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenerateTextureMipmapEXT)(GLuint, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBooleanIndexedvEXT)(GLenum, GLuint, GLboolean *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedMultiTexImageEXT)(GLenum, GLenum, GLint, GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTextureImageEXT)(GLuint, GLenum, GLint, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedMultiTexImageEXT)(GLenum, GLenum, GLint, void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTextureImageEXT)(GLuint, GLenum, GLint, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetDoubleIndexedvEXT)(GLenum, GLuint, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetDoublei_vEXT)(GLenum, GLuint, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetFloatIndexedvEXT)(GLenum, GLuint, GLfloat *) = NULL; @@ -216,7 +217,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexEnvivEXT)(GLenum, GLe GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexGendvEXT)(GLenum, GLenum, GLenum, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexGenfvEXT)(GLenum, GLenum, GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexGenivEXT)(GLenum, GLenum, GLenum, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexImageEXT)(GLenum, GLenum, GLint, GLenum, GLenum, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexImageEXT)(GLenum, GLenum, GLint, GLenum, GLenum, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexLevelParameterfvEXT)(GLenum, GLenum, GLint, GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexLevelParameterivEXT)(GLenum, GLenum, GLint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexParameterIivEXT)(GLenum, GLenum, GLenum, GLint *) = NULL; @@ -224,20 +225,20 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexParameterIuivEXT)(GLe GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexParameterfvEXT)(GLenum, GLenum, GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexParameterivEXT)(GLenum, GLenum, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferParameterivEXT)(GLuint, GLenum, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferPointervEXT)(GLuint, GLenum, GLvoid **) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferPointervEXT)(GLuint, GLenum, void **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedFramebufferAttachmentParameterivEXT)(GLuint, GLenum, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedFramebufferParameterivEXT)(GLuint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramLocalParameterIivEXT)(GLuint, GLenum, GLuint, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramLocalParameterIuivEXT)(GLuint, GLenum, GLuint, GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramLocalParameterdvEXT)(GLuint, GLenum, GLuint, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramLocalParameterfvEXT)(GLuint, GLenum, GLuint, GLfloat *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramStringEXT)(GLuint, GLenum, GLenum, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramStringEXT)(GLuint, GLenum, GLenum, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramivEXT)(GLuint, GLenum, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedRenderbufferParameterivEXT)(GLuint, GLenum, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerIndexedvEXT)(GLenum, GLuint, GLvoid **) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointeri_vEXT)(GLenum, GLuint, GLvoid **) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureImageEXT)(GLuint, GLenum, GLint, GLenum, GLenum, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerIndexedvEXT)(GLenum, GLuint, void **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointeri_vEXT)(GLenum, GLuint, void **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureImageEXT)(GLuint, GLenum, GLint, GLenum, GLenum, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureLevelParameterfvEXT)(GLuint, GLenum, GLint, GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureLevelParameterivEXT)(GLuint, GLenum, GLint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureParameterIivEXT)(GLuint, GLenum, GLenum, GLint *) = NULL; @@ -246,8 +247,8 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureParameterfvEXT)(GLuint GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureParameterivEXT)(GLuint, GLenum, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayIntegeri_vEXT)(GLuint, GLuint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayIntegervEXT)(GLuint, GLenum, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointeri_vEXT)(GLuint, GLuint, GLenum, GLvoid **) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointervEXT)(GLuint, GLenum, GLvoid **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointeri_vEXT)(GLuint, GLuint, GLenum, void **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointervEXT)(GLuint, GLenum, void **) = NULL; GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsEnabledIndexedEXT)(GLenum, GLuint) = NULL; GLLOADGEN_EXPORT void * (CODEGEN_FUNCPTR *_ptrc_glMapNamedBufferEXT)(GLuint, GLenum) = NULL; GLLOADGEN_EXPORT void * (CODEGEN_FUNCPTR *_ptrc_glMapNamedBufferRangeEXT)(GLuint, GLintptr, GLsizeiptr, GLbitfield) = NULL; @@ -271,7 +272,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMatrixScalefEXT)(GLenum, GLfloat GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMatrixTranslatedEXT)(GLenum, GLdouble, GLdouble, GLdouble) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMatrixTranslatefEXT)(GLenum, GLfloat, GLfloat, GLfloat) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexBufferEXT)(GLenum, GLenum, GLenum, GLuint) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexCoordPointerEXT)(GLenum, GLint, GLenum, GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexCoordPointerEXT)(GLenum, GLint, GLenum, GLsizei, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexEnvfEXT)(GLenum, GLenum, GLenum, GLfloat) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexEnvfvEXT)(GLenum, GLenum, GLenum, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexEnviEXT)(GLenum, GLenum, GLenum, GLint) = NULL; @@ -282,9 +283,9 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexGenfEXT)(GLenum, GLenum, GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexGenfvEXT)(GLenum, GLenum, GLenum, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexGeniEXT)(GLenum, GLenum, GLenum, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexGenivEXT)(GLenum, GLenum, GLenum, const GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterIivEXT)(GLenum, GLenum, GLenum, const GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterIuivEXT)(GLenum, GLenum, GLenum, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterfEXT)(GLenum, GLenum, GLenum, GLfloat) = NULL; @@ -292,11 +293,12 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterfvEXT)(GLenum, GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameteriEXT)(GLenum, GLenum, GLenum, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterivEXT)(GLenum, GLenum, GLenum, const GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexRenderbufferEXT)(GLenum, GLenum, GLuint) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferDataEXT)(GLuint, GLsizeiptr, const GLvoid *, GLenum) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferDataEXT)(GLuint, GLsizeiptr, const void *, GLenum) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferStorageEXT)(GLuint, GLsizeiptr, const void *, GLbitfield) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedCopyBufferSubDataEXT)(GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedFramebufferParameteriEXT)(GLuint, GLenum, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedFramebufferRenderbufferEXT)(GLuint, GLenum, GLenum, GLuint) = NULL; @@ -317,7 +319,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramLocalParameterI4uivE GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramLocalParameters4fvEXT)(GLuint, GLenum, GLuint, GLsizei, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramLocalParametersI4ivEXT)(GLuint, GLenum, GLuint, GLsizei, const GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramLocalParametersI4uivEXT)(GLuint, GLenum, GLuint, GLsizei, const GLuint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramStringEXT)(GLuint, GLenum, GLenum, GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramStringEXT)(GLuint, GLenum, GLenum, GLsizei, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedRenderbufferStorageEXT)(GLuint, GLenum, GLsizei, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedRenderbufferStorageMultisampleCoverageEXT)(GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedRenderbufferStorageMultisampleEXT)(GLuint, GLsizei, GLenum, GLsizei, GLsizei) = NULL; @@ -374,10 +376,10 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramUniformMatrix4x3fvEXT)(GL GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPushClientAttribDefaultEXT)(GLbitfield) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureBufferEXT)(GLuint, GLenum, GLenum, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureBufferRangeEXT)(GLuint, GLenum, GLenum, GLuint, GLintptr, GLsizeiptr) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage2DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage3DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexturePageCommitmentEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage2DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage3DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexturePageCommitmentEXT)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureParameterIivEXT)(GLuint, GLenum, GLenum, const GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureParameterIuivEXT)(GLuint, GLenum, GLenum, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureParameterfEXT)(GLuint, GLenum, GLenum, GLfloat) = NULL; @@ -390,9 +392,9 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureStorage2DEXT)(GLuint, GLe GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureStorage2DMultisampleEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureStorage3DEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureStorage3DMultisampleEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *) = NULL; GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glUnmapNamedBufferEXT)(GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayBindVertexBufferEXT)(GLuint, GLuint, GLuint, GLintptr, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayColorOffsetEXT)(GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr) = NULL; @@ -404,6 +406,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayNormalOffsetEXT)(GLui GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArraySecondaryColorOffsetEXT)(GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayTexCoordOffsetEXT)(GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribBindingEXT)(GLuint, GLuint, GLuint) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribDivisorEXT)(GLuint, GLuint, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribFormatEXT)(GLuint, GLuint, GLint, GLenum, GLboolean, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribIFormatEXT)(GLuint, GLuint, GLint, GLenum, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribIOffsetEXT)(GLuint, GLuint, GLuint, GLint, GLenum, GLsizei, GLintptr) = NULL; @@ -422,33 +425,33 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glCheckNamedFramebufferStatusEXT) numFailed++; _ptrc_glClearNamedBufferDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLenum, const void *))IntGetProcAddress("glClearNamedBufferDataEXT"); if(!_ptrc_glClearNamedBufferDataEXT) numFailed++; - _ptrc_glClearNamedBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLenum, GLsizeiptr, GLsizeiptr, const void *))IntGetProcAddress("glClearNamedBufferSubDataEXT"); + _ptrc_glClearNamedBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLsizeiptr, GLsizeiptr, GLenum, GLenum, const void *))IntGetProcAddress("glClearNamedBufferSubDataEXT"); if(!_ptrc_glClearNamedBufferSubDataEXT) numFailed++; _ptrc_glClientAttribDefaultEXT = (void (CODEGEN_FUNCPTR *)(GLbitfield))IntGetProcAddress("glClientAttribDefaultEXT"); if(!_ptrc_glClientAttribDefaultEXT) numFailed++; - _ptrc_glCompressedMultiTexImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedMultiTexImage1DEXT"); + _ptrc_glCompressedMultiTexImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedMultiTexImage1DEXT"); if(!_ptrc_glCompressedMultiTexImage1DEXT) numFailed++; - _ptrc_glCompressedMultiTexImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedMultiTexImage2DEXT"); + _ptrc_glCompressedMultiTexImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedMultiTexImage2DEXT"); if(!_ptrc_glCompressedMultiTexImage2DEXT) numFailed++; - _ptrc_glCompressedMultiTexImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedMultiTexImage3DEXT"); + _ptrc_glCompressedMultiTexImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedMultiTexImage3DEXT"); if(!_ptrc_glCompressedMultiTexImage3DEXT) numFailed++; - _ptrc_glCompressedMultiTexSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedMultiTexSubImage1DEXT"); + _ptrc_glCompressedMultiTexSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedMultiTexSubImage1DEXT"); if(!_ptrc_glCompressedMultiTexSubImage1DEXT) numFailed++; - _ptrc_glCompressedMultiTexSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedMultiTexSubImage2DEXT"); + _ptrc_glCompressedMultiTexSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedMultiTexSubImage2DEXT"); if(!_ptrc_glCompressedMultiTexSubImage2DEXT) numFailed++; - _ptrc_glCompressedMultiTexSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedMultiTexSubImage3DEXT"); + _ptrc_glCompressedMultiTexSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedMultiTexSubImage3DEXT"); if(!_ptrc_glCompressedMultiTexSubImage3DEXT) numFailed++; - _ptrc_glCompressedTextureImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTextureImage1DEXT"); + _ptrc_glCompressedTextureImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTextureImage1DEXT"); if(!_ptrc_glCompressedTextureImage1DEXT) numFailed++; - _ptrc_glCompressedTextureImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTextureImage2DEXT"); + _ptrc_glCompressedTextureImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTextureImage2DEXT"); if(!_ptrc_glCompressedTextureImage2DEXT) numFailed++; - _ptrc_glCompressedTextureImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTextureImage3DEXT"); + _ptrc_glCompressedTextureImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTextureImage3DEXT"); if(!_ptrc_glCompressedTextureImage3DEXT) numFailed++; - _ptrc_glCompressedTextureSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTextureSubImage1DEXT"); + _ptrc_glCompressedTextureSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTextureSubImage1DEXT"); if(!_ptrc_glCompressedTextureSubImage1DEXT) numFailed++; - _ptrc_glCompressedTextureSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTextureSubImage2DEXT"); + _ptrc_glCompressedTextureSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTextureSubImage2DEXT"); if(!_ptrc_glCompressedTextureSubImage2DEXT) numFailed++; - _ptrc_glCompressedTextureSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTextureSubImage3DEXT"); + _ptrc_glCompressedTextureSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTextureSubImage3DEXT"); if(!_ptrc_glCompressedTextureSubImage3DEXT) numFailed++; _ptrc_glCopyMultiTexImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint))IntGetProcAddress("glCopyMultiTexImage1DEXT"); if(!_ptrc_glCopyMultiTexImage1DEXT) numFailed++; @@ -504,9 +507,9 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glGenerateTextureMipmapEXT) numFailed++; _ptrc_glGetBooleanIndexedvEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLboolean *))IntGetProcAddress("glGetBooleanIndexedvEXT"); if(!_ptrc_glGetBooleanIndexedvEXT) numFailed++; - _ptrc_glGetCompressedMultiTexImageEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLvoid *))IntGetProcAddress("glGetCompressedMultiTexImageEXT"); + _ptrc_glGetCompressedMultiTexImageEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, void *))IntGetProcAddress("glGetCompressedMultiTexImageEXT"); if(!_ptrc_glGetCompressedMultiTexImageEXT) numFailed++; - _ptrc_glGetCompressedTextureImageEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLvoid *))IntGetProcAddress("glGetCompressedTextureImageEXT"); + _ptrc_glGetCompressedTextureImageEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, void *))IntGetProcAddress("glGetCompressedTextureImageEXT"); if(!_ptrc_glGetCompressedTextureImageEXT) numFailed++; _ptrc_glGetDoubleIndexedvEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLdouble *))IntGetProcAddress("glGetDoubleIndexedvEXT"); if(!_ptrc_glGetDoubleIndexedvEXT) numFailed++; @@ -530,7 +533,7 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glGetMultiTexGenfvEXT) numFailed++; _ptrc_glGetMultiTexGenivEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLint *))IntGetProcAddress("glGetMultiTexGenivEXT"); if(!_ptrc_glGetMultiTexGenivEXT) numFailed++; - _ptrc_glGetMultiTexImageEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLenum, GLvoid *))IntGetProcAddress("glGetMultiTexImageEXT"); + _ptrc_glGetMultiTexImageEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLenum, void *))IntGetProcAddress("glGetMultiTexImageEXT"); if(!_ptrc_glGetMultiTexImageEXT) numFailed++; _ptrc_glGetMultiTexLevelParameterfvEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLenum, GLfloat *))IntGetProcAddress("glGetMultiTexLevelParameterfvEXT"); if(!_ptrc_glGetMultiTexLevelParameterfvEXT) numFailed++; @@ -546,9 +549,9 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glGetMultiTexParameterivEXT) numFailed++; _ptrc_glGetNamedBufferParameterivEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetNamedBufferParameterivEXT"); if(!_ptrc_glGetNamedBufferParameterivEXT) numFailed++; - _ptrc_glGetNamedBufferPointervEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLvoid **))IntGetProcAddress("glGetNamedBufferPointervEXT"); + _ptrc_glGetNamedBufferPointervEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, void **))IntGetProcAddress("glGetNamedBufferPointervEXT"); if(!_ptrc_glGetNamedBufferPointervEXT) numFailed++; - _ptrc_glGetNamedBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLintptr, GLsizeiptr, GLvoid *))IntGetProcAddress("glGetNamedBufferSubDataEXT"); + _ptrc_glGetNamedBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLintptr, GLsizeiptr, void *))IntGetProcAddress("glGetNamedBufferSubDataEXT"); if(!_ptrc_glGetNamedBufferSubDataEXT) numFailed++; _ptrc_glGetNamedFramebufferAttachmentParameterivEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLint *))IntGetProcAddress("glGetNamedFramebufferAttachmentParameterivEXT"); if(!_ptrc_glGetNamedFramebufferAttachmentParameterivEXT) numFailed++; @@ -562,17 +565,17 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glGetNamedProgramLocalParameterdvEXT) numFailed++; _ptrc_glGetNamedProgramLocalParameterfvEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLuint, GLfloat *))IntGetProcAddress("glGetNamedProgramLocalParameterfvEXT"); if(!_ptrc_glGetNamedProgramLocalParameterfvEXT) numFailed++; - _ptrc_glGetNamedProgramStringEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLvoid *))IntGetProcAddress("glGetNamedProgramStringEXT"); + _ptrc_glGetNamedProgramStringEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, void *))IntGetProcAddress("glGetNamedProgramStringEXT"); if(!_ptrc_glGetNamedProgramStringEXT) numFailed++; _ptrc_glGetNamedProgramivEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLint *))IntGetProcAddress("glGetNamedProgramivEXT"); if(!_ptrc_glGetNamedProgramivEXT) numFailed++; _ptrc_glGetNamedRenderbufferParameterivEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetNamedRenderbufferParameterivEXT"); if(!_ptrc_glGetNamedRenderbufferParameterivEXT) numFailed++; - _ptrc_glGetPointerIndexedvEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLvoid **))IntGetProcAddress("glGetPointerIndexedvEXT"); + _ptrc_glGetPointerIndexedvEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, void **))IntGetProcAddress("glGetPointerIndexedvEXT"); if(!_ptrc_glGetPointerIndexedvEXT) numFailed++; - _ptrc_glGetPointeri_vEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLvoid **))IntGetProcAddress("glGetPointeri_vEXT"); + _ptrc_glGetPointeri_vEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, void **))IntGetProcAddress("glGetPointeri_vEXT"); if(!_ptrc_glGetPointeri_vEXT) numFailed++; - _ptrc_glGetTextureImageEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLenum, GLvoid *))IntGetProcAddress("glGetTextureImageEXT"); + _ptrc_glGetTextureImageEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLenum, void *))IntGetProcAddress("glGetTextureImageEXT"); if(!_ptrc_glGetTextureImageEXT) numFailed++; _ptrc_glGetTextureLevelParameterfvEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLenum, GLfloat *))IntGetProcAddress("glGetTextureLevelParameterfvEXT"); if(!_ptrc_glGetTextureLevelParameterfvEXT) numFailed++; @@ -590,9 +593,9 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glGetVertexArrayIntegeri_vEXT) numFailed++; _ptrc_glGetVertexArrayIntegervEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetVertexArrayIntegervEXT"); if(!_ptrc_glGetVertexArrayIntegervEXT) numFailed++; - _ptrc_glGetVertexArrayPointeri_vEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLenum, GLvoid **))IntGetProcAddress("glGetVertexArrayPointeri_vEXT"); + _ptrc_glGetVertexArrayPointeri_vEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLenum, void **))IntGetProcAddress("glGetVertexArrayPointeri_vEXT"); if(!_ptrc_glGetVertexArrayPointeri_vEXT) numFailed++; - _ptrc_glGetVertexArrayPointervEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLvoid **))IntGetProcAddress("glGetVertexArrayPointervEXT"); + _ptrc_glGetVertexArrayPointervEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, void **))IntGetProcAddress("glGetVertexArrayPointervEXT"); if(!_ptrc_glGetVertexArrayPointervEXT) numFailed++; _ptrc_glIsEnabledIndexedEXT = (GLboolean (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glIsEnabledIndexedEXT"); if(!_ptrc_glIsEnabledIndexedEXT) numFailed++; @@ -640,7 +643,7 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glMatrixTranslatefEXT) numFailed++; _ptrc_glMultiTexBufferEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint))IntGetProcAddress("glMultiTexBufferEXT"); if(!_ptrc_glMultiTexBufferEXT) numFailed++; - _ptrc_glMultiTexCoordPointerEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glMultiTexCoordPointerEXT"); + _ptrc_glMultiTexCoordPointerEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, const void *))IntGetProcAddress("glMultiTexCoordPointerEXT"); if(!_ptrc_glMultiTexCoordPointerEXT) numFailed++; _ptrc_glMultiTexEnvfEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLfloat))IntGetProcAddress("glMultiTexEnvfEXT"); if(!_ptrc_glMultiTexEnvfEXT) numFailed++; @@ -662,11 +665,11 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glMultiTexGeniEXT) numFailed++; _ptrc_glMultiTexGenivEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, const GLint *))IntGetProcAddress("glMultiTexGenivEXT"); if(!_ptrc_glMultiTexGenivEXT) numFailed++; - _ptrc_glMultiTexImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glMultiTexImage1DEXT"); + _ptrc_glMultiTexImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glMultiTexImage1DEXT"); if(!_ptrc_glMultiTexImage1DEXT) numFailed++; - _ptrc_glMultiTexImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glMultiTexImage2DEXT"); + _ptrc_glMultiTexImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glMultiTexImage2DEXT"); if(!_ptrc_glMultiTexImage2DEXT) numFailed++; - _ptrc_glMultiTexImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glMultiTexImage3DEXT"); + _ptrc_glMultiTexImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glMultiTexImage3DEXT"); if(!_ptrc_glMultiTexImage3DEXT) numFailed++; _ptrc_glMultiTexParameterIivEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, const GLint *))IntGetProcAddress("glMultiTexParameterIivEXT"); if(!_ptrc_glMultiTexParameterIivEXT) numFailed++; @@ -682,15 +685,17 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glMultiTexParameterivEXT) numFailed++; _ptrc_glMultiTexRenderbufferEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLuint))IntGetProcAddress("glMultiTexRenderbufferEXT"); if(!_ptrc_glMultiTexRenderbufferEXT) numFailed++; - _ptrc_glMultiTexSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glMultiTexSubImage1DEXT"); + _ptrc_glMultiTexSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glMultiTexSubImage1DEXT"); if(!_ptrc_glMultiTexSubImage1DEXT) numFailed++; - _ptrc_glMultiTexSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glMultiTexSubImage2DEXT"); + _ptrc_glMultiTexSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glMultiTexSubImage2DEXT"); if(!_ptrc_glMultiTexSubImage2DEXT) numFailed++; - _ptrc_glMultiTexSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glMultiTexSubImage3DEXT"); + _ptrc_glMultiTexSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glMultiTexSubImage3DEXT"); if(!_ptrc_glMultiTexSubImage3DEXT) numFailed++; - _ptrc_glNamedBufferDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizeiptr, const GLvoid *, GLenum))IntGetProcAddress("glNamedBufferDataEXT"); + _ptrc_glNamedBufferDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizeiptr, const void *, GLenum))IntGetProcAddress("glNamedBufferDataEXT"); if(!_ptrc_glNamedBufferDataEXT) numFailed++; - _ptrc_glNamedBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLintptr, GLsizeiptr, const GLvoid *))IntGetProcAddress("glNamedBufferSubDataEXT"); + _ptrc_glNamedBufferStorageEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizeiptr, const void *, GLbitfield))IntGetProcAddress("glNamedBufferStorageEXT"); + if(!_ptrc_glNamedBufferStorageEXT) numFailed++; + _ptrc_glNamedBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLintptr, GLsizeiptr, const void *))IntGetProcAddress("glNamedBufferSubDataEXT"); if(!_ptrc_glNamedBufferSubDataEXT) numFailed++; _ptrc_glNamedCopyBufferSubDataEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr))IntGetProcAddress("glNamedCopyBufferSubDataEXT"); if(!_ptrc_glNamedCopyBufferSubDataEXT) numFailed++; @@ -732,7 +737,7 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glNamedProgramLocalParametersI4ivEXT) numFailed++; _ptrc_glNamedProgramLocalParametersI4uivEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLuint, GLsizei, const GLuint *))IntGetProcAddress("glNamedProgramLocalParametersI4uivEXT"); if(!_ptrc_glNamedProgramLocalParametersI4uivEXT) numFailed++; - _ptrc_glNamedProgramStringEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glNamedProgramStringEXT"); + _ptrc_glNamedProgramStringEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLsizei, const void *))IntGetProcAddress("glNamedProgramStringEXT"); if(!_ptrc_glNamedProgramStringEXT) numFailed++; _ptrc_glNamedRenderbufferStorageEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLsizei, GLsizei))IntGetProcAddress("glNamedRenderbufferStorageEXT"); if(!_ptrc_glNamedRenderbufferStorageEXT) numFailed++; @@ -846,13 +851,13 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glTextureBufferEXT) numFailed++; _ptrc_glTextureBufferRangeEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, GLuint, GLintptr, GLsizeiptr))IntGetProcAddress("glTextureBufferRangeEXT"); if(!_ptrc_glTextureBufferRangeEXT) numFailed++; - _ptrc_glTextureImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTextureImage1DEXT"); + _ptrc_glTextureImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTextureImage1DEXT"); if(!_ptrc_glTextureImage1DEXT) numFailed++; - _ptrc_glTextureImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTextureImage2DEXT"); + _ptrc_glTextureImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTextureImage2DEXT"); if(!_ptrc_glTextureImage2DEXT) numFailed++; - _ptrc_glTextureImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTextureImage3DEXT"); + _ptrc_glTextureImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTextureImage3DEXT"); if(!_ptrc_glTextureImage3DEXT) numFailed++; - _ptrc_glTexturePageCommitmentEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexturePageCommitmentEXT"); + _ptrc_glTexturePageCommitmentEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexturePageCommitmentEXT"); if(!_ptrc_glTexturePageCommitmentEXT) numFailed++; _ptrc_glTextureParameterIivEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLenum, const GLint *))IntGetProcAddress("glTextureParameterIivEXT"); if(!_ptrc_glTextureParameterIivEXT) numFailed++; @@ -878,11 +883,11 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glTextureStorage3DEXT) numFailed++; _ptrc_glTextureStorage3DMultisampleEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTextureStorage3DMultisampleEXT"); if(!_ptrc_glTextureStorage3DMultisampleEXT) numFailed++; - _ptrc_glTextureSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTextureSubImage1DEXT"); + _ptrc_glTextureSubImage1DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTextureSubImage1DEXT"); if(!_ptrc_glTextureSubImage1DEXT) numFailed++; - _ptrc_glTextureSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTextureSubImage2DEXT"); + _ptrc_glTextureSubImage2DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTextureSubImage2DEXT"); if(!_ptrc_glTextureSubImage2DEXT) numFailed++; - _ptrc_glTextureSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTextureSubImage3DEXT"); + _ptrc_glTextureSubImage3DEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTextureSubImage3DEXT"); if(!_ptrc_glTextureSubImage3DEXT) numFailed++; _ptrc_glUnmapNamedBufferEXT = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glUnmapNamedBufferEXT"); if(!_ptrc_glUnmapNamedBufferEXT) numFailed++; @@ -906,6 +911,8 @@ static int Load_EXT_direct_state_access() if(!_ptrc_glVertexArrayTexCoordOffsetEXT) numFailed++; _ptrc_glVertexArrayVertexAttribBindingEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint))IntGetProcAddress("glVertexArrayVertexAttribBindingEXT"); if(!_ptrc_glVertexArrayVertexAttribBindingEXT) numFailed++; + _ptrc_glVertexArrayVertexAttribDivisorEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLuint))IntGetProcAddress("glVertexArrayVertexAttribDivisorEXT"); + if(!_ptrc_glVertexArrayVertexAttribDivisorEXT) numFailed++; _ptrc_glVertexArrayVertexAttribFormatEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLint, GLenum, GLboolean, GLuint))IntGetProcAddress("glVertexArrayVertexAttribFormatEXT"); if(!_ptrc_glVertexArrayVertexAttribFormatEXT) numFailed++; _ptrc_glVertexArrayVertexAttribIFormatEXT = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLint, GLenum, GLuint))IntGetProcAddress("glVertexArrayVertexAttribIFormatEXT"); @@ -925,12 +932,25 @@ static int Load_EXT_direct_state_access() return numFailed; } -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetObjectLabelEXT)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glLabelObjectEXT)(GLenum, GLuint, GLsizei, const GLchar *) = NULL; + +static int Load_EXT_debug_label() +{ + int numFailed = 0; + _ptrc_glGetObjectLabelEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetObjectLabelEXT"); + if(!_ptrc_glGetObjectLabelEXT) numFailed++; + _ptrc_glLabelObjectEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLsizei, const GLchar *))IntGetProcAddress("glLabelObjectEXT"); + if(!_ptrc_glLabelObjectEXT) numFailed++; + return numFailed; +} + +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const void *) = NULL; static int Load_GREMEDY_string_marker() { int numFailed = 0; - _ptrc_glStringMarkerGREMEDY = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLvoid *))IntGetProcAddress("glStringMarkerGREMEDY"); + _ptrc_glStringMarkerGREMEDY = (void (CODEGEN_FUNCPTR *)(GLsizei, const void *))IntGetProcAddress("glStringMarkerGREMEDY"); if(!_ptrc_glStringMarkerGREMEDY) numFailed++; return numFailed; } @@ -957,7 +977,7 @@ GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glGetError)() = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetFloatv)(GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetIntegerv)(GLenum, GLint *) = NULL; GLLOADGEN_EXPORT const GLubyte * (CODEGEN_FUNCPTR *_ptrc_glGetString)(GLenum) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexImage)(GLenum, GLint, GLenum, GLenum, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexParameterfv)(GLenum, GLenum, GLfloat *) = NULL; @@ -971,13 +991,13 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPixelStorei)(GLenum, GLint) = NU GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPointSize)(GLfloat) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPolygonMode)(GLenum, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadBuffer)(GLenum) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissor)(GLint, GLint, GLsizei, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStencilFunc)(GLenum, GLint, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStencilMask)(GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStencilOp)(GLenum, GLenum, GLenum) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexParameterf)(GLenum, GLenum, GLfloat) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexParameterfv)(GLenum, GLenum, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexParameteri)(GLenum, GLenum, GLint) = NULL; @@ -991,34 +1011,34 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage1D)(GLenum, GLint GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteTextures)(GLsizei, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArrays)(GLenum, GLint, GLsizei) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElements)(GLenum, GLsizei, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElements)(GLenum, GLsizei, GLenum, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenTextures)(GLsizei, GLuint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerv)(GLenum, GLvoid **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerv)(GLenum, void **) = NULL; GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsTexture)(GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPolygonOffset)(GLfloat, GLfloat) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendEquation)(GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glActiveTexture)(GLenum) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage1D)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTexImage)(GLenum, GLint, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage1D)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTexImage)(GLenum, GLint, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glSampleCoverage)(GLfloat, GLboolean) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendEquation)(GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawArrays)(GLenum, const GLint *, const GLsizei *, GLsizei) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElements)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElements)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPointParameterf)(GLenum, GLfloat) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPointParameterfv)(GLenum, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPointParameteri)(GLenum, GLint) = NULL; @@ -1026,16 +1046,16 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPointParameteriv)(GLenum, const GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBeginQuery)(GLenum, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBindBuffer)(GLenum, GLuint) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferData)(GLenum, GLsizeiptr, const GLvoid *, GLenum) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferData)(GLenum, GLsizeiptr, const void *, GLenum) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteBuffers)(GLsizei, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteQueries)(GLsizei, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glEndQuery)(GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenBuffers)(GLsizei, GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenQueries)(GLsizei, GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteriv)(GLenum, GLenum, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferPointerv)(GLenum, GLenum, GLvoid **) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferSubData)(GLenum, GLintptr, GLsizeiptr, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferPointerv)(GLenum, GLenum, void **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferSubData)(GLenum, GLintptr, GLsizeiptr, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectiv)(GLuint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectuiv)(GLuint, GLenum, GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetQueryiv)(GLenum, GLenum, GLint *) = NULL; @@ -1068,7 +1088,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetShaderiv)(GLuint, GLenum, GLi GLLOADGEN_EXPORT GLint (CODEGEN_FUNCPTR *_ptrc_glGetUniformLocation)(GLuint, const GLchar *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetUniformfv)(GLuint, GLint, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetUniformiv)(GLuint, GLint, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribPointerv)(GLuint, GLenum, GLvoid **) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribPointerv)(GLuint, GLenum, void **) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribdv)(GLuint, GLenum, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribfv)(GLuint, GLenum, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribiv)(GLuint, GLenum, GLint *) = NULL; @@ -1136,7 +1156,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4sv)(GLuint, const G GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4ubv)(GLuint, const GLubyte *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4uiv)(GLuint, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4usv)(GLuint, const GLushort *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x4fv)(GLint, GLsizei, GLboolean, const GLfloat *) = NULL; @@ -1228,11 +1248,11 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4ubv)(GLuint, const GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4ui)(GLuint, GLuint, GLuint, GLuint, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4uiv)(GLuint, const GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4usv)(GLuint, const GLushort *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysInstanced)(GLenum, GLint, GLsizei, GLsizei) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const void *, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockName)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockiv)(GLuint, GLuint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformName)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *) = NULL; @@ -1245,9 +1265,9 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glUniformBlockBinding)(GLuint, GLu GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glClientWaitSync)(GLsync, GLbitfield, GLuint64) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteSync)(GLsync) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLint) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElementsBaseVertex)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsBaseVertex)(GLenum, GLsizei, GLenum, const void *, GLint) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertex)(GLenum, GLsizei, GLenum, const void *, GLsizei, GLint) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElementsBaseVertex)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *, GLint) = NULL; GLLOADGEN_EXPORT GLsync (CODEGEN_FUNCPTR *_ptrc_glFenceSync)(GLenum, GLbitfield) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glFramebufferTexture)(GLenum, GLenum, GLuint, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteri64v)(GLenum, GLenum, GLint64 *) = NULL; @@ -1256,11 +1276,11 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInteger64v)(GLenum, GLint64 * GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultisamplefv)(GLenum, GLuint, GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetSynciv)(GLsync, GLenum, GLsizei, GLsizei *, GLint *) = NULL; GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsSync)(GLsync) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElementsBaseVertex)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei, const GLint *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElementsBaseVertex)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei, const GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProvokingVertex)(GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glSampleMaski)(GLuint, GLbitfield) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2DMultisample)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3DMultisample)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2DMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3DMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glWaitSync)(GLsync, GLbitfield, GLuint64) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBindFragDataLocationIndexed)(GLuint, GLuint, GLuint, const GLchar *) = NULL; @@ -1299,8 +1319,8 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendEquationi)(GLuint, GLenum) GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendFuncSeparatei)(GLuint, GLenum, GLenum, GLenum, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendFunci)(GLuint, GLenum, GLenum) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteTransformFeedbacks)(GLsizei, const GLuint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysIndirect)(GLenum, const GLvoid *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsIndirect)(GLenum, GLenum, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysIndirect)(GLenum, const void *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsIndirect)(GLenum, GLenum, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawTransformFeedback)(GLenum, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawTransformFeedbackStream)(GLenum, GLuint, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glEndQueryIndexed)(GLenum, GLuint) = NULL; @@ -1350,13 +1370,13 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDepthRangef)(GLfloat, GLfloat) = GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenProgramPipelines)(GLsizei, GLuint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetDoublei_v)(GLenum, GLuint, GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetFloati_v)(GLenum, GLuint, GLfloat *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramBinary)(GLuint, GLsizei, GLsizei *, GLenum *, GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramBinary)(GLuint, GLsizei, GLsizei *, GLenum *, void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramPipelineInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramPipelineiv)(GLuint, GLenum, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetShaderPrecisionFormat)(GLenum, GLenum, GLint *, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribLdv)(GLuint, GLenum, GLdouble *) = NULL; GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsProgramPipeline)(GLuint) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramBinary)(GLuint, GLenum, const GLvoid *, GLsizei) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramBinary)(GLuint, GLenum, const void *, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramParameteri)(GLuint, GLenum, GLint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramUniform1d)(GLuint, GLint, GLdouble) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramUniform1dv)(GLuint, GLint, GLsizei, const GLdouble *) = NULL; @@ -1412,7 +1432,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReleaseShaderCompiler)() = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissorArrayv)(GLuint, GLsizei, const GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissorIndexed)(GLuint, GLint, GLint, GLsizei, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissorIndexedv)(GLuint, const GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glShaderBinary)(GLsizei, const GLuint *, GLenum, const void *, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glUseProgramStages)(GLuint, GLbitfield, GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glValidateProgramPipeline)(GLuint) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL1d)(GLuint, GLdouble) = NULL; @@ -1423,7 +1443,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL3d)(GLuint, GLdoubl GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL3dv)(GLuint, const GLdouble *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL4d)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL4dv)(GLuint, const GLdouble *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribLPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribLPointer)(GLuint, GLint, GLenum, GLsizei, const void *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glViewportArrayv)(GLuint, GLsizei, const GLfloat *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glViewportIndexedf)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glViewportIndexedfv)(GLuint, const GLfloat *) = NULL; @@ -1435,7 +1455,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertexB GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawTransformFeedbackInstanced)(GLenum, GLuint, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawTransformFeedbackStreamInstanced)(GLenum, GLuint, GLuint, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetActiveAtomicCounterBufferiv)(GLuint, GLuint, GLenum, GLint *) = NULL; -GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInternalformati64v)(GLenum, GLenum, GLenum, GLsizei, GLint64 *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInternalformativ)(GLenum, GLenum, GLenum, GLsizei, GLint *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMemoryBarrier)(GLbitfield) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexStorage1D)(GLenum, GLsizei, GLenum, GLsizei) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexStorage2D)(GLenum, GLsizei, GLenum, GLsizei, GLsizei) = NULL; @@ -1453,6 +1473,7 @@ GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDispatchComputeIndirect)(GLintpt GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glFramebufferParameteri)(GLenum, GLenum, GLint) = NULL; GLLOADGEN_EXPORT GLuint (CODEGEN_FUNCPTR *_ptrc_glGetDebugMessageLog)(GLuint, GLsizei, GLenum *, GLenum *, GLuint *, GLenum *, GLsizei *, GLchar *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetFramebufferParameteriv)(GLenum, GLenum, GLint *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInternalformati64v)(GLenum, GLenum, GLenum, GLsizei, GLint64 *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetObjectLabel)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetObjectPtrLabel)(const void *, GLsizei, GLsizei *, GLchar *) = NULL; GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramInterfaceiv)(GLuint, GLenum, GLenum, GLint *) = NULL; @@ -1541,7 +1562,7 @@ static int Load_Version_4_4() if(!_ptrc_glGetIntegerv) numFailed++; _ptrc_glGetString = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGetString"); if(!_ptrc_glGetString) numFailed++; - _ptrc_glGetTexImage = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLenum, GLvoid *))IntGetProcAddress("glGetTexImage"); + _ptrc_glGetTexImage = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLenum, void *))IntGetProcAddress("glGetTexImage"); if(!_ptrc_glGetTexImage) numFailed++; _ptrc_glGetTexLevelParameterfv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLfloat *))IntGetProcAddress("glGetTexLevelParameterfv"); if(!_ptrc_glGetTexLevelParameterfv) numFailed++; @@ -1569,7 +1590,7 @@ static int Load_Version_4_4() if(!_ptrc_glPolygonMode) numFailed++; _ptrc_glReadBuffer = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glReadBuffer"); if(!_ptrc_glReadBuffer) numFailed++; - _ptrc_glReadPixels = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *))IntGetProcAddress("glReadPixels"); + _ptrc_glReadPixels = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *))IntGetProcAddress("glReadPixels"); if(!_ptrc_glReadPixels) numFailed++; _ptrc_glScissor = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glScissor"); if(!_ptrc_glScissor) numFailed++; @@ -1579,9 +1600,9 @@ static int Load_Version_4_4() if(!_ptrc_glStencilMask) numFailed++; _ptrc_glStencilOp = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum))IntGetProcAddress("glStencilOp"); if(!_ptrc_glStencilOp) numFailed++; - _ptrc_glTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexImage1D"); + _ptrc_glTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTexImage1D"); if(!_ptrc_glTexImage1D) numFailed++; - _ptrc_glTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexImage2D"); + _ptrc_glTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTexImage2D"); if(!_ptrc_glTexImage2D) numFailed++; _ptrc_glTexParameterf = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLfloat))IntGetProcAddress("glTexParameterf"); if(!_ptrc_glTexParameterf) numFailed++; @@ -1607,55 +1628,55 @@ static int Load_Version_4_4() if(!_ptrc_glDeleteTextures) numFailed++; _ptrc_glDrawArrays = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLsizei))IntGetProcAddress("glDrawArrays"); if(!_ptrc_glDrawArrays) numFailed++; - _ptrc_glDrawElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const GLvoid *))IntGetProcAddress("glDrawElements"); + _ptrc_glDrawElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *))IntGetProcAddress("glDrawElements"); if(!_ptrc_glDrawElements) numFailed++; _ptrc_glGenTextures = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenTextures"); if(!_ptrc_glGenTextures) numFailed++; - _ptrc_glGetPointerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLvoid **))IntGetProcAddress("glGetPointerv"); + _ptrc_glGetPointerv = (void (CODEGEN_FUNCPTR *)(GLenum, void **))IntGetProcAddress("glGetPointerv"); if(!_ptrc_glGetPointerv) numFailed++; _ptrc_glIsTexture = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsTexture"); if(!_ptrc_glIsTexture) numFailed++; _ptrc_glPolygonOffset = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat))IntGetProcAddress("glPolygonOffset"); if(!_ptrc_glPolygonOffset) numFailed++; - _ptrc_glTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexSubImage1D"); + _ptrc_glTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTexSubImage1D"); if(!_ptrc_glTexSubImage1D) numFailed++; - _ptrc_glTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexSubImage2D"); + _ptrc_glTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTexSubImage2D"); if(!_ptrc_glTexSubImage2D) numFailed++; - _ptrc_glBlendColor = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glBlendColor"); - if(!_ptrc_glBlendColor) numFailed++; - _ptrc_glBlendEquation = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glBlendEquation"); - if(!_ptrc_glBlendEquation) numFailed++; _ptrc_glCopyTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glCopyTexSubImage3D"); if(!_ptrc_glCopyTexSubImage3D) numFailed++; - _ptrc_glDrawRangeElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *))IntGetProcAddress("glDrawRangeElements"); + _ptrc_glDrawRangeElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *))IntGetProcAddress("glDrawRangeElements"); if(!_ptrc_glDrawRangeElements) numFailed++; - _ptrc_glTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexImage3D"); + _ptrc_glTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))IntGetProcAddress("glTexImage3D"); if(!_ptrc_glTexImage3D) numFailed++; - _ptrc_glTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexSubImage3D"); + _ptrc_glTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *))IntGetProcAddress("glTexSubImage3D"); if(!_ptrc_glTexSubImage3D) numFailed++; _ptrc_glActiveTexture = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glActiveTexture"); if(!_ptrc_glActiveTexture) numFailed++; - _ptrc_glCompressedTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTexImage1D"); + _ptrc_glCompressedTexImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTexImage1D"); if(!_ptrc_glCompressedTexImage1D) numFailed++; - _ptrc_glCompressedTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTexImage2D"); + _ptrc_glCompressedTexImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTexImage2D"); if(!_ptrc_glCompressedTexImage2D) numFailed++; - _ptrc_glCompressedTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTexImage3D"); + _ptrc_glCompressedTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *))IntGetProcAddress("glCompressedTexImage3D"); if(!_ptrc_glCompressedTexImage3D) numFailed++; - _ptrc_glCompressedTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTexSubImage1D"); + _ptrc_glCompressedTexSubImage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTexSubImage1D"); if(!_ptrc_glCompressedTexSubImage1D) numFailed++; - _ptrc_glCompressedTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTexSubImage2D"); + _ptrc_glCompressedTexSubImage2D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTexSubImage2D"); if(!_ptrc_glCompressedTexSubImage2D) numFailed++; - _ptrc_glCompressedTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glCompressedTexSubImage3D"); + _ptrc_glCompressedTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *))IntGetProcAddress("glCompressedTexSubImage3D"); if(!_ptrc_glCompressedTexSubImage3D) numFailed++; - _ptrc_glGetCompressedTexImage = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLvoid *))IntGetProcAddress("glGetCompressedTexImage"); + _ptrc_glGetCompressedTexImage = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, void *))IntGetProcAddress("glGetCompressedTexImage"); if(!_ptrc_glGetCompressedTexImage) numFailed++; _ptrc_glSampleCoverage = (void (CODEGEN_FUNCPTR *)(GLfloat, GLboolean))IntGetProcAddress("glSampleCoverage"); if(!_ptrc_glSampleCoverage) numFailed++; + _ptrc_glBlendColor = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glBlendColor"); + if(!_ptrc_glBlendColor) numFailed++; + _ptrc_glBlendEquation = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glBlendEquation"); + if(!_ptrc_glBlendEquation) numFailed++; _ptrc_glBlendFuncSeparate = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLenum))IntGetProcAddress("glBlendFuncSeparate"); if(!_ptrc_glBlendFuncSeparate) numFailed++; _ptrc_glMultiDrawArrays = (void (CODEGEN_FUNCPTR *)(GLenum, const GLint *, const GLsizei *, GLsizei))IntGetProcAddress("glMultiDrawArrays"); if(!_ptrc_glMultiDrawArrays) numFailed++; - _ptrc_glMultiDrawElements = (void (CODEGEN_FUNCPTR *)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei))IntGetProcAddress("glMultiDrawElements"); + _ptrc_glMultiDrawElements = (void (CODEGEN_FUNCPTR *)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei))IntGetProcAddress("glMultiDrawElements"); if(!_ptrc_glMultiDrawElements) numFailed++; _ptrc_glPointParameterf = (void (CODEGEN_FUNCPTR *)(GLenum, GLfloat))IntGetProcAddress("glPointParameterf"); if(!_ptrc_glPointParameterf) numFailed++; @@ -1669,9 +1690,9 @@ static int Load_Version_4_4() if(!_ptrc_glBeginQuery) numFailed++; _ptrc_glBindBuffer = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindBuffer"); if(!_ptrc_glBindBuffer) numFailed++; - _ptrc_glBufferData = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizeiptr, const GLvoid *, GLenum))IntGetProcAddress("glBufferData"); + _ptrc_glBufferData = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizeiptr, const void *, GLenum))IntGetProcAddress("glBufferData"); if(!_ptrc_glBufferData) numFailed++; - _ptrc_glBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, const GLvoid *))IntGetProcAddress("glBufferSubData"); + _ptrc_glBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, const void *))IntGetProcAddress("glBufferSubData"); if(!_ptrc_glBufferSubData) numFailed++; _ptrc_glDeleteBuffers = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteBuffers"); if(!_ptrc_glDeleteBuffers) numFailed++; @@ -1685,9 +1706,9 @@ static int Load_Version_4_4() if(!_ptrc_glGenQueries) numFailed++; _ptrc_glGetBufferParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetBufferParameteriv"); if(!_ptrc_glGetBufferParameteriv) numFailed++; - _ptrc_glGetBufferPointerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLvoid **))IntGetProcAddress("glGetBufferPointerv"); + _ptrc_glGetBufferPointerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, void **))IntGetProcAddress("glGetBufferPointerv"); if(!_ptrc_glGetBufferPointerv) numFailed++; - _ptrc_glGetBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, GLvoid *))IntGetProcAddress("glGetBufferSubData"); + _ptrc_glGetBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLintptr, GLsizeiptr, void *))IntGetProcAddress("glGetBufferSubData"); if(!_ptrc_glGetBufferSubData) numFailed++; _ptrc_glGetQueryObjectiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint *))IntGetProcAddress("glGetQueryObjectiv"); if(!_ptrc_glGetQueryObjectiv) numFailed++; @@ -1751,7 +1772,7 @@ static int Load_Version_4_4() if(!_ptrc_glGetUniformfv) numFailed++; _ptrc_glGetUniformiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLint *))IntGetProcAddress("glGetUniformiv"); if(!_ptrc_glGetUniformiv) numFailed++; - _ptrc_glGetVertexAttribPointerv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLvoid **))IntGetProcAddress("glGetVertexAttribPointerv"); + _ptrc_glGetVertexAttribPointerv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, void **))IntGetProcAddress("glGetVertexAttribPointerv"); if(!_ptrc_glGetVertexAttribPointerv) numFailed++; _ptrc_glGetVertexAttribdv = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLdouble *))IntGetProcAddress("glGetVertexAttribdv"); if(!_ptrc_glGetVertexAttribdv) numFailed++; @@ -1887,7 +1908,7 @@ static int Load_Version_4_4() if(!_ptrc_glVertexAttrib4uiv) numFailed++; _ptrc_glVertexAttrib4usv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLushort *))IntGetProcAddress("glVertexAttrib4usv"); if(!_ptrc_glVertexAttrib4usv) numFailed++; - _ptrc_glVertexAttribPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *))IntGetProcAddress("glVertexAttribPointer"); + _ptrc_glVertexAttribPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *))IntGetProcAddress("glVertexAttribPointer"); if(!_ptrc_glVertexAttribPointer) numFailed++; _ptrc_glUniformMatrix2x3fv = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix2x3fv"); if(!_ptrc_glUniformMatrix2x3fv) numFailed++; @@ -2067,13 +2088,13 @@ static int Load_Version_4_4() if(!_ptrc_glVertexAttribI4uiv) numFailed++; _ptrc_glVertexAttribI4usv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLushort *))IntGetProcAddress("glVertexAttribI4usv"); if(!_ptrc_glVertexAttribI4usv) numFailed++; - _ptrc_glVertexAttribIPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glVertexAttribIPointer"); + _ptrc_glVertexAttribIPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLsizei, const void *))IntGetProcAddress("glVertexAttribIPointer"); if(!_ptrc_glVertexAttribIPointer) numFailed++; _ptrc_glCopyBufferSubData = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr))IntGetProcAddress("glCopyBufferSubData"); if(!_ptrc_glCopyBufferSubData) numFailed++; _ptrc_glDrawArraysInstanced = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLsizei, GLsizei))IntGetProcAddress("glDrawArraysInstanced"); if(!_ptrc_glDrawArraysInstanced) numFailed++; - _ptrc_glDrawElementsInstanced = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei))IntGetProcAddress("glDrawElementsInstanced"); + _ptrc_glDrawElementsInstanced = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *, GLsizei))IntGetProcAddress("glDrawElementsInstanced"); if(!_ptrc_glDrawElementsInstanced) numFailed++; _ptrc_glGetActiveUniformBlockName = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetActiveUniformBlockName"); if(!_ptrc_glGetActiveUniformBlockName) numFailed++; @@ -2097,11 +2118,11 @@ static int Load_Version_4_4() if(!_ptrc_glClientWaitSync) numFailed++; _ptrc_glDeleteSync = (void (CODEGEN_FUNCPTR *)(GLsync))IntGetProcAddress("glDeleteSync"); if(!_ptrc_glDeleteSync) numFailed++; - _ptrc_glDrawElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const GLvoid *, GLint))IntGetProcAddress("glDrawElementsBaseVertex"); + _ptrc_glDrawElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *, GLint))IntGetProcAddress("glDrawElementsBaseVertex"); if(!_ptrc_glDrawElementsBaseVertex) numFailed++; - _ptrc_glDrawElementsInstancedBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint))IntGetProcAddress("glDrawElementsInstancedBaseVertex"); + _ptrc_glDrawElementsInstancedBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, const void *, GLsizei, GLint))IntGetProcAddress("glDrawElementsInstancedBaseVertex"); if(!_ptrc_glDrawElementsInstancedBaseVertex) numFailed++; - _ptrc_glDrawRangeElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint))IntGetProcAddress("glDrawRangeElementsBaseVertex"); + _ptrc_glDrawRangeElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *, GLint))IntGetProcAddress("glDrawRangeElementsBaseVertex"); if(!_ptrc_glDrawRangeElementsBaseVertex) numFailed++; _ptrc_glFenceSync = (GLsync (CODEGEN_FUNCPTR *)(GLenum, GLbitfield))IntGetProcAddress("glFenceSync"); if(!_ptrc_glFenceSync) numFailed++; @@ -2119,15 +2140,15 @@ static int Load_Version_4_4() if(!_ptrc_glGetSynciv) numFailed++; _ptrc_glIsSync = (GLboolean (CODEGEN_FUNCPTR *)(GLsync))IntGetProcAddress("glIsSync"); if(!_ptrc_glIsSync) numFailed++; - _ptrc_glMultiDrawElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei, const GLint *))IntGetProcAddress("glMultiDrawElementsBaseVertex"); + _ptrc_glMultiDrawElementsBaseVertex = (void (CODEGEN_FUNCPTR *)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei, const GLint *))IntGetProcAddress("glMultiDrawElementsBaseVertex"); if(!_ptrc_glMultiDrawElementsBaseVertex) numFailed++; _ptrc_glProvokingVertex = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glProvokingVertex"); if(!_ptrc_glProvokingVertex) numFailed++; _ptrc_glSampleMaski = (void (CODEGEN_FUNCPTR *)(GLuint, GLbitfield))IntGetProcAddress("glSampleMaski"); if(!_ptrc_glSampleMaski) numFailed++; - _ptrc_glTexImage2DMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexImage2DMultisample"); + _ptrc_glTexImage2DMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexImage2DMultisample"); if(!_ptrc_glTexImage2DMultisample) numFailed++; - _ptrc_glTexImage3DMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexImage3DMultisample"); + _ptrc_glTexImage3DMultisample = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean))IntGetProcAddress("glTexImage3DMultisample"); if(!_ptrc_glTexImage3DMultisample) numFailed++; _ptrc_glWaitSync = (void (CODEGEN_FUNCPTR *)(GLsync, GLbitfield, GLuint64))IntGetProcAddress("glWaitSync"); if(!_ptrc_glWaitSync) numFailed++; @@ -2201,9 +2222,9 @@ static int Load_Version_4_4() if(!_ptrc_glBlendFunci) numFailed++; _ptrc_glDeleteTransformFeedbacks = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteTransformFeedbacks"); if(!_ptrc_glDeleteTransformFeedbacks) numFailed++; - _ptrc_glDrawArraysIndirect = (void (CODEGEN_FUNCPTR *)(GLenum, const GLvoid *))IntGetProcAddress("glDrawArraysIndirect"); + _ptrc_glDrawArraysIndirect = (void (CODEGEN_FUNCPTR *)(GLenum, const void *))IntGetProcAddress("glDrawArraysIndirect"); if(!_ptrc_glDrawArraysIndirect) numFailed++; - _ptrc_glDrawElementsIndirect = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, const GLvoid *))IntGetProcAddress("glDrawElementsIndirect"); + _ptrc_glDrawElementsIndirect = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, const void *))IntGetProcAddress("glDrawElementsIndirect"); if(!_ptrc_glDrawElementsIndirect) numFailed++; _ptrc_glDrawTransformFeedback = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glDrawTransformFeedback"); if(!_ptrc_glDrawTransformFeedback) numFailed++; @@ -2301,7 +2322,7 @@ static int Load_Version_4_4() if(!_ptrc_glGetDoublei_v) numFailed++; _ptrc_glGetFloati_v = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLfloat *))IntGetProcAddress("glGetFloati_v"); if(!_ptrc_glGetFloati_v) numFailed++; - _ptrc_glGetProgramBinary = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLenum *, GLvoid *))IntGetProcAddress("glGetProgramBinary"); + _ptrc_glGetProgramBinary = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLenum *, void *))IntGetProcAddress("glGetProgramBinary"); if(!_ptrc_glGetProgramBinary) numFailed++; _ptrc_glGetProgramPipelineInfoLog = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetProgramPipelineInfoLog"); if(!_ptrc_glGetProgramPipelineInfoLog) numFailed++; @@ -2313,7 +2334,7 @@ static int Load_Version_4_4() if(!_ptrc_glGetVertexAttribLdv) numFailed++; _ptrc_glIsProgramPipeline = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsProgramPipeline"); if(!_ptrc_glIsProgramPipeline) numFailed++; - _ptrc_glProgramBinary = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, const GLvoid *, GLsizei))IntGetProcAddress("glProgramBinary"); + _ptrc_glProgramBinary = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, const void *, GLsizei))IntGetProcAddress("glProgramBinary"); if(!_ptrc_glProgramBinary) numFailed++; _ptrc_glProgramParameteri = (void (CODEGEN_FUNCPTR *)(GLuint, GLenum, GLint))IntGetProcAddress("glProgramParameteri"); if(!_ptrc_glProgramParameteri) numFailed++; @@ -2425,7 +2446,7 @@ static int Load_Version_4_4() if(!_ptrc_glScissorIndexed) numFailed++; _ptrc_glScissorIndexedv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLint *))IntGetProcAddress("glScissorIndexedv"); if(!_ptrc_glScissorIndexedv) numFailed++; - _ptrc_glShaderBinary = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei))IntGetProcAddress("glShaderBinary"); + _ptrc_glShaderBinary = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *, GLenum, const void *, GLsizei))IntGetProcAddress("glShaderBinary"); if(!_ptrc_glShaderBinary) numFailed++; _ptrc_glUseProgramStages = (void (CODEGEN_FUNCPTR *)(GLuint, GLbitfield, GLuint))IntGetProcAddress("glUseProgramStages"); if(!_ptrc_glUseProgramStages) numFailed++; @@ -2447,7 +2468,7 @@ static int Load_Version_4_4() if(!_ptrc_glVertexAttribL4d) numFailed++; _ptrc_glVertexAttribL4dv = (void (CODEGEN_FUNCPTR *)(GLuint, const GLdouble *))IntGetProcAddress("glVertexAttribL4dv"); if(!_ptrc_glVertexAttribL4dv) numFailed++; - _ptrc_glVertexAttribLPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLsizei, const GLvoid *))IntGetProcAddress("glVertexAttribLPointer"); + _ptrc_glVertexAttribLPointer = (void (CODEGEN_FUNCPTR *)(GLuint, GLint, GLenum, GLsizei, const void *))IntGetProcAddress("glVertexAttribLPointer"); if(!_ptrc_glVertexAttribLPointer) numFailed++; _ptrc_glViewportArrayv = (void (CODEGEN_FUNCPTR *)(GLuint, GLsizei, const GLfloat *))IntGetProcAddress("glViewportArrayv"); if(!_ptrc_glViewportArrayv) numFailed++; @@ -2469,8 +2490,8 @@ static int Load_Version_4_4() if(!_ptrc_glDrawTransformFeedbackStreamInstanced) numFailed++; _ptrc_glGetActiveAtomicCounterBufferiv = (void (CODEGEN_FUNCPTR *)(GLuint, GLuint, GLenum, GLint *))IntGetProcAddress("glGetActiveAtomicCounterBufferiv"); if(!_ptrc_glGetActiveAtomicCounterBufferiv) numFailed++; - _ptrc_glGetInternalformati64v = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, GLint64 *))IntGetProcAddress("glGetInternalformati64v"); - if(!_ptrc_glGetInternalformati64v) numFailed++; + _ptrc_glGetInternalformativ = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, GLint *))IntGetProcAddress("glGetInternalformativ"); + if(!_ptrc_glGetInternalformativ) numFailed++; _ptrc_glMemoryBarrier = (void (CODEGEN_FUNCPTR *)(GLbitfield))IntGetProcAddress("glMemoryBarrier"); if(!_ptrc_glMemoryBarrier) numFailed++; _ptrc_glTexStorage1D = (void (CODEGEN_FUNCPTR *)(GLenum, GLsizei, GLenum, GLsizei))IntGetProcAddress("glTexStorage1D"); @@ -2503,6 +2524,8 @@ static int Load_Version_4_4() if(!_ptrc_glGetDebugMessageLog) numFailed++; _ptrc_glGetFramebufferParameteriv = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetFramebufferParameteriv"); if(!_ptrc_glGetFramebufferParameteriv) numFailed++; + _ptrc_glGetInternalformati64v = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLsizei, GLint64 *))IntGetProcAddress("glGetInternalformati64v"); + if(!_ptrc_glGetInternalformati64v) numFailed++; _ptrc_glGetObjectLabel = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetObjectLabel"); if(!_ptrc_glGetObjectLabel) numFailed++; _ptrc_glGetObjectPtrLabel = (void (CODEGEN_FUNCPTR *)(const void *, GLsizei, GLsizei *, GLchar *))IntGetProcAddress("glGetObjectPtrLabel"); @@ -2592,7 +2615,7 @@ typedef struct ogl_StrToExtMap_s PFN_LOADFUNCPOINTERS LoadExtension; } ogl_StrToExtMap; -static ogl_StrToExtMap ExtensionMap[8] = { +static ogl_StrToExtMap ExtensionMap[9] = { {"GL_AMD_vertex_shader_layer", &ogl_ext_AMD_vertex_shader_layer, NULL}, {"GL_AMD_shader_trinary_minmax", &ogl_ext_AMD_shader_trinary_minmax, NULL}, {"GL_ARB_robustness", &ogl_ext_ARB_robustness, Load_ARB_robustness}, @@ -2600,10 +2623,11 @@ static ogl_StrToExtMap ExtensionMap[8] = { {"GL_EXT_texture_filter_anisotropic", &ogl_ext_EXT_texture_filter_anisotropic, NULL}, {"GL_EXT_texture_mirror_clamp", &ogl_ext_EXT_texture_mirror_clamp, NULL}, {"GL_EXT_direct_state_access", &ogl_ext_EXT_direct_state_access, Load_EXT_direct_state_access}, + {"GL_EXT_debug_label", &ogl_ext_EXT_debug_label, Load_EXT_debug_label}, {"GL_GREMEDY_string_marker", &ogl_ext_GREMEDY_string_marker, Load_GREMEDY_string_marker}, }; -static int g_extensionMapSize = 8; +static int g_extensionMapSize = 9; static void ClearExtensionVars() { @@ -2614,6 +2638,7 @@ static void ClearExtensionVars() ogl_ext_EXT_texture_filter_anisotropic = ogl_LOAD_FAILED; ogl_ext_EXT_texture_mirror_clamp = ogl_LOAD_FAILED; ogl_ext_EXT_direct_state_access = ogl_LOAD_FAILED; + ogl_ext_EXT_debug_label = ogl_LOAD_FAILED; ogl_ext_GREMEDY_string_marker = ogl_LOAD_FAILED; } diff --git a/external/OpenGL/GL/gl_magnum.h b/external/OpenGL/GL/gl_magnum.h index 567373bfb..68bba02a0 100644 --- a/external/OpenGL/GL/gl_magnum.h +++ b/external/OpenGL/GL/gl_magnum.h @@ -170,6 +170,7 @@ extern int ogl_ext_ATI_texture_mirror_once; extern int ogl_ext_EXT_texture_filter_anisotropic; extern int ogl_ext_EXT_texture_mirror_clamp; extern int ogl_ext_EXT_direct_state_access; +extern int ogl_ext_EXT_debug_label; extern int ogl_ext_GREMEDY_string_marker; #define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 @@ -195,6 +196,15 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F #define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_SAMPLER 0x82E6 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 + #define GL_ALPHA 0x1906 #define GL_ALWAYS 0x0207 #define GL_AND 0x1501 @@ -497,10 +507,8 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_BLEND_COLOR 0x8005 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_EQUATION 0x8009 #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_BLEND_SRC_RGB 0x80C9 #define GL_CONSTANT_ALPHA 0x8003 @@ -1079,7 +1087,7 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_TESS_GEN_VERTEX_ORDER 0x8E78 #define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A #define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TRANSFORM_FEEDBACK 0x8E22 +/*Copied GL_TRANSFORM_FEEDBACK From: EXT_debug_label*/ #define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 @@ -1140,6 +1148,10 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 #define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 #define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D #define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 #define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 #define GL_IMAGE_1D 0x904C @@ -1256,11 +1268,11 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 #define GL_COMPRESSED_SRGB8_ETC2 0x9275 #define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267 #define GL_COMPUTE_SHADER 0x91B9 #define GL_COMPUTE_SUBROUTINE 0x92ED #define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 #define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 #define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 #define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 @@ -1354,13 +1366,13 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 #define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 #define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD -#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS 0x90EB #define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB #define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 #define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC #define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB #define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 #define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB #define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF #define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C #define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 @@ -1408,7 +1420,7 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 #define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 #define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 -#define GL_SAMPLER 0x82E6 +/*Copied GL_SAMPLER From: EXT_debug_label*/ #define GL_SHADER 0x82E1 #define GL_SHADER_IMAGE_ATOMIC 0x82A6 #define GL_SHADER_IMAGE_LOAD 0x82A4 @@ -1496,10 +1508,12 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_MAP_PERSISTENT_BIT 0x0040 #define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 #define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 #define GL_QUERY_BUFFER 0x9192 #define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 #define GL_QUERY_BUFFER_BINDING 0x9193 #define GL_QUERY_RESULT_NO_WAIT 0x9194 +#define GL_TEXTURE_BUFFER_BINDING 0x8C2A #define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B #define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C @@ -1509,13 +1523,13 @@ extern int ogl_ext_GREMEDY_string_marker; #define GL_ARB_robustness 1 extern GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glGetGraphicsResetStatusARB)(); #define glGetGraphicsResetStatusARB _ptrc_glGetGraphicsResetStatusARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnColorTableARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnColorTableARB)(GLenum, GLenum, GLenum, GLsizei, void *); #define glGetnColorTableARB _ptrc_glGetnColorTableARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnCompressedTexImageARB)(GLenum, GLint, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnCompressedTexImageARB)(GLenum, GLint, GLsizei, void *); #define glGetnCompressedTexImageARB _ptrc_glGetnCompressedTexImageARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, void *); #define glGetnConvolutionFilterARB _ptrc_glGetnConvolutionFilterARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnHistogramARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnHistogramARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, void *); #define glGetnHistogramARB _ptrc_glGetnHistogramARB extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMapdvARB)(GLenum, GLenum, GLsizei, GLdouble *); #define glGetnMapdvARB _ptrc_glGetnMapdvARB @@ -1523,7 +1537,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMapfvARB)(GLenum, GLe #define glGetnMapfvARB _ptrc_glGetnMapfvARB extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMapivARB)(GLenum, GLenum, GLsizei, GLint *); #define glGetnMapivARB _ptrc_glGetnMapivARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMinmaxARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnMinmaxARB)(GLenum, GLboolean, GLenum, GLenum, GLsizei, void *); #define glGetnMinmaxARB _ptrc_glGetnMinmaxARB extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPixelMapfvARB)(GLenum, GLsizei, GLfloat *); #define glGetnPixelMapfvARB _ptrc_glGetnPixelMapfvARB @@ -1533,9 +1547,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPixelMapusvARB)(GLenu #define glGetnPixelMapusvARB _ptrc_glGetnPixelMapusvARB extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnPolygonStippleARB)(GLsizei, GLubyte *); #define glGetnPolygonStippleARB _ptrc_glGetnPolygonStippleARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnSeparableFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *, GLsizei, GLvoid *, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnSeparableFilterARB)(GLenum, GLenum, GLenum, GLsizei, void *, GLsizei, void *, void *); #define glGetnSeparableFilterARB _ptrc_glGetnSeparableFilterARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnTexImageARB)(GLenum, GLint, GLenum, GLenum, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnTexImageARB)(GLenum, GLint, GLenum, GLenum, GLsizei, void *); #define glGetnTexImageARB _ptrc_glGetnTexImageARB extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformdvARB)(GLuint, GLint, GLsizei, GLdouble *); #define glGetnUniformdvARB _ptrc_glGetnUniformdvARB @@ -1545,7 +1559,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformivARB)(GLuint, #define glGetnUniformivARB _ptrc_glGetnUniformivARB extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetnUniformuivARB)(GLuint, GLint, GLsizei, GLuint *); #define glGetnUniformuivARB _ptrc_glGetnUniformuivARB -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadnPixelsARB)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadnPixelsARB)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void *); #define glReadnPixelsARB _ptrc_glReadnPixelsARB #endif /*GL_ARB_robustness*/ @@ -1560,33 +1574,33 @@ extern GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glCheckNamedFramebufferSt #define glCheckNamedFramebufferStatusEXT _ptrc_glCheckNamedFramebufferStatusEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClearNamedBufferDataEXT)(GLuint, GLenum, GLenum, GLenum, const void *); #define glClearNamedBufferDataEXT _ptrc_glClearNamedBufferDataEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClearNamedBufferSubDataEXT)(GLuint, GLenum, GLenum, GLenum, GLsizeiptr, GLsizeiptr, const void *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClearNamedBufferSubDataEXT)(GLuint, GLenum, GLsizeiptr, GLsizeiptr, GLenum, GLenum, const void *); #define glClearNamedBufferSubDataEXT _ptrc_glClearNamedBufferSubDataEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glClientAttribDefaultEXT)(GLbitfield); #define glClientAttribDefaultEXT _ptrc_glClientAttribDefaultEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *); #define glCompressedMultiTexImage1DEXT _ptrc_glCompressedMultiTexImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *); #define glCompressedMultiTexImage2DEXT _ptrc_glCompressedMultiTexImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *); #define glCompressedMultiTexImage3DEXT _ptrc_glCompressedMultiTexImage3DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *); #define glCompressedMultiTexSubImage1DEXT _ptrc_glCompressedMultiTexSubImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *); #define glCompressedMultiTexSubImage2DEXT _ptrc_glCompressedMultiTexSubImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *); #define glCompressedMultiTexSubImage3DEXT _ptrc_glCompressedMultiTexSubImage3DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage1DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage1DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *); #define glCompressedTextureImage1DEXT _ptrc_glCompressedTextureImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage2DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage2DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *); #define glCompressedTextureImage2DEXT _ptrc_glCompressedTextureImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage3DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureImage3DEXT)(GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *); #define glCompressedTextureImage3DEXT _ptrc_glCompressedTextureImage3DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *); #define glCompressedTextureSubImage1DEXT _ptrc_glCompressedTextureSubImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *); #define glCompressedTextureSubImage2DEXT _ptrc_glCompressedTextureSubImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *); #define glCompressedTextureSubImage3DEXT _ptrc_glCompressedTextureSubImage3DEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); #define glCopyMultiTexImage1DEXT _ptrc_glCopyMultiTexImage1DEXT @@ -1642,9 +1656,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenerateTextureMipmapEXT) #define glGenerateTextureMipmapEXT _ptrc_glGenerateTextureMipmapEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBooleanIndexedvEXT)(GLenum, GLuint, GLboolean *); #define glGetBooleanIndexedvEXT _ptrc_glGetBooleanIndexedvEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedMultiTexImageEXT)(GLenum, GLenum, GLint, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedMultiTexImageEXT)(GLenum, GLenum, GLint, void *); #define glGetCompressedMultiTexImageEXT _ptrc_glGetCompressedMultiTexImageEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTextureImageEXT)(GLuint, GLenum, GLint, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTextureImageEXT)(GLuint, GLenum, GLint, void *); #define glGetCompressedTextureImageEXT _ptrc_glGetCompressedTextureImageEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetDoubleIndexedvEXT)(GLenum, GLuint, GLdouble *); #define glGetDoubleIndexedvEXT _ptrc_glGetDoubleIndexedvEXT @@ -1668,7 +1682,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexGenfvEXT)(GLen #define glGetMultiTexGenfvEXT _ptrc_glGetMultiTexGenfvEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexGenivEXT)(GLenum, GLenum, GLenum, GLint *); #define glGetMultiTexGenivEXT _ptrc_glGetMultiTexGenivEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexImageEXT)(GLenum, GLenum, GLint, GLenum, GLenum, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexImageEXT)(GLenum, GLenum, GLint, GLenum, GLenum, void *); #define glGetMultiTexImageEXT _ptrc_glGetMultiTexImageEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexLevelParameterfvEXT)(GLenum, GLenum, GLint, GLenum, GLfloat *); #define glGetMultiTexLevelParameterfvEXT _ptrc_glGetMultiTexLevelParameterfvEXT @@ -1684,9 +1698,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetMultiTexParameterivEXT #define glGetMultiTexParameterivEXT _ptrc_glGetMultiTexParameterivEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferParameterivEXT)(GLuint, GLenum, GLint *); #define glGetNamedBufferParameterivEXT _ptrc_glGetNamedBufferParameterivEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferPointervEXT)(GLuint, GLenum, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferPointervEXT)(GLuint, GLenum, void **); #define glGetNamedBufferPointervEXT _ptrc_glGetNamedBufferPointervEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, void *); #define glGetNamedBufferSubDataEXT _ptrc_glGetNamedBufferSubDataEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedFramebufferAttachmentParameterivEXT)(GLuint, GLenum, GLenum, GLint *); #define glGetNamedFramebufferAttachmentParameterivEXT _ptrc_glGetNamedFramebufferAttachmentParameterivEXT @@ -1700,17 +1714,17 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramLocalParam #define glGetNamedProgramLocalParameterdvEXT _ptrc_glGetNamedProgramLocalParameterdvEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramLocalParameterfvEXT)(GLuint, GLenum, GLuint, GLfloat *); #define glGetNamedProgramLocalParameterfvEXT _ptrc_glGetNamedProgramLocalParameterfvEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramStringEXT)(GLuint, GLenum, GLenum, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramStringEXT)(GLuint, GLenum, GLenum, void *); #define glGetNamedProgramStringEXT _ptrc_glGetNamedProgramStringEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedProgramivEXT)(GLuint, GLenum, GLenum, GLint *); #define glGetNamedProgramivEXT _ptrc_glGetNamedProgramivEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetNamedRenderbufferParameterivEXT)(GLuint, GLenum, GLint *); #define glGetNamedRenderbufferParameterivEXT _ptrc_glGetNamedRenderbufferParameterivEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerIndexedvEXT)(GLenum, GLuint, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerIndexedvEXT)(GLenum, GLuint, void **); #define glGetPointerIndexedvEXT _ptrc_glGetPointerIndexedvEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointeri_vEXT)(GLenum, GLuint, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointeri_vEXT)(GLenum, GLuint, void **); #define glGetPointeri_vEXT _ptrc_glGetPointeri_vEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureImageEXT)(GLuint, GLenum, GLint, GLenum, GLenum, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureImageEXT)(GLuint, GLenum, GLint, GLenum, GLenum, void *); #define glGetTextureImageEXT _ptrc_glGetTextureImageEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTextureLevelParameterfvEXT)(GLuint, GLenum, GLint, GLenum, GLfloat *); #define glGetTextureLevelParameterfvEXT _ptrc_glGetTextureLevelParameterfvEXT @@ -1728,9 +1742,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayIntegeri_vE #define glGetVertexArrayIntegeri_vEXT _ptrc_glGetVertexArrayIntegeri_vEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayIntegervEXT)(GLuint, GLenum, GLint *); #define glGetVertexArrayIntegervEXT _ptrc_glGetVertexArrayIntegervEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointeri_vEXT)(GLuint, GLuint, GLenum, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointeri_vEXT)(GLuint, GLuint, GLenum, void **); #define glGetVertexArrayPointeri_vEXT _ptrc_glGetVertexArrayPointeri_vEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointervEXT)(GLuint, GLenum, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexArrayPointervEXT)(GLuint, GLenum, void **); #define glGetVertexArrayPointervEXT _ptrc_glGetVertexArrayPointervEXT extern GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsEnabledIndexedEXT)(GLenum, GLuint); #define glIsEnabledIndexedEXT _ptrc_glIsEnabledIndexedEXT @@ -1778,7 +1792,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMatrixTranslatefEXT)(GLen #define glMatrixTranslatefEXT _ptrc_glMatrixTranslatefEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexBufferEXT)(GLenum, GLenum, GLenum, GLuint); #define glMultiTexBufferEXT _ptrc_glMultiTexBufferEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexCoordPointerEXT)(GLenum, GLint, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexCoordPointerEXT)(GLenum, GLint, GLenum, GLsizei, const void *); #define glMultiTexCoordPointerEXT _ptrc_glMultiTexCoordPointerEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexEnvfEXT)(GLenum, GLenum, GLenum, GLfloat); #define glMultiTexEnvfEXT _ptrc_glMultiTexEnvfEXT @@ -1800,11 +1814,11 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexGeniEXT)(GLenum, #define glMultiTexGeniEXT _ptrc_glMultiTexGeniEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexGenivEXT)(GLenum, GLenum, GLenum, const GLint *); #define glMultiTexGenivEXT _ptrc_glMultiTexGenivEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *); #define glMultiTexImage1DEXT _ptrc_glMultiTexImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage2DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); #define glMultiTexImage2DEXT _ptrc_glMultiTexImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexImage3DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); #define glMultiTexImage3DEXT _ptrc_glMultiTexImage3DEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterIivEXT)(GLenum, GLenum, GLenum, const GLint *); #define glMultiTexParameterIivEXT _ptrc_glMultiTexParameterIivEXT @@ -1820,15 +1834,17 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexParameterivEXT)(G #define glMultiTexParameterivEXT _ptrc_glMultiTexParameterivEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexRenderbufferEXT)(GLenum, GLenum, GLuint); #define glMultiTexRenderbufferEXT _ptrc_glMultiTexRenderbufferEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage1DEXT)(GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *); #define glMultiTexSubImage1DEXT _ptrc_glMultiTexSubImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage2DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *); #define glMultiTexSubImage2DEXT _ptrc_glMultiTexSubImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiTexSubImage3DEXT)(GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *); #define glMultiTexSubImage3DEXT _ptrc_glMultiTexSubImage3DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferDataEXT)(GLuint, GLsizeiptr, const GLvoid *, GLenum); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferDataEXT)(GLuint, GLsizeiptr, const void *, GLenum); #define glNamedBufferDataEXT _ptrc_glNamedBufferDataEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferStorageEXT)(GLuint, GLsizeiptr, const void *, GLbitfield); +#define glNamedBufferStorageEXT _ptrc_glNamedBufferStorageEXT +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedBufferSubDataEXT)(GLuint, GLintptr, GLsizeiptr, const void *); #define glNamedBufferSubDataEXT _ptrc_glNamedBufferSubDataEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedCopyBufferSubDataEXT)(GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr); #define glNamedCopyBufferSubDataEXT _ptrc_glNamedCopyBufferSubDataEXT @@ -1870,7 +1886,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramLocalParamete #define glNamedProgramLocalParametersI4ivEXT _ptrc_glNamedProgramLocalParametersI4ivEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramLocalParametersI4uivEXT)(GLuint, GLenum, GLuint, GLsizei, const GLuint *); #define glNamedProgramLocalParametersI4uivEXT _ptrc_glNamedProgramLocalParametersI4uivEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramStringEXT)(GLuint, GLenum, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedProgramStringEXT)(GLuint, GLenum, GLenum, GLsizei, const void *); #define glNamedProgramStringEXT _ptrc_glNamedProgramStringEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glNamedRenderbufferStorageEXT)(GLuint, GLenum, GLsizei, GLsizei); #define glNamedRenderbufferStorageEXT _ptrc_glNamedRenderbufferStorageEXT @@ -1984,13 +2000,13 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureBufferEXT)(GLuint, #define glTextureBufferEXT _ptrc_glTextureBufferEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureBufferRangeEXT)(GLuint, GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); #define glTextureBufferRangeEXT _ptrc_glTextureBufferRangeEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *); #define glTextureImage1DEXT _ptrc_glTextureImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage2DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage2DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); #define glTextureImage2DEXT _ptrc_glTextureImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage3DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureImage3DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); #define glTextureImage3DEXT _ptrc_glTextureImage3DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexturePageCommitmentEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexturePageCommitmentEXT)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLboolean); #define glTexturePageCommitmentEXT _ptrc_glTexturePageCommitmentEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureParameterIivEXT)(GLuint, GLenum, GLenum, const GLint *); #define glTextureParameterIivEXT _ptrc_glTextureParameterIivEXT @@ -2016,11 +2032,11 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureStorage3DEXT)(GLui #define glTextureStorage3DEXT _ptrc_glTextureStorage3DEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureStorage3DMultisampleEXT)(GLuint, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); #define glTextureStorage3DMultisampleEXT _ptrc_glTextureStorage3DMultisampleEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage1DEXT)(GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *); #define glTextureSubImage1DEXT _ptrc_glTextureSubImage1DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage2DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *); #define glTextureSubImage2DEXT _ptrc_glTextureSubImage2DEXT -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTextureSubImage3DEXT)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *); #define glTextureSubImage3DEXT _ptrc_glTextureSubImage3DEXT extern GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glUnmapNamedBufferEXT)(GLuint); #define glUnmapNamedBufferEXT _ptrc_glUnmapNamedBufferEXT @@ -2044,6 +2060,8 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayTexCoordOffset #define glVertexArrayTexCoordOffsetEXT _ptrc_glVertexArrayTexCoordOffsetEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribBindingEXT)(GLuint, GLuint, GLuint); #define glVertexArrayVertexAttribBindingEXT _ptrc_glVertexArrayVertexAttribBindingEXT +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribDivisorEXT)(GLuint, GLuint, GLuint); +#define glVertexArrayVertexAttribDivisorEXT _ptrc_glVertexArrayVertexAttribDivisorEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribFormatEXT)(GLuint, GLuint, GLint, GLenum, GLboolean, GLuint); #define glVertexArrayVertexAttribFormatEXT _ptrc_glVertexArrayVertexAttribFormatEXT extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexAttribIFormatEXT)(GLuint, GLuint, GLint, GLenum, GLuint); @@ -2062,9 +2080,17 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexArrayVertexOffsetEX #define glVertexArrayVertexOffsetEXT _ptrc_glVertexArrayVertexOffsetEXT #endif /*GL_EXT_direct_state_access*/ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetObjectLabelEXT)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *); +#define glGetObjectLabelEXT _ptrc_glGetObjectLabelEXT +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glLabelObjectEXT)(GLenum, GLuint, GLsizei, const GLchar *); +#define glLabelObjectEXT _ptrc_glLabelObjectEXT +#endif /*GL_EXT_debug_label*/ + #ifndef GL_GREMEDY_string_marker #define GL_GREMEDY_string_marker 1 -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const void *); #define glStringMarkerGREMEDY _ptrc_glStringMarkerGREMEDY #endif /*GL_GREMEDY_string_marker*/ @@ -2112,7 +2138,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetIntegerv)(GLenum, GLin #define glGetIntegerv _ptrc_glGetIntegerv extern GLLOADGEN_EXPORT const GLubyte * (CODEGEN_FUNCPTR *_ptrc_glGetString)(GLenum); #define glGetString _ptrc_glGetString -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexImage)(GLenum, GLint, GLenum, GLenum, void *); #define glGetTexImage _ptrc_glGetTexImage extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *); #define glGetTexLevelParameterfv _ptrc_glGetTexLevelParameterfv @@ -2140,7 +2166,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPolygonMode)(GLenum, GLen #define glPolygonMode _ptrc_glPolygonMode extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadBuffer)(GLenum); #define glReadBuffer _ptrc_glReadBuffer -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *); #define glReadPixels _ptrc_glReadPixels extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissor)(GLint, GLint, GLsizei, GLsizei); #define glScissor _ptrc_glScissor @@ -2150,9 +2176,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStencilMask)(GLuint); #define glStencilMask _ptrc_glStencilMask extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStencilOp)(GLenum, GLenum, GLenum); #define glStencilOp _ptrc_glStencilOp -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const void *); #define glTexImage1D _ptrc_glTexImage1D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); #define glTexImage2D _ptrc_glTexImage2D extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexParameterf)(GLenum, GLenum, GLfloat); #define glTexParameterf _ptrc_glTexParameterf @@ -2179,58 +2205,58 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteTextures)(GLsizei, #define glDeleteTextures _ptrc_glDeleteTextures extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArrays)(GLenum, GLint, GLsizei); #define glDrawArrays _ptrc_glDrawArrays -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElements)(GLenum, GLsizei, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElements)(GLenum, GLsizei, GLenum, const void *); #define glDrawElements _ptrc_glDrawElements extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenTextures)(GLsizei, GLuint *); #define glGenTextures _ptrc_glGenTextures -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerv)(GLenum, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetPointerv)(GLenum, void **); #define glGetPointerv _ptrc_glGetPointerv extern GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsTexture)(GLuint); #define glIsTexture _ptrc_glIsTexture extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPolygonOffset)(GLfloat, GLfloat); #define glPolygonOffset _ptrc_glPolygonOffset -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const void *); #define glTexSubImage1D _ptrc_glTexSubImage1D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *); #define glTexSubImage2D _ptrc_glTexSubImage2D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat); -#define glBlendColor _ptrc_glBlendColor -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendEquation)(GLenum); -#define glBlendEquation _ptrc_glBlendEquation extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); #define glCopyTexSubImage3D _ptrc_glCopyTexSubImage3D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *); #define glDrawRangeElements _ptrc_glDrawRangeElements -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); #define glTexImage3D _ptrc_glTexImage3D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *); #define glTexSubImage3D _ptrc_glTexSubImage3D extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glActiveTexture)(GLenum); #define glActiveTexture _ptrc_glActiveTexture -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage1D)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage1D)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const void *); #define glCompressedTexImage1D _ptrc_glCompressedTexImage1D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *); #define glCompressedTexImage2D _ptrc_glCompressedTexImage2D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const void *); #define glCompressedTexImage3D _ptrc_glCompressedTexImage3D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const void *); #define glCompressedTexSubImage1D _ptrc_glCompressedTexSubImage1D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *); #define glCompressedTexSubImage2D _ptrc_glCompressedTexSubImage2D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *); #define glCompressedTexSubImage3D _ptrc_glCompressedTexSubImage3D -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTexImage)(GLenum, GLint, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetCompressedTexImage)(GLenum, GLint, void *); #define glGetCompressedTexImage _ptrc_glGetCompressedTexImage extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glSampleCoverage)(GLfloat, GLboolean); #define glSampleCoverage _ptrc_glSampleCoverage +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat); +#define glBlendColor _ptrc_glBlendColor +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendEquation)(GLenum); +#define glBlendEquation _ptrc_glBlendEquation extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum); #define glBlendFuncSeparate _ptrc_glBlendFuncSeparate extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawArrays)(GLenum, const GLint *, const GLsizei *, GLsizei); #define glMultiDrawArrays _ptrc_glMultiDrawArrays -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElements)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElements)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei); #define glMultiDrawElements _ptrc_glMultiDrawElements extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPointParameterf)(GLenum, GLfloat); #define glPointParameterf _ptrc_glPointParameterf @@ -2245,9 +2271,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBeginQuery)(GLenum, GLuin #define glBeginQuery _ptrc_glBeginQuery extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBindBuffer)(GLenum, GLuint); #define glBindBuffer _ptrc_glBindBuffer -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferData)(GLenum, GLsizeiptr, const GLvoid *, GLenum); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferData)(GLenum, GLsizeiptr, const void *, GLenum); #define glBufferData _ptrc_glBufferData -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void *); #define glBufferSubData _ptrc_glBufferSubData extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteBuffers)(GLsizei, const GLuint *); #define glDeleteBuffers _ptrc_glDeleteBuffers @@ -2261,9 +2287,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGenQueries)(GLsizei, GLui #define glGenQueries _ptrc_glGenQueries extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferParameteriv)(GLenum, GLenum, GLint *); #define glGetBufferParameteriv _ptrc_glGetBufferParameteriv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferPointerv)(GLenum, GLenum, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferPointerv)(GLenum, GLenum, void **); #define glGetBufferPointerv _ptrc_glGetBufferPointerv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferSubData)(GLenum, GLintptr, GLsizeiptr, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetBufferSubData)(GLenum, GLintptr, GLsizeiptr, void *); #define glGetBufferSubData _ptrc_glGetBufferSubData extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetQueryObjectiv)(GLuint, GLenum, GLint *); #define glGetQueryObjectiv _ptrc_glGetQueryObjectiv @@ -2328,7 +2354,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetUniformfv)(GLuint, GLi #define glGetUniformfv _ptrc_glGetUniformfv extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetUniformiv)(GLuint, GLint, GLint *); #define glGetUniformiv _ptrc_glGetUniformiv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribPointerv)(GLuint, GLenum, GLvoid **); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribPointerv)(GLuint, GLenum, void **); #define glGetVertexAttribPointerv _ptrc_glGetVertexAttribPointerv extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribdv)(GLuint, GLenum, GLdouble *); #define glGetVertexAttribdv _ptrc_glGetVertexAttribdv @@ -2464,7 +2490,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4uiv)(GLuint, #define glVertexAttrib4uiv _ptrc_glVertexAttrib4uiv extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttrib4usv)(GLuint, const GLushort *); #define glVertexAttrib4usv _ptrc_glVertexAttrib4usv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *); #define glVertexAttribPointer _ptrc_glVertexAttribPointer extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glUniformMatrix2x3fv)(GLint, GLsizei, GLboolean, const GLfloat *); @@ -2646,14 +2672,14 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4uiv)(GLuint #define glVertexAttribI4uiv _ptrc_glVertexAttribI4uiv extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribI4usv)(GLuint, const GLushort *); #define glVertexAttribI4usv _ptrc_glVertexAttribI4usv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribIPointer)(GLuint, GLint, GLenum, GLsizei, const void *); #define glVertexAttribIPointer _ptrc_glVertexAttribIPointer extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glCopyBufferSubData)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); #define glCopyBufferSubData _ptrc_glCopyBufferSubData extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysInstanced)(GLenum, GLint, GLsizei, GLsizei); #define glDrawArraysInstanced _ptrc_glDrawArraysInstanced -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstanced)(GLenum, GLsizei, GLenum, const void *, GLsizei); #define glDrawElementsInstanced _ptrc_glDrawElementsInstanced extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetActiveUniformBlockName)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *); #define glGetActiveUniformBlockName _ptrc_glGetActiveUniformBlockName @@ -2678,11 +2704,11 @@ extern GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glClientWaitSync)(GLsync, #define glClientWaitSync _ptrc_glClientWaitSync extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteSync)(GLsync); #define glDeleteSync _ptrc_glDeleteSync -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLint); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsBaseVertex)(GLenum, GLsizei, GLenum, const void *, GLint); #define glDrawElementsBaseVertex _ptrc_glDrawElementsBaseVertex -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertex)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsInstancedBaseVertex)(GLenum, GLsizei, GLenum, const void *, GLsizei, GLint); #define glDrawElementsInstancedBaseVertex _ptrc_glDrawElementsInstancedBaseVertex -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElementsBaseVertex)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawRangeElementsBaseVertex)(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *, GLint); #define glDrawRangeElementsBaseVertex _ptrc_glDrawRangeElementsBaseVertex extern GLLOADGEN_EXPORT GLsync (CODEGEN_FUNCPTR *_ptrc_glFenceSync)(GLenum, GLbitfield); #define glFenceSync _ptrc_glFenceSync @@ -2700,15 +2726,15 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetSynciv)(GLsync, GLenum #define glGetSynciv _ptrc_glGetSynciv extern GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsSync)(GLsync); #define glIsSync _ptrc_glIsSync -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElementsBaseVertex)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei, const GLint *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMultiDrawElementsBaseVertex)(GLenum, const GLsizei *, GLenum, const void *const*, GLsizei, const GLint *); #define glMultiDrawElementsBaseVertex _ptrc_glMultiDrawElementsBaseVertex extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProvokingVertex)(GLenum); #define glProvokingVertex _ptrc_glProvokingVertex extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glSampleMaski)(GLuint, GLbitfield); #define glSampleMaski _ptrc_glSampleMaski -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2DMultisample)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage2DMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); #define glTexImage2DMultisample _ptrc_glTexImage2DMultisample -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3DMultisample)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexImage3DMultisample)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); #define glTexImage3DMultisample _ptrc_glTexImage3DMultisample extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glWaitSync)(GLsync, GLbitfield, GLuint64); #define glWaitSync _ptrc_glWaitSync @@ -2784,9 +2810,9 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glBlendFunci)(GLuint, GLenu #define glBlendFunci _ptrc_glBlendFunci extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDeleteTransformFeedbacks)(GLsizei, const GLuint *); #define glDeleteTransformFeedbacks _ptrc_glDeleteTransformFeedbacks -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysIndirect)(GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawArraysIndirect)(GLenum, const void *); #define glDrawArraysIndirect _ptrc_glDrawArraysIndirect -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsIndirect)(GLenum, GLenum, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawElementsIndirect)(GLenum, GLenum, const void *); #define glDrawElementsIndirect _ptrc_glDrawElementsIndirect extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawTransformFeedback)(GLenum, GLuint); #define glDrawTransformFeedback _ptrc_glDrawTransformFeedback @@ -2885,7 +2911,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetDoublei_v)(GLenum, GLu #define glGetDoublei_v _ptrc_glGetDoublei_v extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetFloati_v)(GLenum, GLuint, GLfloat *); #define glGetFloati_v _ptrc_glGetFloati_v -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramBinary)(GLuint, GLsizei, GLsizei *, GLenum *, GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramBinary)(GLuint, GLsizei, GLsizei *, GLenum *, void *); #define glGetProgramBinary _ptrc_glGetProgramBinary extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetProgramPipelineInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); #define glGetProgramPipelineInfoLog _ptrc_glGetProgramPipelineInfoLog @@ -2897,7 +2923,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetVertexAttribLdv)(GLuin #define glGetVertexAttribLdv _ptrc_glGetVertexAttribLdv extern GLLOADGEN_EXPORT GLboolean (CODEGEN_FUNCPTR *_ptrc_glIsProgramPipeline)(GLuint); #define glIsProgramPipeline _ptrc_glIsProgramPipeline -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramBinary)(GLuint, GLenum, const GLvoid *, GLsizei); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramBinary)(GLuint, GLenum, const void *, GLsizei); #define glProgramBinary _ptrc_glProgramBinary extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glProgramParameteri)(GLuint, GLenum, GLint); #define glProgramParameteri _ptrc_glProgramParameteri @@ -3009,7 +3035,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissorIndexed)(GLuint, G #define glScissorIndexed _ptrc_glScissorIndexed extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glScissorIndexedv)(GLuint, const GLint *); #define glScissorIndexedv _ptrc_glScissorIndexedv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glShaderBinary)(GLsizei, const GLuint *, GLenum, const void *, GLsizei); #define glShaderBinary _ptrc_glShaderBinary extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glUseProgramStages)(GLuint, GLbitfield, GLuint); #define glUseProgramStages _ptrc_glUseProgramStages @@ -3031,7 +3057,7 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL4d)(GLuint, #define glVertexAttribL4d _ptrc_glVertexAttribL4d extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribL4dv)(GLuint, const GLdouble *); #define glVertexAttribL4dv _ptrc_glVertexAttribL4dv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribLPointer)(GLuint, GLint, GLenum, GLsizei, const GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glVertexAttribLPointer)(GLuint, GLint, GLenum, GLsizei, const void *); #define glVertexAttribLPointer _ptrc_glVertexAttribLPointer extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glViewportArrayv)(GLuint, GLsizei, const GLfloat *); #define glViewportArrayv _ptrc_glViewportArrayv @@ -3054,8 +3080,8 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glDrawTransformFeedbackStre #define glDrawTransformFeedbackStreamInstanced _ptrc_glDrawTransformFeedbackStreamInstanced extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetActiveAtomicCounterBufferiv)(GLuint, GLuint, GLenum, GLint *); #define glGetActiveAtomicCounterBufferiv _ptrc_glGetActiveAtomicCounterBufferiv -extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInternalformati64v)(GLenum, GLenum, GLenum, GLsizei, GLint64 *); -#define glGetInternalformati64v _ptrc_glGetInternalformati64v +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInternalformativ)(GLenum, GLenum, GLenum, GLsizei, GLint *); +#define glGetInternalformativ _ptrc_glGetInternalformativ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glMemoryBarrier)(GLbitfield); #define glMemoryBarrier _ptrc_glMemoryBarrier extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glTexStorage1D)(GLenum, GLsizei, GLenum, GLsizei); @@ -3089,6 +3115,8 @@ extern GLLOADGEN_EXPORT GLuint (CODEGEN_FUNCPTR *_ptrc_glGetDebugMessageLog)(GLu #define glGetDebugMessageLog _ptrc_glGetDebugMessageLog extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetFramebufferParameteriv)(GLenum, GLenum, GLint *); #define glGetFramebufferParameteriv _ptrc_glGetFramebufferParameteriv +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetInternalformati64v)(GLenum, GLenum, GLenum, GLsizei, GLint64 *); +#define glGetInternalformati64v _ptrc_glGetInternalformati64v extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetObjectLabel)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *); #define glGetObjectLabel _ptrc_glGetObjectLabel extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glGetObjectPtrLabel)(const void *, GLsizei, GLsizei *, GLchar *); From 100527cd3d4841af0fb1aa3bc7e9bd22a6439005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 21 Dec 2013 02:24:04 +0100 Subject: [PATCH 06/64] Remove obsolete glLoadGen-related workarounds. --- src/AbstractShaderProgram.cpp | 3 +-- src/TextureFormat.h | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp index c75ad6386..8a0ed38b6 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -117,9 +117,8 @@ Int AbstractShaderProgram::maxComputeWorkGroupInvocations() { GLint& value = Context::current()->state().shaderProgram->maxComputeWorkGroupInvocations; - /** @todo Fix when glLoadGen has `GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS` */ if(value == 0) - glGetIntegerv(/*GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS*/0x90EB, &value); + glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &value); return value; } diff --git a/src/TextureFormat.h b/src/TextureFormat.h index e9ebe6b81..6bab5073f 100644 --- a/src/TextureFormat.h +++ b/src/TextureFormat.h @@ -718,33 +718,29 @@ enum class TextureFormat: GLenum { * BPTC compressed RGB, unsigned float. * @requires_gl42 %Extension @extension{ARB,texture_compression_bptc} * @requires_gl BPTC texture compression is not available in OpenGL ES. - * @todo Remove workaround when glLoadGen has `GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT` */ - CompressedRGBBptcUnsignedFloat = 0x8E8F,//GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, + CompressedRGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, /** * BPTC compressed RGB, signed float. * @requires_gl42 %Extension @extension{ARB,texture_compression_bptc} * @requires_gl BPTC texture compression is not available in OpenGL ES. - * @todo Remove workaround when glLoadGen has `GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT` */ - CompressedRGBBptcSignedFloat = 0x8E8E,//GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, + CompressedRGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, /** * BPTC compressed RGBA, normalized unsigned. * @requires_gl42 %Extension @extension{ARB,texture_compression_bptc} * @requires_gl BPTC texture compression is not available in OpenGL ES. - * @todo Remove workaround when glLoadGen has `GL_COMPRESSED_RGBA_BPTC_UNORM` */ - CompressedRGBABptcUnorm = 0x8E8C,//GL_COMPRESSED_RGBA_BPTC_UNORM, + CompressedRGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM, /** * BPTC compressed sRGBA, normalized unsigned. * @requires_gl42 %Extension @extension{ARB,texture_compression_bptc} * @requires_gl BPTC texture compression is not available in OpenGL ES. - * @todo Remove workaround when glLoadGen has `GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM` */ - CompressedSRGBAlphaBptcUnorm = 0x8E8D,//GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, + CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, #endif /** From b2325dda2f59973c2ba6adc79845c81a09fc0780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 20 Dec 2013 22:40:56 +0100 Subject: [PATCH 07/64] Support for object labels from KHR_debug and EXT_debug_label. Can't test EXT_debug_label, as that is apparently OSX 10.9-only. Added GL tests for all implemented objects. KHR_debug is selected first, if that is not available, fall back to EXT_debug_label. If neither is available, the functions are no-op. I hope EXT_debug_label gets replaced by KHR_debug later, thus it is now only "emulated" through KHR_debug enums. --- src/AbstractObject.cpp | 219 +++++++++++++++++++++++ src/AbstractObject.h | 81 +++++++++ src/AbstractShaderProgram.cpp | 18 ++ src/AbstractShaderProgram.h | 30 +++- src/AbstractTexture.cpp | 10 ++ src/AbstractTexture.h | 29 ++- src/Buffer.cpp | 18 ++ src/Buffer.h | 31 +++- src/BufferTexture.h | 12 ++ src/CMakeLists.txt | 2 + src/Context.cpp | 2 +- src/CubeMapTexture.h | 4 + src/CubeMapTextureArray.h | 4 + src/Framebuffer.cpp | 10 ++ src/Framebuffer.h | 28 ++- src/Implementation/DebugState.cpp | 46 +++++ src/Implementation/DebugState.h | 48 +++++ src/Implementation/State.cpp | 17 +- src/Implementation/State.h | 8 +- src/Mesh.cpp | 18 ++ src/Mesh.h | 28 ++- src/Query.cpp | 21 +++ src/Query.h | 56 +++++- src/Renderbuffer.cpp | 12 +- src/Renderbuffer.h | 30 +++- src/Shader.cpp | 18 ++ src/Shader.h | 30 +++- src/Test/AbstractObjectGLTest.cpp | 55 ++++++ src/Test/AbstractQueryGLTest.cpp | 60 +++++++ src/Test/AbstractShaderProgramGLTest.cpp | 65 +++++++ src/Test/AbstractTextureGLTest.cpp | 60 +++++++ src/Test/BufferGLTest.cpp | 17 ++ src/Test/CMakeLists.txt | 8 + src/Test/FramebufferGLTest.cpp | 62 +++++++ src/Test/MeshGLTest.cpp | 60 +++++++ src/Test/RenderbufferGLTest.cpp | 60 +++++++ src/Test/ShaderGLTest.cpp | 60 +++++++ src/Texture.h | 4 + 38 files changed, 1320 insertions(+), 21 deletions(-) create mode 100644 src/AbstractObject.cpp create mode 100644 src/AbstractObject.h create mode 100644 src/Implementation/DebugState.cpp create mode 100644 src/Implementation/DebugState.h create mode 100644 src/Test/AbstractObjectGLTest.cpp create mode 100644 src/Test/AbstractQueryGLTest.cpp create mode 100644 src/Test/AbstractShaderProgramGLTest.cpp create mode 100644 src/Test/AbstractTextureGLTest.cpp create mode 100644 src/Test/FramebufferGLTest.cpp create mode 100644 src/Test/MeshGLTest.cpp create mode 100644 src/Test/RenderbufferGLTest.cpp create mode 100644 src/Test/ShaderGLTest.cpp diff --git a/src/AbstractObject.cpp b/src/AbstractObject.cpp new file mode 100644 index 000000000..3f84c2054 --- /dev/null +++ b/src/AbstractObject.cpp @@ -0,0 +1,219 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "AbstractObject.h" + +#include + +#include "Extensions.h" +#include "Implementation/State.h" +#include "Implementation/DebugState.h" + +namespace Magnum { + +namespace { + /* What the hell, Apple? Why you had to create this abomination _after_ + KHR_debug was released?! */ + inline GLenum extTypeFromKhrIdentifier(GLenum khrIdentifier) { + switch(khrIdentifier) { + #ifndef MAGNUM_TARGET_GLES + case GL_BUFFER: + #else + case GL_BUFFER_KHR: + #endif + return GL_BUFFER_OBJECT_EXT; + + #ifndef MAGNUM_TARGET_GLES + case GL_SHADER: + #else + case GL_SHADER_KHR: + #endif + return GL_SHADER_OBJECT_EXT; + + #ifndef MAGNUM_TARGET_GLES + case GL_PROGRAM: + #else + case GL_PROGRAM_KHR: + #endif + return GL_PROGRAM_OBJECT_EXT; + + #ifndef MAGNUM_TARGET_GLES + case GL_VERTEX_ARRAY: + #else + case GL_VERTEX_ARRAY_KHR: + #endif + return GL_VERTEX_ARRAY_OBJECT_EXT; + + #ifndef MAGNUM_TARGET_GLES + case GL_QUERY: + #else + case GL_QUERY_KHR: + #endif + return GL_QUERY_OBJECT_EXT; + + /** @todo Why isn't `GL_PROGRAM_PIPELINE_KHR` in ES's KHR_debug? */ + #ifndef MAGNUM_TARGET_GLES + case GL_PROGRAM_PIPELINE: + #else + case 0x82E4: //GL_PROGRAM_PIPELINE_KHR: + #endif + return GL_PROGRAM_PIPELINE_OBJECT_EXT; + + /** + * @todo Shouldn't ES2's KHR_debug have `GL_TRANSFORM_FEEDBACK_KHR` + * instead of `GL_TRANSFORM_FEEDBACK`? (it's a new enum in 2.0) + */ + case GL_TRANSFORM_FEEDBACK: + #ifndef MAGNUM_TARGET_GLES + case GL_SAMPLER: + #else + case GL_SAMPLER_KHR: + #endif + case GL_TEXTURE: + case GL_RENDERBUFFER: + case GL_FRAMEBUFFER: + return khrIdentifier; + } + + CORRADE_ASSERT_UNREACHABLE(); + } +} + +Int AbstractObject::maxLabelLength() { + if(!Context::current()->isExtensionSupported()) + return 0; + + GLint& value = Context::current()->state().debug->maxLabelLength; + + if(value == 0) { + #ifndef MAGNUM_TARGET_GLES + glGetIntegerv(GL_MAX_LABEL_LENGTH, &value); + #else + glGetIntegerv(GL_MAX_LABEL_LENGTH_KHR, &value); + #endif + } + + return value; +} + +void AbstractObject::labelImplementationNoOp(GLenum, GLuint, const std::string&) {} + +void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const std::string& label) { + #ifndef MAGNUM_TARGET_GLES + glObjectLabel(identifier, name, label.size(), label.data()); + #else + static_cast(identifier); + static_cast(name); + static_cast(label); + CORRADE_INTERNAL_ASSERT(false); + //glObjectLabelKHR(identifier, name, label.size(), label.data()); + #endif +} + +void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const std::string& label) { + const GLenum type = extTypeFromKhrIdentifier(identifier); + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES + glLabelObjectEXT(type, name, label.size(), label.data()); + #else + static_cast(type); + static_cast(name); + static_cast(label); + CORRADE_INTERNAL_ASSERT(false); + #endif +} + +std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return {}; } + +std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) { + /** + * @todo Get rid of this workaround when NVidia returns proper size for + * length=0 & label=nullptr (even crashes on length>0 & label=nullptr) + */ + #if 0 + /* Get label size (w/o null terminator) */ + GLsizei size; + #ifndef MAGNUM_TARGET_GLES + glGetObjectLabel(type, name, 0, &size, nullptr); + #else + glGetObjectLabelKHR(type, name, 0, &size, nullptr); + #endif + + /* Make place also for the null terminator */ + std::string label; + label.resize(size+1); + #ifndef MAGNUM_TARGET_GLES + glGetObjectLabel(identifier, name, size+1, nullptr, &label[0]); + #else + glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]); + #endif + + /* Pop null terminator and return the string */ + label.pop_back(); + return label; + #else + GLsizei size; + std::string label; + label.resize(maxLabelLength()); + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES + glGetObjectLabel(identifier, name, label.size(), &size, &label[0]); + #else + static_cast(identifier); + static_cast(name); + CORRADE_INTERNAL_ASSERT(false); + //glGetObjectLabelKHR(identifier, name, label.size(), &size, &label[0]); + #endif + return label.substr(0, size); + #endif +} + +std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) { + const GLenum type = extTypeFromKhrIdentifier(identifier); + + /* Get label size (w/o null terminator) */ + GLsizei size; + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES + glGetObjectLabelEXT(type, name, 0, &size, nullptr); + #else + static_cast(type); + static_cast(name); + CORRADE_INTERNAL_ASSERT(false); + #endif + + /* Make place also for the null terminator */ + std::string label; + label.resize(size+1); + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES + glGetObjectLabelEXT(identifier, name, size+1, nullptr, &label[0]); + #endif + + /* Pop null terminator and return the string */ + label.pop_back(); + return label; +} + +} diff --git a/src/AbstractObject.h b/src/AbstractObject.h new file mode 100644 index 000000000..cbb75373e --- /dev/null +++ b/src/AbstractObject.h @@ -0,0 +1,81 @@ +#ifndef Magnum_AbstractObject_h +#define Magnum_AbstractObject_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Class @ref Magnum::AbstractObject + */ + +#include + +#include "OpenGL.h" +#include "Types.h" +#include "magnumVisibility.h" + +namespace Magnum { + +namespace Implementation { + struct DebugState; +} + +/** +@brief Base for all OpenGL objects +*/ +class MAGNUM_EXPORT AbstractObject { + friend class Context; + friend class Implementation::DebugState; + + public: + /** + * @brief Max object label length + * + * The result is cached, repeated queries don't result in repeated + * OpenGL calls. If @extension{KHR,debug} desktop or ES extension is + * not available, returns `0`. Note that @extension{EXT,debug_label} + * has no such limit. + * @see @ref AbstractQuery::setLabel(), @ref AbstractShaderProgram::setLabel(), + * @ref AbstractTexture::setLabel(), @ref Buffer::setLabel(), + * @ref BufferTexture::setLabel(), @ref Framebuffer::setLabel(), + * @ref Mesh::setLabel(), @ref Renderbuffer::setLabel(), + * @ref Shader::setLabel(), @fn_gl{Get} with @def_gl{MAX_LABEL_LENGTH} + */ + static Int maxLabelLength(); + + protected: + MAGNUM_LOCAL AbstractObject() = default; + MAGNUM_LOCAL ~AbstractObject() = default; + + private: + static MAGNUM_LOCAL void labelImplementationNoOp(GLenum, GLuint, const std::string&); + static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, const std::string& label); + static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, const std::string& label); + static MAGNUM_LOCAL std::string getLabelImplementationNoOp(GLenum, GLuint); + static MAGNUM_LOCAL std::string getLabelImplementationExt(GLenum identifier, GLuint name); + static MAGNUM_LOCAL std::string getLabelImplementationKhr(GLenum identifier, GLuint name); +}; + +} + +#endif diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp index 8a0ed38b6..cccaa31c5 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -27,6 +27,7 @@ #include "Math/RectangularMatrix.h" #include "Extensions.h" #include "Shader.h" +#include "Implementation/DebugState.h" #include "Implementation/ShaderProgramState.h" #include "Implementation/State.h" @@ -251,6 +252,23 @@ AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&& return *this; } +std::string AbstractShaderProgram::label() const { + #ifndef MAGNUM_TARGET_GLES + return Context::current()->state().debug->getLabelImplementation(GL_PROGRAM, _id); + #else + return Context::current()->state().debug->getLabelImplementation(GL_PROGRAM_KHR, _id); + #endif +} + +AbstractShaderProgram& AbstractShaderProgram::setLabel(const std::string& label) { + #ifndef MAGNUM_TARGET_GLES + Context::current()->state().debug->labelImplementation(GL_PROGRAM, _id, label); + #else + Context::current()->state().debug->labelImplementation(GL_PROGRAM_KHR, _id, label); + #endif + return *this; +} + std::pair AbstractShaderProgram::validate() { glValidateProgram(_id); diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 4ce0e6e46..570566380 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -31,8 +31,8 @@ #include #include +#include "AbstractObject.h" #include "Magnum.h" -#include "OpenGL.h" #include "magnumVisibility.h" namespace Magnum { @@ -317,7 +317,7 @@ comes in handy. status, should be faster -- https://twitter.com/g_truc/status/352778836657700866 @todo `GL_NUM_{PROGRAM,SHADER}_BINARY_FORMATS` + `GL_{PROGRAM,SHADER}_BINARY_FORMATS` (vector), (@extension{ARB,ES2_compatibility}) */ -class MAGNUM_EXPORT AbstractShaderProgram { +class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { friend class Context; public: @@ -508,6 +508,32 @@ class MAGNUM_EXPORT AbstractShaderProgram { /** @brief OpenGL program ID */ GLuint id() const { return _id; } + /** + * @brief %Shader program label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} with @def_gl{PROGRAM} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{PROGRAM_OBJECT_EXT} + */ + std::string label() const; + + /** + * @brief Set shader program label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with + * @def_gl{PROGRAM} or @fn_gl_extension{LabelObject,EXT,object_label} + * with @def_gl{PROGRAM_OBJECT_EXT} + */ + AbstractShaderProgram& setLabel(const std::string& label); + /** * @brief Validate program * diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 3402ee414..0f7d1684e 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -31,6 +31,7 @@ #include "Image.h" #include "Shader.h" #include "TextureFormat.h" +#include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/TextureState.h" @@ -158,6 +159,15 @@ AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) { return *this; } +std::string AbstractTexture::label() const { + return Context::current()->state().debug->getLabelImplementation(GL_TEXTURE, _id); +} + +AbstractTexture& AbstractTexture::setLabel(const std::string& label) { + Context::current()->state().debug->labelImplementation(GL_TEXTURE, _id, label); + return *this; +} + void AbstractTexture::bind(Int layer) { Implementation::TextureState* const textureState = Context::current()->state().texture; diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index d05ef82b5..70c74f6d2 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -31,6 +31,7 @@ #include "Array.h" #include "Color.h" #include "Sampler.h" +#include "AbstractObject.h" namespace Magnum { @@ -95,7 +96,7 @@ nothing. @todo `GL_NUM_COMPRESSED_TEXTURE_FORMATS` when compressed textures are implemented @todo `GL_MAX_SAMPLE_MASK_WORDS` when @extension{ARB,texture_multisample} is done */ -class MAGNUM_EXPORT AbstractTexture { +class MAGNUM_EXPORT AbstractTexture: public AbstractObject { friend class Context; public: @@ -165,6 +166,32 @@ class MAGNUM_EXPORT AbstractTexture { /** @brief Move assignment */ AbstractTexture& operator=(AbstractTexture&& other); + /** + * @brief %Texture label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{TEXTURE} + */ + std::string label() const; + + /** + * @brief Set texture label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or + * @fn_gl_extension{LabelObject,EXT,object_label} with + * @def_gl{TEXTURE} + */ + AbstractTexture& setLabel(const std::string& label); + /** @brief OpenGL texture ID */ GLuint id() const { return _id; } diff --git a/src/Buffer.cpp b/src/Buffer.cpp index a0638faa7..809450ee2 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -30,6 +30,7 @@ #include "Extensions.h" #include "Implementation/State.h" #include "Implementation/BufferState.h" +#include "Implementation/DebugState.h" namespace Magnum { @@ -160,6 +161,23 @@ Buffer::~Buffer() { glDeleteBuffers(1, &_id); } +std::string Buffer::label() const { + #ifndef MAGNUM_TARGET_GLES + return Context::current()->state().debug->getLabelImplementation(GL_BUFFER, _id); + #else + return Context::current()->state().debug->getLabelImplementation(GL_BUFFER_KHR, _id); + #endif +} + +Buffer& Buffer::setLabel(const std::string& label) { + #ifndef MAGNUM_TARGET_GLES + Context::current()->state().debug->labelImplementation(GL_BUFFER, _id, label); + #else + Context::current()->state().debug->labelImplementation(GL_BUFFER_KHR, _id, label); + #endif + return *this; +} + void Buffer::bind(Target target, GLuint id) { GLuint& bound = Context::current()->state().buffer->bindings[Implementation::BufferState::indexForTarget(target)]; diff --git a/src/Buffer.h b/src/Buffer.h index a3fc8ca17..173fbe2a5 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -35,9 +35,8 @@ #include #include +#include "AbstractObject.h" #include "Magnum.h" -#include "OpenGL.h" -#include "magnumVisibility.h" namespace Magnum { @@ -189,7 +188,7 @@ nothing. @todo Support for AMD/ARB's query buffer (@extension{AMD,query_buffer_object}, @extension{ARB,query_buffer_object}) @todo BindBufferRange/BindBufferOffset/BindBufferBase for transform feedback (3.0, @extension{EXT,transform_feedback}) */ -class MAGNUM_EXPORT Buffer { +class MAGNUM_EXPORT Buffer: public AbstractObject { friend class Context; public: @@ -549,6 +548,32 @@ class MAGNUM_EXPORT Buffer { /** @brief OpenGL buffer ID */ GLuint id() const { return _id; } + /** + * @brief %Buffer label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} with @def_gl{BUFFER} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{BUFFER_OBJECT_EXT} + */ + std::string label() const; + + /** + * @brief Set buffer label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with + * @def_gl{BUFFER} or @fn_gl_extension{LabelObject,EXT,object_label} + * with @def_gl{BUFFER_OBJECT_EXT} + */ + Buffer& setLabel(const std::string& label); + /** @brief Target hint */ Target targetHint() const { return _targetHint; } diff --git a/src/BufferTexture.h b/src/BufferTexture.h index 8d92854de..ac9d37286 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -207,8 +207,20 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { BufferTexture& operator=(BufferTexture&&) = delete; public: + /** @copydoc AbstractTexture::maxLabelLength() */ + static Int maxLabelLength() { return AbstractTexture::maxLabelLength(); } + explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} + /** @copydoc AbstractTexture::label() */ + std::string label() const { return AbstractTexture::label(); } + + /** @copydoc AbstractTexture::setLabel() */ + BufferTexture& setLabel(const std::string& label) { + AbstractTexture::setLabel(label); + return *this; + } + /** @copydoc AbstractTexture::bind() */ void bind(Int layer) { AbstractTexture::bind(layer); } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1da7f8738..aa9bc7516 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,6 +48,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake set(Magnum_SRCS AbstractFramebuffer.cpp AbstractImage.cpp + AbstractObject.cpp AbstractTexture.cpp AbstractShaderProgram.cpp Buffer.cpp @@ -69,6 +70,7 @@ set(Magnum_SRCS Timeline.cpp Implementation/BufferState.cpp + Implementation/DebugState.cpp Implementation/State.cpp Implementation/TextureState.cpp diff --git a/src/Context.cpp b/src/Context.cpp index 97f50eb4a..26b34a719 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -420,7 +420,7 @@ Context::Context() { _current = this; /* Initialize state tracker */ - _state = new Implementation::State; + _state = new Implementation::State(*this); /* Initialize functionality based on current OpenGL version and extensions */ AbstractFramebuffer::initializeContextBasedFunctionality(*this); diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index 1183a5081..f55df5418 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -224,6 +224,10 @@ class CubeMapTexture: public AbstractTexture { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT + CubeMapTexture& setLabel(const std::string& label) { + AbstractTexture::setLabel(label); + return *this; + } CubeMapTexture& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { AbstractTexture::setMinificationFilter(filter, mipmap); return *this; diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index c28489c90..4d238cdf9 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -229,6 +229,10 @@ class CubeMapTextureArray: public AbstractTexture { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT + CubeMapTextureArray& setLabel(const std::string& label) { + AbstractTexture::setLabel(label); + return *this; + } CubeMapTextureArray& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { AbstractTexture::setMinificationFilter(filter, mipmap); return *this; diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index be4eea498..79942aad7 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -31,6 +31,7 @@ #include "Renderbuffer.h" #include "Texture.h" +#include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/FramebufferState.h" @@ -86,6 +87,15 @@ Framebuffer::~Framebuffer() { glDeleteFramebuffers(1, &_id); } +std::string Framebuffer::label() const { + return Context::current()->state().debug->getLabelImplementation(GL_FRAMEBUFFER, _id); +} + +Framebuffer& Framebuffer::setLabel(const std::string& label) { + Context::current()->state().debug->labelImplementation(GL_FRAMEBUFFER, _id, label); + return *this; +} + Framebuffer& Framebuffer::mapForDraw(std::initializer_list> attachments) { /* Max attachment location */ std::size_t max = 0; diff --git a/src/Framebuffer.h b/src/Framebuffer.h index c1c5ebffc..af3c74c48 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -100,7 +100,7 @@ documentation for more information. @requires_gl30 %Extension @extension{ARB,framebuffer_object} */ -class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { +class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObject { friend class Context; public: @@ -304,6 +304,32 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { */ ~Framebuffer(); + /** + * @brief %Framebuffer label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{FRAMEBUFFER} + */ + std::string label() const; + + /** + * @brief Set framebuffer label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or + * @fn_gl_extension{LabelObject,EXT,object_label} with + * @def_gl{FRAMEBUFFER} + */ + Framebuffer& setLabel(const std::string& label); + /** * @brief Check framebuffer status * @param target Target for which check the status diff --git a/src/Implementation/DebugState.cpp b/src/Implementation/DebugState.cpp new file mode 100644 index 000000000..f0c1c1e19 --- /dev/null +++ b/src/Implementation/DebugState.cpp @@ -0,0 +1,46 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "DebugState.h" + +#include "AbstractObject.h" +#include "Context.h" +#include "Extensions.h" + +namespace Magnum { namespace Implementation { + +DebugState::DebugState(Context& context): maxLabelLength(0) { + if(context.isExtensionSupported()) { + getLabelImplementation = &AbstractObject::getLabelImplementationKhr; + labelImplementation = &AbstractObject::labelImplementationKhr; + } else if(context.isExtensionSupported()) { + getLabelImplementation = &AbstractObject::getLabelImplementationExt; + labelImplementation = &AbstractObject::labelImplementationExt; + } else { + getLabelImplementation = &AbstractObject::getLabelImplementationNoOp; + labelImplementation = &AbstractObject::labelImplementationNoOp; + } +} + +}} diff --git a/src/Implementation/DebugState.h b/src/Implementation/DebugState.h new file mode 100644 index 000000000..b6f1b2fae --- /dev/null +++ b/src/Implementation/DebugState.h @@ -0,0 +1,48 @@ +#ifndef Magnum_Implementation_DebugState_h +#define Magnum_Implementation_DebugState_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "Magnum.h" +#include "OpenGL.h" + +namespace Magnum { namespace Implementation { + +struct DebugState { + DebugState(Context& context); + + typedef std::string(*GetLabelImplementation)(GLenum, GLuint); + GetLabelImplementation getLabelImplementation; + + typedef void(*LabelImplementation)(GLenum, GLuint, const std::string&); + LabelImplementation labelImplementation; + + GLint maxLabelLength; +}; + +}} + +#endif diff --git a/src/Implementation/State.cpp b/src/Implementation/State.cpp index 7fd1619f8..309aa9d6b 100644 --- a/src/Implementation/State.cpp +++ b/src/Implementation/State.cpp @@ -24,7 +24,10 @@ #include "State.h" +#include "Context.h" +#include "Extensions.h" #include "Implementation/BufferState.h" +#include "Implementation/DebugState.h" #include "Implementation/FramebufferState.h" #include "Implementation/MeshState.h" #include "Implementation/RendererState.h" @@ -34,14 +37,23 @@ namespace Magnum { namespace Implementation { -State::State(): +State::State(Context& context): buffer(new BufferState), + debug(new DebugState(context)), framebuffer(new FramebufferState), mesh(new MeshState), renderer(new RendererState), shader(new ShaderState), shaderProgram(new ShaderProgramState), - texture(new TextureState) {} + texture(new TextureState) { + + Debug() << "Using optional features:"; + + if(context.isExtensionSupported()) + Debug() << " " << Extensions::GL::KHR::debug::string(); + else if(context.isExtensionSupported()) + Debug() << " " << Extensions::GL::EXT::debug_label::string(); +} State::~State() { delete texture; @@ -50,6 +62,7 @@ State::~State() { delete renderer; delete mesh; delete framebuffer; + delete debug; delete buffer; } diff --git a/src/Implementation/State.h b/src/Implementation/State.h index 79b322d76..36570baa3 100644 --- a/src/Implementation/State.h +++ b/src/Implementation/State.h @@ -24,9 +24,12 @@ DEALINGS IN THE SOFTWARE. */ +#include "Magnum.h" + namespace Magnum { namespace Implementation { struct BufferState; +struct DebugState; struct FramebufferState; struct MeshState; struct RendererState; @@ -35,10 +38,13 @@ struct ShaderProgramState; struct TextureState; struct State { - State(); + /* Initializes context-based functionality */ + State(Context& context); + ~State(); BufferState* const buffer; + DebugState* const debug; FramebufferState* const framebuffer; MeshState* const mesh; RendererState* const renderer; diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 6aa1e8475..7224c78df 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -29,6 +29,7 @@ #include "Buffer.h" #include "Context.h" #include "Extensions.h" +#include "Implementation/DebugState.h" #include "Implementation/BufferState.h" #include "Implementation/MeshState.h" #include "Implementation/State.h" @@ -137,6 +138,23 @@ Mesh& Mesh::operator=(Mesh&& other) noexcept { return *this; } +std::string Mesh::label() const { + #ifndef MAGNUM_TARGET_GLES + return Context::current()->state().debug->getLabelImplementation(GL_VERTEX_ARRAY, _id); + #else + return Context::current()->state().debug->getLabelImplementation(GL_VERTEX_ARRAY_KHR, _id); + #endif +} + +Mesh& Mesh::setLabel(const std::string& label) { + #ifndef MAGNUM_TARGET_GLES + Context::current()->state().debug->labelImplementation(GL_VERTEX_ARRAY, _id, label); + #else + Context::current()->state().debug->labelImplementation(GL_VERTEX_ARRAY_KHR, _id, label); + #endif + return *this; +} + Mesh& Mesh::setIndexBuffer(Buffer& buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) { #if defined(CORRADE_TARGET_NACL) || defined(CORRADE_TARGET_EMSCRIPTEN) CORRADE_ASSERT(buffer.targetHint() == Buffer::Target::ElementArray, diff --git a/src/Mesh.h b/src/Mesh.h index bc61c2956..a76478a1c 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -307,7 +307,7 @@ drawing commands are used on desktop OpenGL and OpenGL ES 3.0. See also @todo test vertex specification & drawing @todo How to glDrawElementsBaseVertex()/vertex offset -- in draw()? */ -class MAGNUM_EXPORT Mesh { +class MAGNUM_EXPORT Mesh: public AbstractObject { friend class Context; friend class MeshView; @@ -415,6 +415,32 @@ class MAGNUM_EXPORT Mesh { */ GLuint id() const { return _id; } + /** + * @brief %Mesh label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} with @def_gl{VERTEX_ARRAY} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{VERTEX_ARRAY_OBJECT_EXT} + */ + std::string label() const; + + /** + * @brief Set mesh label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with + * @def_gl{VERTEX_ARRAY} or @fn_gl_extension{LabelObject,EXT,object_label} + * with @def_gl{VERTEX_ARRAY_OBJECT_EXT} + */ + Mesh& setLabel(const std::string& label); + /** * @brief Index size * diff --git a/src/Query.cpp b/src/Query.cpp index 79203c0d7..acebc666b 100644 --- a/src/Query.cpp +++ b/src/Query.cpp @@ -26,6 +26,10 @@ #include +#include "Context.h" +#include "Implementation/DebugState.h" +#include "Implementation/State.h" + namespace Magnum { AbstractQuery::AbstractQuery(): target() { @@ -48,6 +52,23 @@ AbstractQuery::~AbstractQuery() { #endif } +std::string AbstractQuery::label() const { + #ifndef MAGNUM_TARGET_GLES + return Context::current()->state().debug->getLabelImplementation(GL_QUERY, _id); + #else + return Context::current()->state().debug->getLabelImplementation(GL_QUERY_KHR, _id); + #endif +} + +AbstractQuery& AbstractQuery::setLabel(const std::string& label) { + #ifndef MAGNUM_TARGET_GLES + Context::current()->state().debug->labelImplementation(GL_QUERY, _id, label); + #else + Context::current()->state().debug->labelImplementation(GL_QUERY_KHR, _id, label); + #endif + return *this; +} + bool AbstractQuery::resultAvailable() { CORRADE_ASSERT(!target, "AbstractQuery::resultAvailable(): the query is currently running", false); diff --git a/src/Query.h b/src/Query.h index 9e4f8fad0..12922bc65 100644 --- a/src/Query.h +++ b/src/Query.h @@ -30,10 +30,8 @@ #include -#include "OpenGL.h" -#include "Types.h" +#include "AbstractObject.h" #include "magnumConfigure.h" -#include "magnumVisibility.h" namespace Magnum { @@ -45,11 +43,37 @@ information. @todo Support for AMD's query buffer (@extension{AMD,query_buffer_object}) @requires_gles30 %Extension @es_extension{EXT,occlusion_query_boolean} */ -class MAGNUM_EXPORT AbstractQuery { +class MAGNUM_EXPORT AbstractQuery: public AbstractObject { public: /** @brief OpenGL query ID */ GLuint id() const { return _id; } + /** + * @brief %Query label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} with @def_gl{QUERY} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{QUERY_OBJECT_EXT} + */ + std::string label() const; + + /** + * @brief Set query label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with + * @def_gl{QUERY} or @fn_gl_extension{LabelObject,EXT,object_label} + * with @def_gl{QUERY_OBJECT_EXT} + */ + AbstractQuery& setLabel(const std::string& label); + /** * @brief Whether the result is available * @@ -166,6 +190,14 @@ class PrimitiveQuery: public AbstractQuery { void begin(Target target) { AbstractQuery::begin(GLenum(target)); } + + /* Overloads to remove WTF-factor from method chaining order */ + #ifndef DOXYGEN_GENERATING_OUTPUT + PrimitiveQuery& setLabel(const std::string& label) { + AbstractQuery::setLabel(label); + return *this; + } + #endif }; #endif @@ -303,6 +335,14 @@ class SampleQuery: public AbstractQuery { glEndConditionalRender(); } #endif + + /* Overloads to remove WTF-factor from method chaining order */ + #ifndef DOXYGEN_GENERATING_OUTPUT + SampleQuery& setLabel(const std::string& label) { + AbstractQuery::setLabel(label); + return *this; + } + #endif }; /** @@ -370,6 +410,14 @@ class TimeQuery: public AbstractQuery { void begin(Target target) { AbstractQuery::begin(GLenum(target)); } + + /* Overloads to remove WTF-factor from method chaining order */ + #ifndef DOXYGEN_GENERATING_OUTPUT + TimeQuery& setLabel(const std::string& label) { + AbstractQuery::setLabel(label); + return *this; + } + #endif }; } diff --git a/src/Renderbuffer.cpp b/src/Renderbuffer.cpp index b97d860e0..10900c100 100644 --- a/src/Renderbuffer.cpp +++ b/src/Renderbuffer.cpp @@ -27,8 +27,9 @@ #include "Context.h" #include "Extensions.h" -#include "Implementation/State.h" +#include "Implementation/DebugState.h" #include "Implementation/FramebufferState.h" +#include "Implementation/State.h" namespace Magnum { @@ -78,6 +79,15 @@ Renderbuffer::~Renderbuffer() { glDeleteRenderbuffers(1, &_id); } +std::string Renderbuffer::label() const { + return Context::current()->state().debug->getLabelImplementation(GL_RENDERBUFFER, _id); +} + +Renderbuffer& Renderbuffer::setLabel(const std::string& label) { + Context::current()->state().debug->labelImplementation(GL_RENDERBUFFER, _id, label); + return *this; +} + void Renderbuffer::bind() { GLuint& binding = Context::current()->state().framebuffer->renderbufferBinding; diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 1e11819e4..2f1faf58d 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -28,8 +28,8 @@ * @brief Class Magnum::Renderbuffer */ +#include "AbstractObject.h" #include "Magnum.h" -#include "OpenGL.h" #include "magnumVisibility.h" namespace Magnum { @@ -53,7 +53,7 @@ See its documentation for more information. @requires_gl30 %Extension @extension{ARB,framebuffer_object} */ -class MAGNUM_EXPORT Renderbuffer { +class MAGNUM_EXPORT Renderbuffer: public AbstractObject { friend class Context; Renderbuffer(const Renderbuffer&) = delete; @@ -102,6 +102,32 @@ class MAGNUM_EXPORT Renderbuffer { /** @brief OpenGL internal renderbuffer ID */ GLuint id() const { return _id; } + /** + * @brief %Renderbuffer label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{RENDERBUFFER} + */ + std::string label() const; + + /** + * @brief Set renderbuffer label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or + * @fn_gl_extension{LabelObject,EXT,object_label} with + * @def_gl{RENDERBUFFER} + */ + Renderbuffer& setLabel(const std::string& label); + /** * @brief Set renderbuffer storage * @param internalFormat Internal format diff --git a/src/Shader.cpp b/src/Shader.cpp index f0e345744..b75c91c16 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -29,6 +29,7 @@ #include #include "Extensions.h" +#include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/ShaderState.h" @@ -581,6 +582,23 @@ Shader& Shader::operator=(Shader&& other) { return *this; } +std::string Shader::label() const { + #ifndef MAGNUM_TARGET_GLES + return Context::current()->state().debug->getLabelImplementation(GL_SHADER, _id); + #else + return Context::current()->state().debug->getLabelImplementation(GL_SHADER_KHR, _id); + #endif +} + +Shader& Shader::setLabel(const std::string& label) { + #ifndef MAGNUM_TARGET_GLES + Context::current()->state().debug->labelImplementation(GL_SHADER, _id, label); + #else + Context::current()->state().debug->labelImplementation(GL_SHADER_KHR, _id, label); + #endif + return *this; +} + Shader& Shader::addSource(std::string source) { if(!source.empty()) { #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(__MINGW32__) diff --git a/src/Shader.h b/src/Shader.h index 5bfb732f3..9d20c0c81 100644 --- a/src/Shader.h +++ b/src/Shader.h @@ -31,7 +31,7 @@ #include #include -#include "Magnum.h" +#include "AbstractObject.h" #include "Context.h" #include "magnumVisibility.h" @@ -43,7 +43,7 @@ namespace Magnum { See AbstractShaderProgram for more information. */ -class MAGNUM_EXPORT Shader { +class MAGNUM_EXPORT Shader: public AbstractObject { Shader(const Shader&) = delete; Shader& operator=(const Shader&) = delete; @@ -456,6 +456,32 @@ class MAGNUM_EXPORT Shader { /** @brief OpenGL shader ID */ GLuint id() const { return _id; } + /** + * @brief %Shader label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} with @def_gl{SHADER} or + * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @def_gl{SHADER_OBJECT_EXT} + */ + std::string label() const; + + /** + * @brief Set shader label + * @return Reference to self (for method chaining) + * + * Default is empty string. If neither @extension{KHR,debug} nor + * @extension{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with + * @def_gl{SHADER} or @fn_gl_extension{LabelObject,EXT,object_label} + * with @def_gl{SHADER_OBJECT_EXT} + */ + Shader& setLabel(const std::string& label); + /** * @brief Add shader source * @param source String with shader source diff --git a/src/Test/AbstractObjectGLTest.cpp b/src/Test/AbstractObjectGLTest.cpp new file mode 100644 index 000000000..fe27d3973 --- /dev/null +++ b/src/Test/AbstractObjectGLTest.cpp @@ -0,0 +1,55 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Buffer.h" +#include "Context.h" +#include "Extensions.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class AbstractObjectGLTest: public AbstractOpenGLTester { + public: + explicit AbstractObjectGLTest(); + + void labelNoOp(); +}; + +AbstractObjectGLTest::AbstractObjectGLTest() { + addTests({&AbstractObjectGLTest::labelNoOp}); +} + +void AbstractObjectGLTest::labelNoOp() { + if(Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is supported.")); + + Buffer buffer; + buffer.setLabel("MyBuffer"); + CORRADE_COMPARE(buffer.label(), ""); + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::AbstractObjectGLTest) diff --git a/src/Test/AbstractQueryGLTest.cpp b/src/Test/AbstractQueryGLTest.cpp new file mode 100644 index 000000000..b7ecd37bf --- /dev/null +++ b/src/Test/AbstractQueryGLTest.cpp @@ -0,0 +1,60 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Context.h" +#include "Extensions.h" +#include "Query.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class AbstractQueryGLTest: public AbstractOpenGLTester { + public: + explicit AbstractQueryGLTest(); + + void label(); +}; + +AbstractQueryGLTest::AbstractQueryGLTest() { + addTests({&AbstractQueryGLTest::label}); +} + +void AbstractQueryGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + SampleQuery query; + CORRADE_COMPARE(query.label(), ""); + + query.setLabel("MyQuery"); + CORRADE_COMPARE(query.label(), "MyQuery"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::AbstractQueryGLTest) diff --git a/src/Test/AbstractShaderProgramGLTest.cpp b/src/Test/AbstractShaderProgramGLTest.cpp new file mode 100644 index 000000000..3bb3a7a6b --- /dev/null +++ b/src/Test/AbstractShaderProgramGLTest.cpp @@ -0,0 +1,65 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "AbstractShaderProgram.h" +#include "Context.h" +#include "Extensions.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class AbstractShaderProgramGLTest: public AbstractOpenGLTester { + public: + explicit AbstractShaderProgramGLTest(); + + void label(); +}; + +AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() { + addTests({&AbstractShaderProgramGLTest::label}); +} + +void AbstractShaderProgramGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + class MyShader: public AbstractShaderProgram { + public: + explicit MyShader() {} + }; + + MyShader shader; + CORRADE_COMPARE(shader.label(), ""); + + shader.setLabel("MyShader"); + CORRADE_COMPARE(shader.label(), "MyShader"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramGLTest) diff --git a/src/Test/AbstractTextureGLTest.cpp b/src/Test/AbstractTextureGLTest.cpp new file mode 100644 index 000000000..fdf8d9539 --- /dev/null +++ b/src/Test/AbstractTextureGLTest.cpp @@ -0,0 +1,60 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Context.h" +#include "Extensions.h" +#include "Texture.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class AbstractTextureGLTest: public AbstractOpenGLTester { + public: + explicit AbstractTextureGLTest(); + + void label(); +}; + +AbstractTextureGLTest::AbstractTextureGLTest() { + addTests({&AbstractTextureGLTest::label}); +} + +void AbstractTextureGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Texture2D texture; + CORRADE_COMPARE(texture.label(), ""); + + texture.setLabel("MyTexture"); + CORRADE_COMPARE(texture.label(), "MyTexture"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::AbstractTextureGLTest) diff --git a/src/Test/BufferGLTest.cpp b/src/Test/BufferGLTest.cpp index 48029b5a8..f510948c8 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Test/BufferGLTest.cpp @@ -38,6 +38,7 @@ class BufferGLTest: public AbstractOpenGLTester { explicit BufferGLTest(); void construct(); + void label(); void data(); void map(); #ifdef MAGNUM_TARGET_GLES2 @@ -55,6 +56,7 @@ class BufferGLTest: public AbstractOpenGLTester { BufferGLTest::BufferGLTest() { addTests({&BufferGLTest::construct, + &BufferGLTest::label, &BufferGLTest::data, &BufferGLTest::map, #ifdef MAGNUM_TARGET_GLES2 @@ -81,6 +83,21 @@ void BufferGLTest::construct() { MAGNUM_VERIFY_NO_ERROR(); } +void BufferGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Buffer buffer; + CORRADE_COMPARE(buffer.label(), ""); + + buffer.setLabel("MyBuffer"); + CORRADE_COMPARE(buffer.label(), "MyBuffer"); + + MAGNUM_VERIFY_NO_ERROR(); +} + void BufferGLTest::data() { Buffer buffer; diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index 855cd581b..42496328b 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -35,8 +35,16 @@ corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES MagnumTes corrade_add_test(SamplerTest SamplerTest.cpp LIBRARIES Magnum) if(BUILD_GL_TESTS) + corrade_add_test(AbstractObjectGLTest AbstractObjectGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(AbstractQueryGLTest AbstractQueryGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(AbstractShaderProgramGLTest AbstractShaderProgramGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(AbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(BufferGLTest BufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ContextGLTest ContextGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(FramebufferGLTest FramebufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(MeshGLTest MeshGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(RenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) endif() set_target_properties(ResourceManagerTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) diff --git a/src/Test/FramebufferGLTest.cpp b/src/Test/FramebufferGLTest.cpp new file mode 100644 index 000000000..3b3dd7b9e --- /dev/null +++ b/src/Test/FramebufferGLTest.cpp @@ -0,0 +1,62 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Context.h" +#include "Extensions.h" +#include "Framebuffer.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class FramebufferGLTest: public AbstractOpenGLTester { + public: + explicit FramebufferGLTest(); + + void label(); +}; + +FramebufferGLTest::FramebufferGLTest() { + addTests({&FramebufferGLTest::label}); +} + +void FramebufferGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Framebuffer framebuffer({{}, Vector2i(32)}); + + CORRADE_COMPARE(framebuffer.label(), ""); + MAGNUM_VERIFY_NO_ERROR(); + + framebuffer.setLabel("MyFramebuffer"); + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer"); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::FramebufferGLTest) diff --git a/src/Test/MeshGLTest.cpp b/src/Test/MeshGLTest.cpp new file mode 100644 index 000000000..6efd4dc20 --- /dev/null +++ b/src/Test/MeshGLTest.cpp @@ -0,0 +1,60 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Context.h" +#include "Extensions.h" +#include "Mesh.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class MeshGLTest: public AbstractOpenGLTester { + public: + explicit MeshGLTest(); + + void label(); +}; + +MeshGLTest::MeshGLTest() { + addTests({&MeshGLTest::label}); +} + +void MeshGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Mesh mesh; + CORRADE_COMPARE(mesh.label(), ""); + + mesh.setLabel("MyMesh"); + CORRADE_COMPARE(mesh.label(), "MyMesh"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::MeshGLTest) diff --git a/src/Test/RenderbufferGLTest.cpp b/src/Test/RenderbufferGLTest.cpp new file mode 100644 index 000000000..f6cd2862c --- /dev/null +++ b/src/Test/RenderbufferGLTest.cpp @@ -0,0 +1,60 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Context.h" +#include "Extensions.h" +#include "Renderbuffer.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class RenderbufferGLTest: public AbstractOpenGLTester { + public: + explicit RenderbufferGLTest(); + + void label(); +}; + +RenderbufferGLTest::RenderbufferGLTest() { + addTests({&RenderbufferGLTest::label}); +} + +void RenderbufferGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Renderbuffer renderbuffer; + CORRADE_COMPARE(renderbuffer.label(), ""); + + renderbuffer.setLabel("MyRenderbuffer"); + CORRADE_COMPARE(renderbuffer.label(), "MyRenderbuffer"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::RenderbufferGLTest) diff --git a/src/Test/ShaderGLTest.cpp b/src/Test/ShaderGLTest.cpp new file mode 100644 index 000000000..909f3a03f --- /dev/null +++ b/src/Test/ShaderGLTest.cpp @@ -0,0 +1,60 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Context.h" +#include "Extensions.h" +#include "Shader.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class ShaderGLTest: public AbstractOpenGLTester { + public: + explicit ShaderGLTest(); + + void label(); +}; + +ShaderGLTest::ShaderGLTest() { + addTests({&ShaderGLTest::label}); +} + +void ShaderGLTest::label() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + Shader shader(Version::GL210, Shader::Type::Vertex); + CORRADE_COMPARE(shader.label(), ""); + + shader.setLabel("MyShader"); + CORRADE_COMPARE(shader.label(), "MyShader"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::ShaderGLTest) diff --git a/src/Texture.h b/src/Texture.h index 6ed901b4d..e94a60a3a 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -423,6 +423,10 @@ template class Texture: public AbstractTexture { /* Overloads to remove WTF-factor from method chaining order */ #ifndef DOXYGEN_GENERATING_OUTPUT + Texture& setLabel(const std::string& label) { + AbstractTexture::setLabel(label); + return *this; + } Texture& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) { AbstractTexture::setMinificationFilter(filter, mipmap); return *this; From 92a161fbda18ce5450b81b6bb82ae53414972dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 20 Dec 2013 22:44:45 +0100 Subject: [PATCH 08/64] Platform: display label limits in magnum-info. --- src/Platform/magnum-info.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Platform/magnum-info.cpp b/src/Platform/magnum-info.cpp index 182a4e28c..8ddd22c72 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Platform/magnum-info.cpp @@ -350,6 +350,12 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat _l(Sampler::maxAnisotropy()) } + if(c->isExtensionSupported()) { + _h(KHR::debug) + + _l(AbstractObject::maxLabelLength()) + } + #undef _l #undef _h } From c24bae8431fa8001a7d483d1282b96d1b0e6d11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 21 Dec 2013 13:07:00 +0100 Subject: [PATCH 09/64] Fix tests on ES build. --- src/Test/ShaderGLTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Test/ShaderGLTest.cpp b/src/Test/ShaderGLTest.cpp index 909f3a03f..43d1d131e 100644 --- a/src/Test/ShaderGLTest.cpp +++ b/src/Test/ShaderGLTest.cpp @@ -46,7 +46,11 @@ void ShaderGLTest::label() { !Context::current()->isExtensionSupported()) CORRADE_SKIP("Required extension is not available"); + #ifndef MAGNUM_TARGET_GLES Shader shader(Version::GL210, Shader::Type::Vertex); + #else + Shader shader(Version::GLES200, Shader::Type::Vertex); + #endif CORRADE_COMPARE(shader.label(), ""); shader.setLabel("MyShader"); From d1144b048487bf1c497c6aa8ae5995f2254fa3f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 21 Dec 2013 13:11:42 +0100 Subject: [PATCH 10/64] GCC 4.6 compatibility: no std::string::pop_back(). --- src/AbstractObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AbstractObject.cpp b/src/AbstractObject.cpp index 3f84c2054..036e64526 100644 --- a/src/AbstractObject.cpp +++ b/src/AbstractObject.cpp @@ -170,7 +170,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c #endif /* Pop null terminator and return the string */ - label.pop_back(); + label.resize(size); return label; #else GLsizei size; @@ -212,7 +212,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c #endif /* Pop null terminator and return the string */ - label.pop_back(); + label.resize(size); return label; } From 4c33f86101cd64b4994925732dbc74b2605dc9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 09:07:39 +0100 Subject: [PATCH 11/64] Doxyfile: added annother variant of extension links. --- Doxyfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doxyfile b/Doxyfile index 9ca729e08..72837b78a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -208,6 +208,7 @@ ALIASES = \ "todoc=@xrefitem todoc \"Documentation todo\" \"Documentation-related todo list\"" \ "fn_gl{1}=gl\1()" \ "fn_gl_extension{3}=gl\1\2()" \ + "fn_gl_extension2{3}=gl\1\2()" \ "fn_gles_extension{3}=gl\1\2()" \ "def_gl{1}=`GL_\1`" \ "deprecated_gl=@xrefitem deprecated-gl \"Deprecated OpenGL API\" \"Deprecated OpenGL API list\"" \ @@ -222,6 +223,7 @@ ALIASES = \ "requires_gl44=@xrefitem requires-gl44 \"Requires OpenGL 4.4\" \"Functionality requiring OpenGL 4.4\"" \ "requires_extension=@xrefitem requires-extension \"Requires OpenGL extension\" \"Functionality requiring specific OpenGL extension\"" \ "extension{2}=\1_\2" \ + "extension2{2}=\1_\2" \ "requires_gles30=@xrefitem requires-gles30 \"Requires OpenGL ES 3.0\" \"Functionality requiring OpenGL ES 3.0\"" \ "requires_gl=@xrefitem requires-gl \"Requires desktop OpenGL\" \"Functionality requiring desktop OpenGL (not available in OpenGL ES)\"" \ "requires_gles20=@xrefitem requires-gles20 \"Requires OpenGL ES 2.0\" \"Functionality requiring OpenGL ES 2.0 (not available in ES 3.0 and desktop OpenGL)\"" \ From f1e2bf3b931d2d8977e8e716764bec1c3339664a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 09:08:27 +0100 Subject: [PATCH 12/64] Fixed documentation links to EXT_debug_label. --- src/AbstractObject.h | 2 +- src/AbstractShaderProgram.h | 8 ++++---- src/AbstractTexture.h | 8 ++++---- src/Buffer.h | 12 ++++++------ src/Framebuffer.h | 8 ++++---- src/Mesh.h | 8 ++++---- src/Query.h | 8 ++++---- src/Renderbuffer.h | 8 ++++---- src/Shader.h | 8 ++++---- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/AbstractObject.h b/src/AbstractObject.h index cbb75373e..befdbced6 100644 --- a/src/AbstractObject.h +++ b/src/AbstractObject.h @@ -53,7 +53,7 @@ class MAGNUM_EXPORT AbstractObject { * * The result is cached, repeated queries don't result in repeated * OpenGL calls. If @extension{KHR,debug} desktop or ES extension is - * not available, returns `0`. Note that @extension{EXT,debug_label} + * not available, returns `0`. Note that @extension2{EXT,debug_label} * has no such limit. * @see @ref AbstractQuery::setLabel(), @ref AbstractShaderProgram::setLabel(), * @ref AbstractTexture::setLabel(), @ref Buffer::setLabel(), diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 570566380..7917e1f4b 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -513,10 +513,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} with @def_gl{PROGRAM} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{PROGRAM_OBJECT_EXT} */ std::string label() const; @@ -526,10 +526,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with - * @def_gl{PROGRAM} or @fn_gl_extension{LabelObject,EXT,object_label} + * @def_gl{PROGRAM} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{PROGRAM_OBJECT_EXT} */ AbstractShaderProgram& setLabel(const std::string& label); diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 70c74f6d2..495aeef00 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -171,10 +171,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{TEXTURE} */ std::string label() const; @@ -184,10 +184,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or - * @fn_gl_extension{LabelObject,EXT,object_label} with + * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{TEXTURE} */ AbstractTexture& setLabel(const std::string& label); diff --git a/src/Buffer.h b/src/Buffer.h index 173fbe2a5..456aba154 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -553,10 +553,10 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} with @def_gl{BUFFER} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{BUFFER_OBJECT_EXT} */ std::string label() const; @@ -566,11 +566,11 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. - * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with - * @def_gl{BUFFER} or @fn_gl_extension{LabelObject,EXT,object_label} - * with @def_gl{BUFFER_OBJECT_EXT} + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with @def_gl{BUFFER} + * or @fn_gl_extension2{LabelObject,EXT,debug_label} with + * @def_gl{BUFFER_OBJECT_EXT} */ Buffer& setLabel(const std::string& label); diff --git a/src/Framebuffer.h b/src/Framebuffer.h index af3c74c48..6abf5f870 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -309,10 +309,10 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{FRAMEBUFFER} */ std::string label() const; @@ -322,10 +322,10 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or - * @fn_gl_extension{LabelObject,EXT,object_label} with + * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{FRAMEBUFFER} */ Framebuffer& setLabel(const std::string& label); diff --git a/src/Mesh.h b/src/Mesh.h index a76478a1c..6d41aba32 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -420,10 +420,10 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} with @def_gl{VERTEX_ARRAY} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{VERTEX_ARRAY_OBJECT_EXT} */ std::string label() const; @@ -433,10 +433,10 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with - * @def_gl{VERTEX_ARRAY} or @fn_gl_extension{LabelObject,EXT,object_label} + * @def_gl{VERTEX_ARRAY} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{VERTEX_ARRAY_OBJECT_EXT} */ Mesh& setLabel(const std::string& label); diff --git a/src/Query.h b/src/Query.h index 12922bc65..8ac079f13 100644 --- a/src/Query.h +++ b/src/Query.h @@ -53,10 +53,10 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} with @def_gl{QUERY} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{QUERY_OBJECT_EXT} */ std::string label() const; @@ -66,10 +66,10 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with - * @def_gl{QUERY} or @fn_gl_extension{LabelObject,EXT,object_label} + * @def_gl{QUERY} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{QUERY_OBJECT_EXT} */ AbstractQuery& setLabel(const std::string& label); diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 2f1faf58d..a97ed7c91 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -107,10 +107,10 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{RENDERBUFFER} */ std::string label() const; @@ -120,10 +120,10 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or - * @fn_gl_extension{LabelObject,EXT,object_label} with + * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{RENDERBUFFER} */ Renderbuffer& setLabel(const std::string& label); diff --git a/src/Shader.h b/src/Shader.h index 9d20c0c81..e4a663673 100644 --- a/src/Shader.h +++ b/src/Shader.h @@ -461,10 +461,10 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * * The result is *not* cached, repeated queries will result in repeated * OpenGL calls. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function returns empty string. * @see @fn_gl{GetObjectLabel} with @def_gl{SHADER} or - * @fn_gl_extension{GetObjectLabel,EXT,object_label} with + * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{SHADER_OBJECT_EXT} */ std::string label() const; @@ -474,10 +474,10 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * @return Reference to self (for method chaining) * * Default is empty string. If neither @extension{KHR,debug} nor - * @extension{EXT,debug_label} desktop or ES extension is available, + * @extension2{EXT,debug_label} desktop or ES extension is available, * this function does nothing. * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with - * @def_gl{SHADER} or @fn_gl_extension{LabelObject,EXT,object_label} + * @def_gl{SHADER} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{SHADER_OBJECT_EXT} */ Shader& setLabel(const std::string& label); From 34954a54e3a2f12732608b13ef554daae7db49d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 15:50:12 +0100 Subject: [PATCH 13/64] Use std::string::data() instead of std::string::c_str(). Meaningless changes on meaningless day. --- src/AbstractShaderProgram.cpp | 8 ++++---- src/DebugMarker.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/AbstractShaderProgram.cpp b/src/AbstractShaderProgram.cpp index cccaa31c5..53da8b755 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -298,15 +298,15 @@ void AbstractShaderProgram::attachShader(Shader& shader) { } void AbstractShaderProgram::bindAttributeLocation(UnsignedInt location, const std::string& name) { - glBindAttribLocation(_id, location, name.c_str()); + glBindAttribLocation(_id, location, name.data()); } #ifndef MAGNUM_TARGET_GLES void AbstractShaderProgram::bindFragmentDataLocation(UnsignedInt location, const std::string& name) { - glBindFragDataLocation(_id, location, name.c_str()); + glBindFragDataLocation(_id, location, name.data()); } void AbstractShaderProgram::bindFragmentDataLocationIndexed(UnsignedInt location, UnsignedInt index, const std::string& name) { - glBindFragDataLocationIndexed(_id, location, index, name.c_str()); + glBindFragDataLocationIndexed(_id, location, index, name.data()); } #endif @@ -347,7 +347,7 @@ bool AbstractShaderProgram::link() { } Int AbstractShaderProgram::uniformLocation(const std::string& name) { - GLint location = glGetUniformLocation(_id, name.c_str()); + GLint location = glGetUniformLocation(_id, name.data()); if(location == -1) Warning() << "AbstractShaderProgram: location of uniform \'" + name + "\' cannot be retrieved!"; return location; diff --git a/src/DebugMarker.cpp b/src/DebugMarker.cpp index 47049c742..bebac87ca 100644 --- a/src/DebugMarker.cpp +++ b/src/DebugMarker.cpp @@ -51,10 +51,10 @@ void DebugMarker::markImplementationDefault(const std::string&) {} void DebugMarker::markImplementationDebugger(const std::string& string) { /** @todo Re-enable when extension wrangler is available for ES */ #ifndef MAGNUM_TARGET_GLES - glStringMarkerGREMEDY(string.length(), string.c_str()); + glStringMarkerGREMEDY(string.length(), string.data()); #else #if 0 - glInsertEventMarkerEXT(string.length(), string.c_str()); + glInsertEventMarkerEXT(string.length(), string.data()); #else static_cast(string); #endif From 2c73bbb0b977310d82491a9e67ae55966581f9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 15:50:39 +0100 Subject: [PATCH 14/64] Remove offensive comment. EXT_debug_label originated in ES and that was way before KHR_debug. In fact, KHR_debug is inspired after that. --- src/AbstractObject.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/AbstractObject.cpp b/src/AbstractObject.cpp index 036e64526..564cd90af 100644 --- a/src/AbstractObject.cpp +++ b/src/AbstractObject.cpp @@ -33,8 +33,6 @@ namespace Magnum { namespace { - /* What the hell, Apple? Why you had to create this abomination _after_ - KHR_debug was released?! */ inline GLenum extTypeFromKhrIdentifier(GLenum khrIdentifier) { switch(khrIdentifier) { #ifndef MAGNUM_TARGET_GLES From c4a28965cb0cde948296d7cac0eb62cabbd0a649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 17:33:18 +0100 Subject: [PATCH 15/64] modules: updated FindCorrade.cmake from Corrade repository. --- modules/FindCorrade.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index 4e5a164d0..0c5c83f0f 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -26,6 +26,9 @@ # CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated APIs # included # CORRADE_BUILD_STATIC - Defined if compiled as static libraries +# CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor +# (Linux, BSD, OS X) +# CORRADE_TARGET_WINDOWS - Defined if compiled for Windows # CORRADE_TARGET_NACL - Defined if compiled for Google Chrome # Native Client # CORRADE_TARGET_NACL_NEWLIB - Defined if compiled for Google Chrome @@ -171,6 +174,14 @@ string(FIND "${_corradeConfigure}" "#define CORRADE_BUILD_STATIC" _BUILD_STATIC) if(NOT _BUILD_STATIC EQUAL -1) set(CORRADE_BUILD_STATIC 1) endif() +string(FIND "${_corradeConfigure}" "#define CORRADE_TARGET_UNIX" _TARGET_UNIX) +if(NOT _TARGET_UNIX EQUAL -1) + set(CORRADE_TARGET_UNIX 1) +endif() +string(FIND "${_corradeConfigure}" "#define CORRADE_TARGET_WINDOWS" _TARGET_WINDOWS) +if(NOT _TARGET_WINDOWS EQUAL -1) + set(CORRADE_TARGET_WINDOWS 1) +endif() string(FIND "${_corradeConfigure}" "#define CORRADE_TARGET_NACL" _TARGET_NACL) if(NOT _TARGET_NACL EQUAL -1) set(CORRADE_TARGET_NACL 1) From c9104906e7912c7d4ba7985840b1fa2f59be0787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 17:34:32 +0100 Subject: [PATCH 16/64] Use CORRADE_TARGET_WINDOWS instead of _WIN32. --- src/DebugTools/ResourceManager.cpp | 2 +- src/DebugTools/ResourceManager.h | 2 +- src/Math/Matrix4.h | 2 +- src/Platform/Sdl2Application.h | 2 +- src/SceneGraph/AbstractCamera.h | 2 +- src/SceneGraph/AbstractFeature.h | 2 +- src/SceneGraph/AbstractObject.h | 2 +- src/SceneGraph/AbstractTransformation.h | 2 +- src/SceneGraph/Animable.h | 2 +- src/SceneGraph/AnimableGroup.h | 2 +- src/SceneGraph/Camera2D.h | 2 +- src/SceneGraph/Camera3D.h | 4 ++-- src/SceneGraph/DualComplexTransformation.h | 2 +- src/SceneGraph/DualQuaternionTransformation.h | 2 +- src/SceneGraph/FeatureGroup.h | 2 +- src/SceneGraph/MatrixTransformation2D.h | 2 +- src/SceneGraph/MatrixTransformation3D.h | 2 +- src/SceneGraph/RigidMatrixTransformation2D.h | 2 +- src/SceneGraph/RigidMatrixTransformation3D.h | 2 +- src/SceneGraph/TranslationTransformation.h | 2 +- src/SceneGraph/instantiation.cpp | 2 +- 21 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/DebugTools/ResourceManager.cpp b/src/DebugTools/ResourceManager.cpp index 8a8491f55..b13186081 100644 --- a/src/DebugTools/ResourceManager.cpp +++ b/src/DebugTools/ResourceManager.cpp @@ -35,7 +35,7 @@ namespace Magnum { -#ifndef _WIN32 +#ifndef CORRADE_TARGET_WINDOWS template class ResourceManager; #else template class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager; diff --git a/src/DebugTools/ResourceManager.h b/src/DebugTools/ResourceManager.h index c83ecd7a2..eecd8c592 100644 --- a/src/DebugTools/ResourceManager.h +++ b/src/DebugTools/ResourceManager.h @@ -45,7 +45,7 @@ namespace Magnum { /** @todo Do the listing in one place, not five thousand! */ -#ifndef _WIN32 +#ifndef CORRADE_TARGET_WINDOWS extern template ResourceManager MAGNUM_DEBUGTOOLS_EXPORT *& ResourceManager::internalInstance(); #else extern template class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager; diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index 12464fc9d..c71dfe634 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -31,7 +31,7 @@ #include "Math/Matrix.h" #include "Math/Vector4.h" -#ifdef _WIN32 /* I so HATE windef.h */ +#ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */ #undef near #undef far #endif diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index 50e9339bf..2f460a1f5 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -34,7 +34,7 @@ #include "Math/Vector2.h" #include "Magnum.h" -#ifdef _WIN32 /* Windows version of SDL2 redefines main(), we don't want that */ +#ifdef CORRADE_TARGET_WINDOWS /* Windows version of SDL2 redefines main(), we don't want that */ #define SDL_MAIN_HANDLED #endif #include diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 981ca9ea1..eb2a66ae4 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -209,7 +209,7 @@ typedef AbstractBasicCamera3D AbstractCamera3D; typedef AbstractCamera<3, Float> AbstractCamera3D; #endif -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera<2, Float>; extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera<3, Float>; #endif diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 4959fd631..5580afa9c 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -341,7 +341,7 @@ typedef AbstractBasicFeature3D AbstractFeature3D; typedef AbstractFeature<3, Float> AbstractFeature3D; #endif -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<2, Float>; extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>; #endif diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index 42228f852..ffe781a70 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -277,7 +277,7 @@ typedef AbstractBasicObject3D AbstractObject3D; typedef AbstractObject<3, Float> AbstractObject3D; #endif -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<2, Float>; extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractObject<3, Float>; #endif diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index 33e74ab09..0ba971d82 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -144,7 +144,7 @@ typedef AbstractBasicTransformation3D AbstractTransformation3D; typedef AbstractTransformation<3, Float> AbstractTransformation3D; #endif -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation<2, Float>; extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractTransformation<3, Float>; #endif diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 6da6a2d5a..453d6def2 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -380,7 +380,7 @@ typedef BasicAnimable3D Animable3D; typedef Animable<3, Float> Animable3D; #endif -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Animable<2, Float>; extern template class MAGNUM_SCENEGRAPH_EXPORT Animable<3, Float>; #endif diff --git a/src/SceneGraph/AnimableGroup.h b/src/SceneGraph/AnimableGroup.h index da42aaa6f..d88623fb9 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -118,7 +118,7 @@ typedef BasicAnimableGroup3D AnimableGroup3D; typedef AnimableGroup<3, Float> AnimableGroup3D; #endif -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup<2, Float>; extern template class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup<3, Float>; #endif diff --git a/src/SceneGraph/Camera2D.h b/src/SceneGraph/Camera2D.h index 09183c9ef..610af6419 100644 --- a/src/SceneGraph/Camera2D.h +++ b/src/SceneGraph/Camera2D.h @@ -105,7 +105,7 @@ template class BasicCamera2D: public AbstractCamera<2, T> { */ typedef BasicCamera2D Camera2D; -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D; #endif diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 8b126458b..d6744d953 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -30,7 +30,7 @@ #include "AbstractCamera.h" -#ifdef _WIN32 /* I so HATE windef.h */ +#ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */ #undef near #undef far #endif @@ -141,7 +141,7 @@ template class BasicCamera3D: public AbstractCamera<3, T> { */ typedef BasicCamera3D Camera3D; -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D; #endif diff --git a/src/SceneGraph/DualComplexTransformation.h b/src/SceneGraph/DualComplexTransformation.h index 6037fab9e..e5302af2f 100644 --- a/src/SceneGraph/DualComplexTransformation.h +++ b/src/SceneGraph/DualComplexTransformation.h @@ -183,7 +183,7 @@ template struct Transformation> { } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/DualQuaternionTransformation.h b/src/SceneGraph/DualQuaternionTransformation.h index f94e29d82..6a39c8d5b 100644 --- a/src/SceneGraph/DualQuaternionTransformation.h +++ b/src/SceneGraph/DualQuaternionTransformation.h @@ -200,7 +200,7 @@ template struct Transformation> { } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index 039896356..5934020fc 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -182,7 +182,7 @@ template FeatureGroup; extern template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<3, Float>; #endif diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index d3b4f03dc..db6e238a8 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -168,7 +168,7 @@ template struct Transformation> { } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index b6adc33d2..f1d0d01e6 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -216,7 +216,7 @@ template struct Transformation> { } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/RigidMatrixTransformation2D.h b/src/SceneGraph/RigidMatrixTransformation2D.h index 072015013..e89ada21a 100644 --- a/src/SceneGraph/RigidMatrixTransformation2D.h +++ b/src/SceneGraph/RigidMatrixTransformation2D.h @@ -202,7 +202,7 @@ template struct Transformation> { } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/RigidMatrixTransformation3D.h b/src/SceneGraph/RigidMatrixTransformation3D.h index 0ada0a0af..fa25cdcc5 100644 --- a/src/SceneGraph/RigidMatrixTransformation3D.h +++ b/src/SceneGraph/RigidMatrixTransformation3D.h @@ -255,7 +255,7 @@ template struct Transformation> { } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/TranslationTransformation.h b/src/SceneGraph/TranslationTransformation.h index 3d63d484c..917ecc4dd 100644 --- a/src/SceneGraph/TranslationTransformation.h +++ b/src/SceneGraph/TranslationTransformation.h @@ -206,7 +206,7 @@ template struct Transfor } -#ifdef _WIN32 +#ifdef CORRADE_TARGET_WINDOWS extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; extern template class MAGNUM_SCENEGRAPH_EXPORT Object>; #endif diff --git a/src/SceneGraph/instantiation.cpp b/src/SceneGraph/instantiation.cpp index b04fd0964..079199ddc 100644 --- a/src/SceneGraph/instantiation.cpp +++ b/src/SceneGraph/instantiation.cpp @@ -39,7 +39,7 @@ namespace Magnum { namespace SceneGraph { /* On Windows the instantiations are already marked with extern template */ -#ifndef _WIN32 +#ifndef CORRADE_TARGET_WINDOWS #define MAGNUM_SCENEGRAPH_EXPORT_HPP MAGNUM_SCENEGRAPH_EXPORT #else #define MAGNUM_SCENEGRAPH_EXPORT_HPP From dfd86079bc6c46a4b9b256890156b0bc503436db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 19:59:24 +0100 Subject: [PATCH 17/64] Minor cleanup. --- src/AbstractObject.h | 4 +--- src/Implementation/DebugState.h | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/AbstractObject.h b/src/AbstractObject.h index befdbced6..e6d2a9158 100644 --- a/src/AbstractObject.h +++ b/src/AbstractObject.h @@ -36,9 +36,7 @@ namespace Magnum { -namespace Implementation { - struct DebugState; -} +namespace Implementation { struct DebugState; } /** @brief Base for all OpenGL objects diff --git a/src/Implementation/DebugState.h b/src/Implementation/DebugState.h index b6f1b2fae..3397c2063 100644 --- a/src/Implementation/DebugState.h +++ b/src/Implementation/DebugState.h @@ -34,11 +34,8 @@ namespace Magnum { namespace Implementation { struct DebugState { DebugState(Context& context); - typedef std::string(*GetLabelImplementation)(GLenum, GLuint); - GetLabelImplementation getLabelImplementation; - - typedef void(*LabelImplementation)(GLenum, GLuint, const std::string&); - LabelImplementation labelImplementation; + std::string(*getLabelImplementation)(GLenum, GLuint); + void(*labelImplementation)(GLenum, GLuint, const std::string&); GLint maxLabelLength; }; From e88143fb9e309b381888126f908c714c493356cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 19:48:48 +0100 Subject: [PATCH 18/64] Added EXT_debug_marker extension to the list and GL headers. --- external/OpenGL/GL/extensions.txt | 1 + external/OpenGL/GL/gl_magnum.c | 23 +++++++++++++++++++++-- external/OpenGL/GL/gl_magnum.h | 11 +++++++++++ src/Context.cpp | 1 + src/Extensions.h | 1 + 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/external/OpenGL/GL/extensions.txt b/external/OpenGL/GL/extensions.txt index fea40a9d5..135a48876 100644 --- a/external/OpenGL/GL/extensions.txt +++ b/external/OpenGL/GL/extensions.txt @@ -10,4 +10,5 @@ EXT_texture_mirror_clamp EXT_direct_state_access EXT_debug_label + EXT_debug_marker GREMEDY_string_marker diff --git a/external/OpenGL/GL/gl_magnum.c b/external/OpenGL/GL/gl_magnum.c index b695ff5e0..f72669798 100644 --- a/external/OpenGL/GL/gl_magnum.c +++ b/external/OpenGL/GL/gl_magnum.c @@ -91,6 +91,7 @@ int ogl_ext_EXT_texture_filter_anisotropic = ogl_LOAD_FAILED; int ogl_ext_EXT_texture_mirror_clamp = ogl_LOAD_FAILED; int ogl_ext_EXT_direct_state_access = ogl_LOAD_FAILED; int ogl_ext_EXT_debug_label = ogl_LOAD_FAILED; +int ogl_ext_EXT_debug_marker = ogl_LOAD_FAILED; int ogl_ext_GREMEDY_string_marker = ogl_LOAD_FAILED; GLLOADGEN_EXPORT GLenum (CODEGEN_FUNCPTR *_ptrc_glGetGraphicsResetStatusARB)() = NULL; @@ -945,6 +946,22 @@ static int Load_EXT_debug_label() return numFailed; } +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glInsertEventMarkerEXT)(GLsizei, const GLchar *) = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPopGroupMarkerEXT)() = NULL; +GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPushGroupMarkerEXT)(GLsizei, const GLchar *) = NULL; + +static int Load_EXT_debug_marker() +{ + int numFailed = 0; + _ptrc_glInsertEventMarkerEXT = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLchar *))IntGetProcAddress("glInsertEventMarkerEXT"); + if(!_ptrc_glInsertEventMarkerEXT) numFailed++; + _ptrc_glPopGroupMarkerEXT = (void (CODEGEN_FUNCPTR *)())IntGetProcAddress("glPopGroupMarkerEXT"); + if(!_ptrc_glPopGroupMarkerEXT) numFailed++; + _ptrc_glPushGroupMarkerEXT = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLchar *))IntGetProcAddress("glPushGroupMarkerEXT"); + if(!_ptrc_glPushGroupMarkerEXT) numFailed++; + return numFailed; +} + GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const void *) = NULL; static int Load_GREMEDY_string_marker() @@ -2615,7 +2632,7 @@ typedef struct ogl_StrToExtMap_s PFN_LOADFUNCPOINTERS LoadExtension; } ogl_StrToExtMap; -static ogl_StrToExtMap ExtensionMap[9] = { +static ogl_StrToExtMap ExtensionMap[10] = { {"GL_AMD_vertex_shader_layer", &ogl_ext_AMD_vertex_shader_layer, NULL}, {"GL_AMD_shader_trinary_minmax", &ogl_ext_AMD_shader_trinary_minmax, NULL}, {"GL_ARB_robustness", &ogl_ext_ARB_robustness, Load_ARB_robustness}, @@ -2624,10 +2641,11 @@ static ogl_StrToExtMap ExtensionMap[9] = { {"GL_EXT_texture_mirror_clamp", &ogl_ext_EXT_texture_mirror_clamp, NULL}, {"GL_EXT_direct_state_access", &ogl_ext_EXT_direct_state_access, Load_EXT_direct_state_access}, {"GL_EXT_debug_label", &ogl_ext_EXT_debug_label, Load_EXT_debug_label}, + {"GL_EXT_debug_marker", &ogl_ext_EXT_debug_marker, Load_EXT_debug_marker}, {"GL_GREMEDY_string_marker", &ogl_ext_GREMEDY_string_marker, Load_GREMEDY_string_marker}, }; -static int g_extensionMapSize = 9; +static int g_extensionMapSize = 10; static void ClearExtensionVars() { @@ -2639,6 +2657,7 @@ static void ClearExtensionVars() ogl_ext_EXT_texture_mirror_clamp = ogl_LOAD_FAILED; ogl_ext_EXT_direct_state_access = ogl_LOAD_FAILED; ogl_ext_EXT_debug_label = ogl_LOAD_FAILED; + ogl_ext_EXT_debug_marker = ogl_LOAD_FAILED; ogl_ext_GREMEDY_string_marker = ogl_LOAD_FAILED; } diff --git a/external/OpenGL/GL/gl_magnum.h b/external/OpenGL/GL/gl_magnum.h index 68bba02a0..cd53bf8a7 100644 --- a/external/OpenGL/GL/gl_magnum.h +++ b/external/OpenGL/GL/gl_magnum.h @@ -171,6 +171,7 @@ extern int ogl_ext_EXT_texture_filter_anisotropic; extern int ogl_ext_EXT_texture_mirror_clamp; extern int ogl_ext_EXT_direct_state_access; extern int ogl_ext_EXT_debug_label; +extern int ogl_ext_EXT_debug_marker; extern int ogl_ext_GREMEDY_string_marker; #define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 @@ -2088,6 +2089,16 @@ extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glLabelObjectEXT)(GLenum, G #define glLabelObjectEXT _ptrc_glLabelObjectEXT #endif /*GL_EXT_debug_label*/ +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glInsertEventMarkerEXT)(GLsizei, const GLchar *); +#define glInsertEventMarkerEXT _ptrc_glInsertEventMarkerEXT +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPopGroupMarkerEXT)(); +#define glPopGroupMarkerEXT _ptrc_glPopGroupMarkerEXT +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glPushGroupMarkerEXT)(GLsizei, const GLchar *); +#define glPushGroupMarkerEXT _ptrc_glPushGroupMarkerEXT +#endif /*GL_EXT_debug_marker*/ + #ifndef GL_GREMEDY_string_marker #define GL_GREMEDY_string_marker 1 extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const void *); diff --git a/src/Context.cpp b/src/Context.cpp index 26b34a719..51fe1582b 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -87,6 +87,7 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,EXT,texture_mirror_clamp), _extension(GL,EXT,direct_state_access), _extension(GL,EXT,debug_label), + _extension(GL,EXT,debug_marker), _extension(GL,GREMEDY,string_marker)}; // done static const std::vector extensions300{ /** diff --git a/src/Extensions.h b/src/Extensions.h index 2f0105993..cfef5eb41 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -182,6 +182,7 @@ namespace GL { _extension(GL,EXT,direct_state_access, GL210, None) // #353 _extension(GL,EXT,texture_snorm, GL300, GL310) // #365 _extension(GL,EXT,debug_label, GL210, None) // #439 + _extension(GL,EXT,debug_marker, GL210, None) // #440 } namespace GREMEDY { _extension(GL,GREMEDY,string_marker, GL210, None) // #311 } namespace INTEL { From ea9828161251cde3cd49e0792cb8575a278a6707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 19:51:54 +0100 Subject: [PATCH 19/64] New class DebugMessage for inserting debug messages via KHR_debug. Previously this was done in DebugMarker only via GREMEDY_string_marker on desktop and EXT_debug_marker on ES, now supporting both three on desktop and KHR/EXT version on ES. The old DebugMarker is now only a thin wrapper around DebugMessage, is marked as deprecated and will be removed in future release. --- src/CMakeLists.txt | 5 +- src/Context.cpp | 2 - src/DebugMarker.cpp | 64 ------- src/DebugMarker.h | 46 ++--- src/DebugMessage.cpp | 153 +++++++++++++++++ src/DebugMessage.h | 267 ++++++++++++++++++++++++++++++ src/Implementation/DebugState.cpp | 25 ++- src/Implementation/DebugState.h | 7 +- src/Implementation/State.cpp | 16 +- src/Magnum.h | 2 +- src/Test/CMakeLists.txt | 2 + src/Test/DebugGLTest.cpp | 103 ++++++++++++ 12 files changed, 581 insertions(+), 111 deletions(-) delete mode 100644 src/DebugMarker.cpp create mode 100644 src/DebugMessage.cpp create mode 100644 src/DebugMessage.h create mode 100644 src/Test/DebugGLTest.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aa9bc7516..aaf06f779 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,7 +54,7 @@ set(Magnum_SRCS Buffer.cpp ColorFormat.cpp Context.cpp - DebugMarker.cpp + DebugMessage.cpp DefaultFramebuffer.cpp Framebuffer.cpp Image.cpp @@ -112,7 +112,7 @@ set(Magnum_HEADERS ColorFormat.h Context.h CubeMapTexture.h - DebugMarker.h + DebugMessage.h DefaultFramebuffer.h DimensionTraits.h Extensions.h @@ -141,6 +141,7 @@ set(Magnum_HEADERS # Deprecated headers if(BUILD_DEPRECATED) set(Magnum_HEADERS ${Magnum_HEADERS} + DebugMarker.h ImageFormat.h Swizzle.h) endif() diff --git a/src/Context.cpp b/src/Context.cpp index 51fe1582b..856175a24 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -34,7 +34,6 @@ #include "AbstractTexture.h" #include "Buffer.h" #include "BufferTexture.h" -#include "DebugMarker.h" #include "DefaultFramebuffer.h" #include "Extensions.h" #include "Framebuffer.h" @@ -431,7 +430,6 @@ Context::Context() { #ifndef MAGNUM_TARGET_GLES BufferTexture::initializeContextBasedFunctionality(*this); #endif - DebugMarker::initializeContextBasedFunctionality(*this); DefaultFramebuffer::initializeContextBasedFunctionality(*this); Framebuffer::initializeContextBasedFunctionality(*this); Mesh::initializeContextBasedFunctionality(*this); diff --git a/src/DebugMarker.cpp b/src/DebugMarker.cpp deleted file mode 100644 index bebac87ca..000000000 --- a/src/DebugMarker.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of Magnum. - - Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -*/ - -#include "DebugMarker.h" - -#include - -#include "Context.h" -#include "Extensions.h" - -namespace Magnum { - -DebugMarker::MarkImplementation DebugMarker::markImplementation = &DebugMarker::markImplementationDefault; - -void DebugMarker::initializeContextBasedFunctionality(Context& context) { - /** @todo Re-enable when extension wrangler is available for ES */ - #ifndef MAGNUM_TARGET_GLES - if(context.isExtensionSupported()) { - Debug() << "DebugMarker: using" << Extensions::GL::GREMEDY::string_marker::string() << "features"; - - markImplementation = &DebugMarker::markImplementationDebugger; - } - #else - static_cast(context); - #endif -} - -void DebugMarker::markImplementationDefault(const std::string&) {} - -void DebugMarker::markImplementationDebugger(const std::string& string) { - /** @todo Re-enable when extension wrangler is available for ES */ - #ifndef MAGNUM_TARGET_GLES - glStringMarkerGREMEDY(string.length(), string.data()); - #else - #if 0 - glInsertEventMarkerEXT(string.length(), string.data()); - #else - static_cast(string); - #endif - #endif -} - -} diff --git a/src/DebugMarker.h b/src/DebugMarker.h index 2c32e18a7..802ade424 100644 --- a/src/DebugMarker.h +++ b/src/DebugMarker.h @@ -25,47 +25,33 @@ */ /** @file - * @brief Class Magnum::DebugMarker + * @brief Typedef @ref Magnum::DebugMarker + * @deprecated Use @ref DebugMessage.h instead. */ -#include - -#include "Magnum.h" - -#include "magnumVisibility.h" +#include "DebugMessage.h" +#ifdef MAGNUM_BUILD_DEPRECATED namespace Magnum { /** -@brief Debug marker - -Allows putting debug marker into OpenGL command stream for use with various -debuggers, such as ApiTrace or gDEBugger. -@requires_extension %Extension @extension{GREMEDY,string_marker}. If not - available, this class does nothing. -@requires_es_extension %Extension @es_extension{EXT,debug_marker}. If not - available, this class does nothing. +@copybrief DebugMessage +@deprecated Use @ref Magnum::DebugMessage "DebugMessage" instead. */ -class MAGNUM_EXPORT DebugMarker { - friend class Context; - +class CORRADE_DEPRECATED("use DebugMessage instead") MAGNUM_EXPORT DebugMarker: public DebugMessage { public: - DebugMarker() = delete; - - /** @brief Put string mark into OpenGL command stream */ - static void mark(const std::string& string) { - markImplementation(string); + /** + * @copybrief DebugMessage::insert() + * @deprecated Use @ref Magnum::DebugMessage::insert() "insert()" instead. + */ + static CORRADE_DEPRECATED("use DebugMessage::insert() instead") void mark(const std::string& string) { + insert(Source::Application, Type::Marker, 0, Severity::Notification, string); } - - private: - static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context& context); - - typedef void(*MarkImplementation)(const std::string&); - static MAGNUM_LOCAL void markImplementationDefault(const std::string& string); - static MAGNUM_LOCAL void markImplementationDebugger(const std::string& string); - static MarkImplementation markImplementation; }; } +#else +#error use DebugMessage.h instead +#endif #endif diff --git a/src/DebugMessage.cpp b/src/DebugMessage.cpp new file mode 100644 index 000000000..b45314baf --- /dev/null +++ b/src/DebugMessage.cpp @@ -0,0 +1,153 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "DebugMessage.h" + +#include + +#include "Context.h" +#include "Extensions.h" +#include "Implementation/State.h" +#include "Implementation/DebugState.h" + +namespace Magnum { + +Int DebugMessage::maxLoggedMessages() { + if(!Context::current()->isExtensionSupported()) + return 0; + + GLint& value = Context::current()->state().debug->maxLoggedMessages; + + if(value == 0) { + #ifndef MAGNUM_TARGET_GLES + glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES, &value); + #else + glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES_KHR, &value); + #endif + } + + return value; +} + +Int DebugMessage::maxMessageLength() { + if(!Context::current()->isExtensionSupported()) + return 0; + + GLint& value = Context::current()->state().debug->maxMessageLength; + + if(value == 0) { + #ifndef MAGNUM_TARGET_GLES + glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &value); + #else + glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH_KHR, &value); + #endif + } + + return value; +} + +void DebugMessage::insert(const Source source, const Type type, const UnsignedInt id, const Severity severity, const std::string& string) { + Context::current()->state().debug->messageInsertImplementation(source, type, id, severity, string); +} + +void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, Severity, const std::string&) {} + +void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const Severity severity, const std::string& string) { + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES + glDebugMessageInsert(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data()); + #else + static_cast(source); + static_cast(type); + static_cast(id); + static_cast(severity); + static_cast(string); + CORRADE_INTERNAL_ASSERT(false); + //glDebugMessageInsertEXT(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data()); + #endif +} + +void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, Severity, const std::string& string) { + /** @todo Re-enable when extension wrangler is available for ES */ + #ifndef MAGNUM_TARGET_GLES + glInsertEventMarkerEXT(string.size(), string.data()); + #else + static_cast(string); + CORRADE_INTERNAL_ASSERT(false); + #endif +} + +#ifndef MAGNUM_TARGET_GLES +void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, Severity, const std::string& string) { + glStringMarkerGREMEDY(string.length(), string.data()); +} +#endif + +#ifndef DOXYGEN_GENERATING_OUTPUT +Debug operator<<(Debug debug, const DebugMessage::Source value) { + switch(value) { + #define _c(value) case DebugMessage::Source::value: return debug << "DebugMessage::Source::" #value; + _c(Api) + _c(WindowSystem) + _c(ShaderCompiler) + _c(ThirdParty) + _c(Application) + _c(Other) + #undef _c + } + + return debug << "DebugMessage::Source::(invalid)"; +} + +Debug operator<<(Debug debug, const DebugMessage::Type value) { + switch(value) { + #define _c(value) case DebugMessage::Type::value: return debug << "DebugMessage::Type::" #value; + _c(Error) + _c(DeprecatedBehavior) + _c(UndefinedBehavior) + _c(Portability) + _c(Performance) + _c(Other) + _c(Marker) + #undef _c + } + + return debug << "DebugMessage::Type::(invalid)"; +} + +Debug operator<<(Debug debug, const DebugMessage::Severity value) { + switch(value) { + #define _c(value) case DebugMessage::Severity::value: return debug << "DebugMessage::Severity::" #value; + _c(High) + _c(Medium) + _c(Low) + _c(Notification) + #undef _c + } + + return debug << "DebugMessage::Severity::(invalid)"; +} +#endif + +} diff --git a/src/DebugMessage.h b/src/DebugMessage.h new file mode 100644 index 000000000..00726c28a --- /dev/null +++ b/src/DebugMessage.h @@ -0,0 +1,267 @@ +#ifndef Magnum_DebugMessage_h +#define Magnum_DebugMessage_h +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Class @ref Magnum::DebugMessage + */ + +#include + +#include "Magnum.h" +#include "OpenGL.h" +#include "magnumVisibility.h" + +namespace Magnum { + +namespace Implementation { struct DebugState; } + +/** +@brief Debug message + +Allows inserting debug messages into OpenGL command stream, for example with +conjunction with various debuggers, such as Apitrace or gDEBugger. +*/ +class MAGNUM_EXPORT DebugMessage { + friend class Implementation::DebugState; + + public: + /** + * @brief Message source + * + * @see @ref insert() + */ + enum class Source: GLenum { + /** OpenGL */ + #ifndef MAGNUM_TARGET_GLES + Api = GL_DEBUG_SOURCE_API, + #else + Api = GL_DEBUG_SOURCE_API_KHR, + #endif + + /** Window system (GLX, WGL) */ + #ifndef MAGNUM_TARGET_GLES + WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM, + #else + WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR, + #endif + + /** %Shader compiler */ + #ifndef MAGNUM_TARGET_GLES + ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER, + #else + ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER_KHR, + #endif + + /** External debugger or third-party middleware */ + #ifndef MAGNUM_TARGET_GLES + ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY, + #else + ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR, + #endif + + /** The application */ + #ifndef MAGNUM_TARGET_GLES + Application = GL_DEBUG_SOURCE_APPLICATION, + #else + Application = GL_DEBUG_SOURCE_APPLICATION_KHR, + #endif + + /** Any other source */ + #ifndef MAGNUM_TARGET_GLES + Other = GL_DEBUG_SOURCE_OTHER + #else + Other = GL_DEBUG_SOURCE_OTHER_KHR + #endif + }; + + /** + * @brief Message type + * + * @see @ref insert() + */ + enum class Type: GLenum { + /** OpenGL error */ + #ifndef MAGNUM_TARGET_GLES + Error = GL_DEBUG_TYPE_ERROR, + #else + Error = GL_DEBUG_TYPE_ERROR_KHR, + #endif + + /** Behavior that has been marked for deprecation */ + #ifndef MAGNUM_TARGET_GLES + DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, + #else + DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR, + #endif + + /** Behavior that is undefined according to the specification */ + #ifndef MAGNUM_TARGET_GLES + UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, + #else + UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR, + #endif + + /** Non-portable usage of extensions or shaders */ + #ifndef MAGNUM_TARGET_GLES + Portability = GL_DEBUG_TYPE_PORTABILITY, + #else + Portability = GL_DEBUG_TYPE_PORTABILITY_KHR, + #endif + + /** Implementation-dependent performance warning */ + #ifndef MAGNUM_TARGET_GLES + Performance = GL_DEBUG_TYPE_PERFORMANCE, + #else + Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR, + #endif + + /** Any other type */ + #ifndef MAGNUM_TARGET_GLES + Other = GL_DEBUG_TYPE_OTHER, + #else + Other = GL_DEBUG_TYPE_OTHER_KHR, + #endif + + /** Annotation of the command stream */ + #ifndef MAGNUM_TARGET_GLES + Marker = GL_DEBUG_TYPE_MARKER + #else + Marker = GL_DEBUG_TYPE_MARKER_KHR + #endif + }; + + /** + * @brief Message severity + * + * @see @ref insert() + */ + enum class Severity: GLenum { + /** + * Any OpenGL error, dangerous undefined behavior, shader + * compilation errors. + */ + #ifndef MAGNUM_TARGET_GLES + High = GL_DEBUG_SEVERITY_HIGH, + #else + High = GL_DEBUG_SEVERITY_HIGH_KHR, + #endif + + /** + * Severe performance warnings, shader compilation warnings, use of + * deprecated behavior. + */ + #ifndef MAGNUM_TARGET_GLES + Medium = GL_DEBUG_SEVERITY_MEDIUM, + #else + Medium = GL_DEBUG_SEVERITY_MEDIUM_KHR, + #endif + + /** Minor performance warnings, trivial undefined behavior. */ + #ifndef MAGNUM_TARGET_GLES + Low = GL_DEBUG_SEVERITY_LOW, + #else + Low = GL_DEBUG_SEVERITY_LOW_KHR, + #endif + + /** Any message other than error or performance warning. */ + #ifndef MAGNUM_TARGET_GLES + Notification = GL_DEBUG_SEVERITY_NOTIFICATION + #else + Notification = GL_DEBUG_SEVERITY_NOTIFICATION_KHR + #endif + }; + + /** + * @brief Max count of debug messages in log + * + * The result is cached, repeated queries don't result in repeated + * OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} + * desktop or ES extension is not available, returns `0`. + * @see @fn_gl{Get} with @def_gl{MAX_DEBUG_LOGGED_MESSAGES} + */ + static Int maxLoggedMessages(); + + /** + * @brief Max debug message length + * + * The result is cached, repeated queries don't result in repeated + * OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} + * desktop or ES extension is not available, returns `0`. + * @see @fn_gl{Get} with @def_gl{MAX_DEBUG_MESSAGE_LENGTH} + */ + static Int maxMessageLength(); + + /** + * @brief Insert message + * @param source Message source. Allowed values are + * @ref Source::ThirdParty or @ref Source::Application. + * @param type Message type + * @param id Message-specific ID + * @param severity Message severity + * @param string The actual message + * + * If OpenGL 4.3 is not supported and none of @extension{KHR,debug}, + * @extension2{EXT,debug_marker} or @extension{GREMEDY,string_marker} + * is available, this function does nothing. + * + * If @extension{KHR,debug} is not available and only @extension2{EXT,debug_marker} + * or @extension{GREMEDY,string_marker} are available, only @p string + * is used and all other parameters are ignored. The call is then + * equivalent to the following: + * @code + * DebugMessage::insert(DebugMessage::Source::Application, + * DebugMessage::Type::Marker, 0, DebugMessage::Severity::Notification, string); + * @endcode + * + * @see @ref maxMessageLength(), @fn_gl{DebugMessageInsert}, + * @fn_gl_extension2{InsertEventMarker,EXT,debug_marker} or + * @fn_gl_extension{StringMarker,GREMEDY,string_marker} + */ + static void insert(Source source, Type type, UnsignedInt id, Severity severity, const std::string& string); + + DebugMessage() = delete; + + private: + static MAGNUM_LOCAL void insertImplementationNoOp(Source, Type, UnsignedInt, Severity, const std::string&); + static MAGNUM_LOCAL void insertImplementationKhr(Source source, Type type, UnsignedInt id, Severity severity, const std::string& string); + static MAGNUM_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, Severity, const std::string& string); + #ifndef MAGNUM_TARGET_GLES + static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, Severity, const std::string& string); + #endif +}; + +/** @debugoperator{Magnum::DebugMessage} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, DebugMessage::Source value); + +/** @debugoperator{Magnum::DebugMessage} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, DebugMessage::Type value); + +/** @debugoperator{Magnum::DebugMessage} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, DebugMessage::Severity value); + +} + +#endif diff --git a/src/Implementation/DebugState.cpp b/src/Implementation/DebugState.cpp index f0c1c1e19..14ea03eea 100644 --- a/src/Implementation/DebugState.cpp +++ b/src/Implementation/DebugState.cpp @@ -30,16 +30,29 @@ namespace Magnum { namespace Implementation { -DebugState::DebugState(Context& context): maxLabelLength(0) { +DebugState::DebugState(Context& context): maxLabelLength(0), maxLoggedMessages(0), maxMessageLength(0) { if(context.isExtensionSupported()) { getLabelImplementation = &AbstractObject::getLabelImplementationKhr; labelImplementation = &AbstractObject::labelImplementationKhr; - } else if(context.isExtensionSupported()) { - getLabelImplementation = &AbstractObject::getLabelImplementationExt; - labelImplementation = &AbstractObject::labelImplementationExt; + messageInsertImplementation = &DebugMessage::insertImplementationKhr; + } else { - getLabelImplementation = &AbstractObject::getLabelImplementationNoOp; - labelImplementation = &AbstractObject::labelImplementationNoOp; + if(context.isExtensionSupported()) { + getLabelImplementation = &AbstractObject::getLabelImplementationExt; + labelImplementation = &AbstractObject::labelImplementationExt; + } else { + getLabelImplementation = &AbstractObject::getLabelImplementationNoOp; + labelImplementation = &AbstractObject::labelImplementationNoOp; + } + + if(context.isExtensionSupported()) + messageInsertImplementation = &DebugMessage::insertImplementationExt; + #ifndef MAGNUM_TARGET_GLES + else if(context.isExtensionSupported()) + messageInsertImplementation = &DebugMessage::insertImplementationGremedy; + #endif + else + messageInsertImplementation = &DebugMessage::insertImplementationNoOp; } } diff --git a/src/Implementation/DebugState.h b/src/Implementation/DebugState.h index 3397c2063..e9995d706 100644 --- a/src/Implementation/DebugState.h +++ b/src/Implementation/DebugState.h @@ -26,8 +26,7 @@ #include -#include "Magnum.h" -#include "OpenGL.h" +#include "DebugMessage.h" namespace Magnum { namespace Implementation { @@ -37,7 +36,9 @@ struct DebugState { std::string(*getLabelImplementation)(GLenum, GLuint); void(*labelImplementation)(GLenum, GLuint, const std::string&); - GLint maxLabelLength; + void(*messageInsertImplementation)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugMessage::Severity, const std::string&); + + GLint maxLabelLength, maxLoggedMessages, maxMessageLength; }; }} diff --git a/src/Implementation/State.cpp b/src/Implementation/State.cpp index 309aa9d6b..ff35e3c64 100644 --- a/src/Implementation/State.cpp +++ b/src/Implementation/State.cpp @@ -45,14 +45,24 @@ State::State(Context& context): renderer(new RendererState), shader(new ShaderState), shaderProgram(new ShaderProgramState), - texture(new TextureState) { + texture(new TextureState) +{ Debug() << "Using optional features:"; if(context.isExtensionSupported()) Debug() << " " << Extensions::GL::KHR::debug::string(); - else if(context.isExtensionSupported()) - Debug() << " " << Extensions::GL::EXT::debug_label::string(); + else { + if(context.isExtensionSupported()) + Debug() << " " << Extensions::GL::EXT::debug_label::string(); + + if(context.isExtensionSupported()) + Debug() << " " << Extensions::GL::EXT::debug_marker::string(); + #ifndef MAGNUM_TARGET_GLES + else if(context.isExtensionSupported()) + Debug() << " " << Extensions::GL::GREMEDY::string_marker::string(); + #endif + } } State::~State() { diff --git a/src/Magnum.h b/src/Magnum.h index 95494aeb9..b32c26603 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -565,7 +565,7 @@ class CubeMapTexture; class CubeMapTextureArray; #endif -/* DebugMarker forward declaration is not needed */ +/* DebugMessage used only statically */ /* DefaultFramebuffer is available only through global instance */ /* DimensionTraits forward declaration is not needed */ diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index 42496328b..6eaf09105 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -26,6 +26,7 @@ corrade_add_test(AbstractImageTest AbstractImageTest.cpp LIBRARIES Magnum) corrade_add_test(AbstractShaderProgramTest AbstractShaderProgramTest.cpp LIBRARIES Magnum) corrade_add_test(ArrayTest ArrayTest.cpp) corrade_add_test(ColorTest ColorTest.cpp LIBRARIES MagnumMathTestLib) +corrade_add_test(DebugMessageTest DebugMessageTest.cpp LIBRARIES Magnum) corrade_add_test(DefaultFramebufferTest DefaultFramebufferTest.cpp LIBRARIES Magnum) corrade_add_test(FramebufferTest FramebufferTest.cpp LIBRARIES Magnum) corrade_add_test(ImageTest ImageTest.cpp LIBRARIES Magnum) @@ -41,6 +42,7 @@ if(BUILD_GL_TESTS) corrade_add_test(AbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(BufferGLTest BufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ContextGLTest ContextGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(DebugGLTest DebugGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(FramebufferGLTest FramebufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(MeshGLTest MeshGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(RenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) diff --git a/src/Test/DebugGLTest.cpp b/src/Test/DebugGLTest.cpp new file mode 100644 index 000000000..43c1689e9 --- /dev/null +++ b/src/Test/DebugGLTest.cpp @@ -0,0 +1,103 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include "Test/AbstractOpenGLTester.h" + +#include "Context.h" +#include "DebugMessage.h" +#include "Extensions.h" + +#ifdef MAGNUM_BUILD_DEPRECATED +#include "DebugMarker.h" +#endif + +namespace Magnum { namespace Test { + +class DebugGLTest: public AbstractOpenGLTester { + public: + explicit DebugGLTest(); + + void insertMessageNoOp(); + void insertMessage(); + void insertMessageFallback(); + + void deprecated(); +}; + +DebugGLTest::DebugGLTest() { + addTests({&DebugGLTest::insertMessageNoOp, + &DebugGLTest::insertMessage, + &DebugGLTest::insertMessageFallback, + + #ifdef MAGNUM_BUILD_DEPRECATED + &DebugGLTest::deprecated + #endif + }); +} + +void DebugGLTest::insertMessageNoOp() { + if(Context::current()->isExtensionSupported() || + Context::current()->isExtensionSupported() || + Context::current()->isExtensionSupported()) + CORRADE_SKIP("The extensions are supported, cannot test."); + + DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, + 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void DebugGLTest::insertMessage() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported")); + + DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, + 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void DebugGLTest::insertMessageFallback() { + if(Context::current()->isExtensionSupported() || + (!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported())) + CORRADE_SKIP("No proper extension is supported"); + + DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, + 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifdef MAGNUM_BUILD_DEPRECATED +void DebugGLTest::deprecated() { + DebugMarker::mark("hello"); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +}} + +CORRADE_TEST_MAIN(Magnum::Test::DebugGLTest) From f2d3ecca7c770a675fbfa1bf3c3217611b0cfd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 19:57:11 +0100 Subject: [PATCH 20/64] Platform: display DebugMessage limits in magnum-info. --- src/Platform/magnum-info.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Platform/magnum-info.cpp b/src/Platform/magnum-info.cpp index 8ddd22c72..7a674b4f5 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Platform/magnum-info.cpp @@ -32,6 +32,7 @@ #include "AbstractShaderProgram.h" #include "Buffer.h" #include "Context.h" +#include "DebugMessage.h" #include "Extensions.h" #include "Framebuffer.h" #include "Mesh.h" @@ -354,6 +355,8 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat _h(KHR::debug) _l(AbstractObject::maxLabelLength()) + _l(DebugMessage::maxLoggedMessages()) + _l(DebugMessage::maxMessageLength()) } #undef _l From 3ad9050e15e9e9fcfd90c39b69b83b61bfe4f71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 23:00:55 +0100 Subject: [PATCH 21/64] Disallow overriding exec() in GL tests. --- src/Test/AbstractOpenGLTester.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Test/AbstractOpenGLTester.h b/src/Test/AbstractOpenGLTester.h index e551b4639..9c2c204cb 100644 --- a/src/Test/AbstractOpenGLTester.h +++ b/src/Test/AbstractOpenGLTester.h @@ -42,7 +42,7 @@ class AbstractOpenGLTester: public TestSuite::Tester, public Platform::Windowles explicit AbstractOpenGLTester(): Platform::WindowlessApplication({zero, nullptr}) {} using TestSuite::Tester::exec; - int exec() override { return TestSuite::Tester::exec(); } + int exec() override final { return TestSuite::Tester::exec(); } private: static int zero; From 7f22b9c2143b755746fcbceecf9204dec3c6901d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 22:56:26 +0100 Subject: [PATCH 22/64] Support for debug message callback from KHR_debug. --- src/DebugMessage.cpp | 59 +++++++++++++++++++++++++ src/DebugMessage.h | 72 ++++++++++++++++++++++++++++--- src/Implementation/DebugState.cpp | 5 ++- src/Implementation/DebugState.h | 2 + src/Renderer.h | 25 +++++++++++ src/Test/DebugGLTest.cpp | 13 ++++++ 6 files changed, 170 insertions(+), 6 deletions(-) diff --git a/src/DebugMessage.cpp b/src/DebugMessage.cpp index b45314baf..b087c09c1 100644 --- a/src/DebugMessage.cpp +++ b/src/DebugMessage.cpp @@ -33,6 +33,29 @@ namespace Magnum { +namespace { + +void callbackWrapper(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) { + Context::current()->state().debug->messageCallback(DebugMessage::Source(source), DebugMessage::Type(type), id, DebugMessage::Severity(severity), std::string(message, length), userParam); +} + +void defaultCallback(const DebugMessage::Source source, const DebugMessage::Type type, const UnsignedInt id, const DebugMessage::Severity severity, const std::string& string, const void*) { + switch(severity) { + case DebugMessage::Severity::High: + Error() << source << type << id << severity << "\n " << string; + break; + + case DebugMessage::Severity::Medium: + case DebugMessage::Severity::Low: + Warning() << source << type << id << severity << "\n " << string; + break; + + default: Debug() << source << type << id << severity << "\n " << string; + } +} + +} + Int DebugMessage::maxLoggedMessages() { if(!Context::current()->isExtensionSupported()) return 0; @@ -71,6 +94,14 @@ void DebugMessage::insert(const Source source, const Type type, const UnsignedIn Context::current()->state().debug->messageInsertImplementation(source, type, id, severity, string); } +void DebugMessage::setCallback(const Callback callback, const void* userParam) { + Context::current()->state().debug->messageCallbackImplementation(callback, userParam); +} + +void DebugMessage::setDefaultCallback() { + setCallback(defaultCallback, nullptr); +} + void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, Severity, const std::string&) {} void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const Severity severity, const std::string& string) { @@ -104,6 +135,34 @@ void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, Severi } #endif +void DebugMessage::callbackImplementationNoOp(Callback, const void*) {} + +void DebugMessage::callbackImplementationKhr(const Callback callback, const void* userParam) { + /* Replace the callback */ + const Callback original = Context::current()->state().debug->messageCallback; + Context::current()->state().debug->messageCallback = callback; + + /* Adding callback */ + if(!original && callback) { + #ifndef MAGNUM_TARGET_GLES + glDebugMessageCallback(callbackWrapper, userParam); + #else + static_cast(userParam); + CORRADE_INTERNAL_ASSERT(false); + //glDebugMessageCallbackEXT(callbackWrapper, userParam); + #endif + + /* Deleting callback */ + } else if(original && !callback) { + #ifndef MAGNUM_TARGET_GLES + glDebugMessageCallback(nullptr, nullptr); + #else + CORRADE_INTERNAL_ASSERT(false); + //glDebugMessageCallbackEXT(nullptr, nullptr); + #endif + } +} + #ifndef DOXYGEN_GENERATING_OUTPUT Debug operator<<(Debug debug, const DebugMessage::Source value) { switch(value) { diff --git a/src/DebugMessage.h b/src/DebugMessage.h index 00726c28a..d91cff627 100644 --- a/src/DebugMessage.h +++ b/src/DebugMessage.h @@ -41,8 +41,32 @@ namespace Implementation { struct DebugState; } /** @brief Debug message -Allows inserting debug messages into OpenGL command stream, for example with -conjunction with various debuggers, such as Apitrace or gDEBugger. +Allows retrieving and inserting debug messages from and to OpenGL command +stream, for example with conjunction with various debuggers, such as Apitrace +or gDEBugger. + +@section DebugMessage-usage Basic usage + +To retrieve debug messages from either the GL or your application you need to +have OpenGL 4.3 or @extension{KHR,debug} desktop/ES extension. You need to +enable @ref Renderer::Feature::DebugOutput and possibly also +@ref Renderer::Feature::DebugOutputSynchronous. Then set up message callback +using @ref setCallback() or use the default one provided in +@ref setDefaultCallback(): + +@code +Renderer::setFeature(Renderer::Feature::DebugOutput, true); +Renderer::setFeature(Renderer::Feature::DebugOutputSynchronous, true); + +DebugMessage::setDefaultCallback(); +DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, + 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); +@endcode + +With default callback the messages will be printed on standard output: + + DebugMessage::Source::Application DebugMessage::Type::Marker -1 DebugMessage::Severity::Notification + Hello from OpenGL command stream! */ class MAGNUM_EXPORT DebugMessage { friend class Implementation::DebugState; @@ -51,7 +75,7 @@ class MAGNUM_EXPORT DebugMessage { /** * @brief Message source * - * @see @ref insert() + * @see @ref insert(), @ref setCallback() */ enum class Source: GLenum { /** OpenGL */ @@ -100,7 +124,7 @@ class MAGNUM_EXPORT DebugMessage { /** * @brief Message type * - * @see @ref insert() + * @see @ref insert(), @ref setCallback() */ enum class Type: GLenum { /** OpenGL error */ @@ -156,7 +180,7 @@ class MAGNUM_EXPORT DebugMessage { /** * @brief Message severity * - * @see @ref insert() + * @see @ref insert(), @ref setCallback() */ enum class Severity: GLenum { /** @@ -194,6 +218,13 @@ class MAGNUM_EXPORT DebugMessage { #endif }; + /** + * @brief Debug callback + * + * @see @ref setCallback() + */ + typedef void(*Callback)(Source, Type, UnsignedInt, Severity, const std::string&, const void*); + /** * @brief Max count of debug messages in log * @@ -242,6 +273,34 @@ class MAGNUM_EXPORT DebugMessage { */ static void insert(Source source, Type type, UnsignedInt id, Severity severity, const std::string& string); + /** + * @brief Set debug message callback + * + * The messages are sent to the callback only if + * @ref Renderer::Feature::DebugOutput is enabled. If OpenGL 4.3 is not + * supported and @extension{KHR,debug} is not available, this function + * does nothing. + * @see @ref setDefaultCallback(), + * @ref Renderer::Feature::DebugOutputSynchronous + */ + static void setCallback(Callback callback, const void* userParam = nullptr); + + /** + * @brief Set default debug message callback + * + * See @ref setCallback() for more information. The message is printed + * to either @ref Corrade::Utility::Error "Error", @ref Corrade::Utility::Warning "Warning" + * or @ref Corrade::Utility::Debug "Debug" in the following format: + * @code + * DebugMessage::insert(DebugMessage::Source::Application, + * DebugMessage::Type::Marker, 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); + * @endcode + * + *
%DebugMessage::Source::Application %DebugMessage::Type::Marker -1 %DebugMessage::Severity::Notification
+         *     Hello from OpenGL command stream!
+ */ + static void setDefaultCallback(); + DebugMessage() = delete; private: @@ -251,6 +310,9 @@ class MAGNUM_EXPORT DebugMessage { #ifndef MAGNUM_TARGET_GLES static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, Severity, const std::string& string); #endif + + static MAGNUM_LOCAL void callbackImplementationNoOp(Callback, const void*); + static MAGNUM_LOCAL void callbackImplementationKhr(Callback callback, const void* userParam); }; /** @debugoperator{Magnum::DebugMessage} */ diff --git a/src/Implementation/DebugState.cpp b/src/Implementation/DebugState.cpp index 14ea03eea..e00b1bb62 100644 --- a/src/Implementation/DebugState.cpp +++ b/src/Implementation/DebugState.cpp @@ -30,11 +30,12 @@ namespace Magnum { namespace Implementation { -DebugState::DebugState(Context& context): maxLabelLength(0), maxLoggedMessages(0), maxMessageLength(0) { +DebugState::DebugState(Context& context): maxLabelLength(0), maxLoggedMessages(0), maxMessageLength(0), messageCallback(nullptr) { if(context.isExtensionSupported()) { getLabelImplementation = &AbstractObject::getLabelImplementationKhr; labelImplementation = &AbstractObject::labelImplementationKhr; messageInsertImplementation = &DebugMessage::insertImplementationKhr; + messageCallbackImplementation = &DebugMessage::callbackImplementationKhr; } else { if(context.isExtensionSupported()) { @@ -53,6 +54,8 @@ DebugState::DebugState(Context& context): maxLabelLength(0), maxLoggedMessages(0 #endif else messageInsertImplementation = &DebugMessage::insertImplementationNoOp; + + messageCallbackImplementation = &DebugMessage::callbackImplementationNoOp; } } diff --git a/src/Implementation/DebugState.h b/src/Implementation/DebugState.h index e9995d706..0b3ec18f1 100644 --- a/src/Implementation/DebugState.h +++ b/src/Implementation/DebugState.h @@ -37,8 +37,10 @@ struct DebugState { void(*labelImplementation)(GLenum, GLuint, const std::string&); void(*messageInsertImplementation)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugMessage::Severity, const std::string&); + void(*messageCallbackImplementation)(DebugMessage::Callback, const void*); GLint maxLabelLength, maxLoggedMessages, maxMessageLength; + DebugMessage::Callback messageCallback; }; }} diff --git a/src/Renderer.h b/src/Renderer.h index bdad9382d..f9254b114 100644 --- a/src/Renderer.h +++ b/src/Renderer.h @@ -79,6 +79,31 @@ class MAGNUM_EXPORT Renderer { */ Blending = GL_BLEND, + /** + * Debug output + * @requires_gl43 %Extension @extension{KHR,debug} + * @requires_es_extension %Extension @es_extension{KHR,debug} + * @see @ref DebugMessage, @ref Feature::DebugOutputSynchronous + */ + #ifndef MAGNUM_TARGET_GLES + DebugOutput = GL_DEBUG_OUTPUT, + #else + DebugOutput = GL_DEBUG_OUTPUT_KHR, + #endif + + /** + * Synchronous debug output. Has effect only if @ref Feature::DebugOutput + * is enabled. + * @requires_gl43 %Extension @extension{KHR,debug} + * @requires_es_extension %Extension @es_extension{KHR,debug} + * @see @ref DebugMessage + */ + #ifndef MAGNUM_TARGET_GLES + DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS, + #else + DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR, + #endif + #ifndef MAGNUM_TARGET_GLES /** * Depth clamping. If enabled, ignores near and far clipping plane. diff --git a/src/Test/DebugGLTest.cpp b/src/Test/DebugGLTest.cpp index 43c1689e9..88cd1f4bb 100644 --- a/src/Test/DebugGLTest.cpp +++ b/src/Test/DebugGLTest.cpp @@ -24,6 +24,8 @@ #include "Test/AbstractOpenGLTester.h" +#include + #include "Context.h" #include "DebugMessage.h" #include "Extensions.h" @@ -72,10 +74,21 @@ void DebugGLTest::insertMessage() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported")); + Renderer::setFeature(Renderer::Feature::DebugOutput, true); + + Renderer::setFeature(Renderer::Feature::DebugOutputSynchronous, true); + std::ostringstream out; + Debug::setOutput(&out); + DebugMessage::setDefaultCallback(); DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, 1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); + Renderer::setFeature(Renderer::Feature::DebugOutput, false); + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(out.str(), + "DebugMessage::Source::Application DebugMessage::Type::Marker 1337 DebugMessage::Severity::Notification \n" + " Hello from OpenGL command stream!\n"); } void DebugGLTest::insertMessageFallback() { From 85a22469117f79bd0df936f2bcfa8c7dbf66976a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 23:13:04 +0100 Subject: [PATCH 23/64] Add missing file. Aargh. --- src/Test/DebugMessageTest.cpp | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/Test/DebugMessageTest.cpp diff --git a/src/Test/DebugMessageTest.cpp b/src/Test/DebugMessageTest.cpp new file mode 100644 index 000000000..868c6178d --- /dev/null +++ b/src/Test/DebugMessageTest.cpp @@ -0,0 +1,67 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "DebugMessage.h" + +namespace Magnum { namespace Test { + +class DebugMessageTest: public TestSuite::Tester { + public: + explicit DebugMessageTest(); + + void debugSource(); + void debugType(); + void debugSeverity(); +}; + +DebugMessageTest::DebugMessageTest() { + addTests({&DebugMessageTest::debugSource, + &DebugMessageTest::debugType, + &DebugMessageTest::debugSeverity}); +} + +void DebugMessageTest::debugSource() { + std::ostringstream o; + Debug(&o) << DebugMessage::Source::ShaderCompiler; + CORRADE_COMPARE(o.str(), "DebugMessage::Source::ShaderCompiler\n"); +} + +void DebugMessageTest::debugType() { + std::ostringstream o; + Debug(&o) << DebugMessage::Type::DeprecatedBehavior; + CORRADE_COMPARE(o.str(), "DebugMessage::Type::DeprecatedBehavior\n"); +} + +void DebugMessageTest::debugSeverity() { + std::ostringstream o; + Debug(&o) << DebugMessage::Severity::Notification; + CORRADE_COMPARE(o.str(), "DebugMessage::Severity::Notification\n"); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::DebugMessageTest) From 50d0cb6e1ef975844507a6258c7c7f23fb80ecec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 23:22:04 +0100 Subject: [PATCH 24/64] Minor cleanup. Fixes Clang warnings. --- src/AbstractObject.h | 3 +-- src/DebugMessage.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/AbstractObject.h b/src/AbstractObject.h index e6d2a9158..33b0f26fc 100644 --- a/src/AbstractObject.h +++ b/src/AbstractObject.h @@ -42,8 +42,7 @@ namespace Implementation { struct DebugState; } @brief Base for all OpenGL objects */ class MAGNUM_EXPORT AbstractObject { - friend class Context; - friend class Implementation::DebugState; + friend struct Implementation::DebugState; public: /** diff --git a/src/DebugMessage.h b/src/DebugMessage.h index d91cff627..4f9804390 100644 --- a/src/DebugMessage.h +++ b/src/DebugMessage.h @@ -69,7 +69,7 @@ With default callback the messages will be printed on standard output: Hello from OpenGL command stream! */ class MAGNUM_EXPORT DebugMessage { - friend class Implementation::DebugState; + friend struct Implementation::DebugState; public: /** From 33775e33ca687dbbb95ef49ce53509fcc3389cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 22 Dec 2013 23:22:35 +0100 Subject: [PATCH 25/64] Fixed compilation of test on ES2. --- src/Test/DebugGLTest.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Test/DebugGLTest.cpp b/src/Test/DebugGLTest.cpp index 88cd1f4bb..ea21aef3e 100644 --- a/src/Test/DebugGLTest.cpp +++ b/src/Test/DebugGLTest.cpp @@ -60,8 +60,11 @@ DebugGLTest::DebugGLTest() { void DebugGLTest::insertMessageNoOp() { if(Context::current()->isExtensionSupported() || - Context::current()->isExtensionSupported() || - Context::current()->isExtensionSupported()) + Context::current()->isExtensionSupported() + #ifndef MAGNUM_TARGET_GLES + || Context::current()->isExtensionSupported() + #endif + ) CORRADE_SKIP("The extensions are supported, cannot test."); DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, @@ -93,8 +96,11 @@ void DebugGLTest::insertMessage() { void DebugGLTest::insertMessageFallback() { if(Context::current()->isExtensionSupported() || - (!Context::current()->isExtensionSupported() && - !Context::current()->isExtensionSupported())) + (!Context::current()->isExtensionSupported() + #ifndef MAGNUM_TARGET_GLES + && !Context::current()->isExtensionSupported() + #endif + )) CORRADE_SKIP("No proper extension is supported"); DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, From 7476b78c64a6ad64d5a7c1084635b5d556482aa0 Mon Sep 17 00:00:00 2001 From: michael chung Date: Wed, 25 Dec 2013 06:40:51 -0500 Subject: [PATCH 26/64] 1.Build problems on Mac OS X (10.9) Recommended fix: https://github.com/mosra/magnum/blob/master/modules/FindSDL2.cmake#L46 to list only SDL_scancode.h (i.e. remove SDL.h) Test: Add SDL2 Lib to the /Libraries/Frameworks/ Builds file. Add SDL2 Lib and SDL1 to the /Libraries/Frameworks/ Build fails. Remove SDL.h from at line 46. Builds fine. Remove SDL 1 from the /Libraries/Frameworks/ Builds fine. --- modules/FindSDL2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index 68ef7ae0f..a50ab39c7 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -43,7 +43,7 @@ endif() # Include dir find_path(SDL2_INCLUDE_DIR - NAMES SDL.h SDL_scancode.h + NAMES SDL_scancode.h PATH_SUFFIXES ${PATH_SUFFIXES} ) From e7d7cc1f9817727fb02eb96c29fe9c80e3e3fc5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 25 Dec 2013 13:28:30 +0100 Subject: [PATCH 27/64] modules: added comment explaining include path issues with SDL1/OSX. --- modules/FindSDL2.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index a50ab39c7..49734c560 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -43,6 +43,13 @@ endif() # Include dir find_path(SDL2_INCLUDE_DIR + # We must search file which is present only in SDL2 and not in SDL1. + # Apparently when both SDL.h and SDL_scancode.h are specified, CMake is + # happy enough that it found SDL.h and doesn't bother about the other. + # + # On OSX, where the includes are not in SDL2/SDL.h form (which would solve + # this issue), but rather SDL2.framework/Headers/SDL.h, CMake might find + # SDL.framework/Headers/SDL.h if SDL1 is installed, which is wrong. NAMES SDL_scancode.h PATH_SUFFIXES ${PATH_SUFFIXES} ) From ca053ac1027f565b694429b9b3f4b4cb5f2e780c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 27 Dec 2013 17:36:32 +0100 Subject: [PATCH 28/64] Install also AbstractObject.h. How on earth could I forget. --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aaf06f779..b23e4206c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,6 +103,7 @@ endif() set(Magnum_HEADERS AbstractFramebuffer.h AbstractImage.h + AbstractObject.h AbstractResourceLoader.h AbstractShaderProgram.h AbstractTexture.h From 5218fda6f8439007185623bdf36cbe43048535fc Mon Sep 17 00:00:00 2001 From: michael chung Date: Fri, 27 Dec 2013 18:20:52 -0500 Subject: [PATCH 29/64] Platform : This commit will allow failsafe core context creation on Mac OS X. Before this commit the default context creation in tryCreateContext would create the OpenGL 2.1 context.After this commit by default, the OpenGL 3.2 context is created by default, if this fails tryCreateContext will fall back to creating a OpenGL 2.1 context. --- src/Platform/Sdl2Application.cpp | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/Platform/Sdl2Application.cpp b/src/Platform/Sdl2Application.cpp index 91b4d3d3b..173697088 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Platform/Sdl2Application.cpp @@ -111,6 +111,46 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { /** @todo Remove when Emscripten has proper SDL2 support */ #ifndef CORRADE_TARGET_EMSCRIPTEN + + #ifdef __APPLE__ + + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); + + if(!(window = SDL_CreateWindow(configuration.title().data(), + SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + configuration.size().x(), configuration.size().y(), + SDL_WINDOW_OPENGL|flags))){ + Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create core window:" << SDL_GetError(); + return false; + } + + if(!(context = SDL_GL_CreateContext(window))){ + Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create core context:" << SDL_GetError() << " falling back to compatibility context."; + SDL_DestroyWindow(window); + + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); + + if(!(window = SDL_CreateWindow(configuration.title().data(), + SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + configuration.size().x(), configuration.size().y(), + SDL_WINDOW_OPENGL|flags))){ + Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError(); + return false; + } + + if(!(context = SDL_GL_CreateContext(window))){ + Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create compatibility context:" << SDL_GetError(); + SDL_DestroyWindow(window); + window = nullptr; + return false; + } + } + + #else if(!(window = SDL_CreateWindow(configuration.title().data(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, configuration.size().x(), configuration.size().y(), @@ -125,6 +165,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { window = nullptr; return false; } + #endif #else context = SDL_SetVideoMode(configuration.size().x(), configuration.size().y(), 24, SDL_OPENGL|SDL_HWSURFACE|SDL_DOUBLEBUF); #endif From 905cd2fb9f4f52c0fcea665d744cd95d56021d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 11:29:34 +0100 Subject: [PATCH 30/64] Doc++ --- README.md | 2 +- src/CubeMapTexture.h | 6 ++++-- src/CubeMapTextureArray.h | 45 ++++++++++++++++++--------------------- src/Texture.h | 9 ++++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 98031e18a..b789be059 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ more comprehensive guide for building, packaging and crosscompiling. Minimal dependencies -------------------- -- C++ compiler with good C++11 support. Currently there are two compilers +* C++ compiler with good C++11 support. Currently there are two compilers which are tested to have everything needed: **GCC** >= 4.6 and **Clang** >= 3.1. On Windows you can use **MinGW**. GCC 4.5, 4.4 and **MSVC** 2013 support involves some ugly workarounds and thus is available only in diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index f55df5418..2281d7d69 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -165,7 +165,8 @@ class CubeMapTexture: public AbstractTexture { * @param coordinate Coordinate * @param level Mip level * @param internalFormat Internal format - * @param image %Image + * @param image @ref Image2D, @ref ImageReference2D or + * @ref Trade::ImageData2D * @return Reference to self (for method chaining) * * See @ref Texture::setImage() for more information. @@ -188,7 +189,8 @@ class CubeMapTexture: public AbstractTexture { * @param coordinate Coordinate * @param level Mip level * @param offset Offset where to put data in the texture - * @param image %Image + * @param image @ref Image2D, @ref ImageReference2D or + * @ref Trade::ImageData2D * @return Reference to self (for method chaining) * * See @ref Texture::setSubImage() for more information. diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index 4d238cdf9..34eef8203 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -43,25 +43,25 @@ See @ref CubeMapTexture documentation for introduction. @section CubeMapTextureArray-usage Usage Common usage is to specify each layer and face separately using @ref setSubImage(). -You have to allocate the memory for all layers and faces first either by -calling @ref setStorage() or by passing properly sized empty image to -@ref setImage(). Example: array with 16 layers of cube map faces, each face -consisting of six 64x64 images: +You have to allocate the memory for all layers and faces first by calling +@ref setStorage(). Example: array with 4 layers of cube maps, each cube map +consisting of six 64x64 images, i.e. 24 layers total: @code CubeMapTextureArray texture; texture.setMagnificationFilter(Sampler::Filter::Linear) // ... - .setStorage(Math::log2(64)+1, TextureFormat::RGBA8, {64, 64, 16}); + .setStorage(Math::log2(64)+1, TextureFormat::RGBA8, {64, 64, 24}); -for(std::size_t i = 0; i != 16; ++i) { - Image2D imagePositiveX(ColorFormat::RGBA, ColorType::UnsignedByte, {64, 64}, data); +for(std::size_t i = 0; i != 4; i += 6) { + Image3D imagePositiveX(ColorFormat::RGBA, ColorType::UnsignedByte, {64, 64, 1}, data); // ... - texture.setSubImage(i, CubeMapTextureArray::Coordinate::PositiveX, 0, {}, imagePositiveX); - texture.setSubImage(i, CubeMapTextureArray::Coordinate::NegativeX, 0, {}, imageNegativeX); + texture.setSubImage(0, Vector3i::zAxis(i+0), imagePositiveX); + texture.setSubImage(0, Vector3i::zAxis(i+1), imageNegativeX); + texture.setSubImage(0, Vector3i::zAxis(i+2), imagePositiveY); // ... } -// ... +texture.generateMipmap(); @endcode The texture is bound to layer specified by shader via @ref bind(). In shader, @@ -121,7 +121,8 @@ class CubeMapTextureArray: public AbstractTexture { /** * @brief Set storage * - * See @ref Texture::setStorage() for more information. + * Z coordinate of @p size must be multiple of 6. See + * @ref Texture::setStorage() for more information. */ CubeMapTextureArray& setStorage(Int levels, TextureFormat internalFormat, const Vector3i& size) { DataHelper<3>::setStorage(this, _target, levels, internalFormat, size); @@ -162,13 +163,14 @@ class CubeMapTextureArray: public AbstractTexture { * @brief Set image data * @param level Mip level * @param internalFormat Internal format - * @param image @ref Image, @ref ImageReference, @ref BufferImage - * or @ref Trade::ImageData of the same dimension count + * @param image @ref Image3D, @ref ImageReference3D or + * @ref Trade::ImageData3D * @return Reference to self (for method chaining) * * Sets texture image data from three-dimensional image for all cube * faces for all layers. Each group of 6 2D images is one cube map - * layer. The images are ordered the same way as Coordinate enum. + * layer, thus Z coordinate of @p image size must be multiple of 6. The + * images are in order of (+X, -X, +Y, -Y, +Z, -Z). * * See @ref Texture::setImage() for more information. */ @@ -187,16 +189,12 @@ class CubeMapTextureArray: public AbstractTexture { * @brief Set texture image 3D subdata * @param level Mip level * @param offset Offset where to put data in the texture - * @param image @ref Image3D, @ref ImageReference3D, @ref BufferImage3D - * or @ref Trade::ImageData3D + * @param image @ref Image3D, @ref ImageReference3D or + * @ref Trade::ImageData3D * @return Reference to self (for method chaining) * - * Sets texture image subdata for more than one level/face at once. - * - * Z coordinate of @p offset specifies layer and cube map face. If - * you want to start at given face in layer *n*, you have to specify - * Z coordinate as @f$ 6n + i @f$, where i is face index as specified - * in @ref Coordinate enum. + * Z coordinate is equivalent to layer * 6 + number of texture face, + * i.e. +X is `0` and so on, in order of (+X, -X, +Y, -Y, +Z, -Z). * * See @ref Texture::setSubImage() for more information. */ @@ -218,8 +216,7 @@ class CubeMapTextureArray: public AbstractTexture { * @param size Size of invalidated data * * Z coordinate is equivalent to layer * 6 + number of texture face, - * i.e. @ref Coordinate::PositiveX is `0` and so on, in the same order - * as in the enum. + * i.e. +X is `0` and so on, in order of (+X, -X, +Y, -Y, +Z, -Z). * * See @ref Texture::invalidateSubImage() for more information. */ diff --git a/src/Texture.h b/src/Texture.h index e94a60a3a..85254346a 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -78,8 +78,7 @@ You can create texture arrays by passing @ref Target::Texture2DArray "Texture3D::Target::Texture2DArray" to constructor. It is possible to specify each layer separately using @ref setSubImage(), but -you have to allocate the memory for all layers first either by calling -@ref setStorage() or by passing properly sized empty image to @ref setImage(). +you have to allocate the memory for all layers first by calling @ref setStorage(). Example: 2D texture array with 16 layers of 64x64 images: @code Texture3D texture(Texture3D::Target::Texture2DArray); @@ -350,7 +349,8 @@ template class Texture: public AbstractTexture { * @brief Set image data * @param level Mip level * @param internalFormat Internal format - * @param image %Image + * @param image @ref Image, @ref ImageReference or + * @ref Trade::ImageData of the same dimension count * @return Reference to self (for method chaining) * * For better performance when generating mipmaps using @@ -382,7 +382,8 @@ template class Texture: public AbstractTexture { * @brief Set image subdata * @param level Mip level * @param offset Offset where to put data in the texture - * @param image %Image + * @param image @ref Image, @ref ImageReference or + * @ref Trade::ImageData of the same dimension count * @return Reference to self (for method chaining) * * If @extension{EXT,direct_state_access} is not available, the From 576f9ef2101d67d3ad269a7bc9de99b8aba9beea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 18:17:36 +0100 Subject: [PATCH 31/64] Improved tests for Image, ImageReference and Trade::ImageData classes. Properly testing copy and move constructors. --- src/Test/CMakeLists.txt | 1 + src/Test/ImageReferenceTest.cpp | 69 ++++++++++++++++++++++++++++ src/Test/ImageTest.cpp | 79 +++++++++++++++++++++++--------- src/Trade/Test/ImageDataTest.cpp | 65 +++++++++++++++++--------- 4 files changed, 170 insertions(+), 44 deletions(-) create mode 100644 src/Test/ImageReferenceTest.cpp diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index 6eaf09105..d484b063b 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -30,6 +30,7 @@ corrade_add_test(DebugMessageTest DebugMessageTest.cpp LIBRARIES Magnum) corrade_add_test(DefaultFramebufferTest DefaultFramebufferTest.cpp LIBRARIES Magnum) corrade_add_test(FramebufferTest FramebufferTest.cpp LIBRARIES Magnum) corrade_add_test(ImageTest ImageTest.cpp LIBRARIES Magnum) +corrade_add_test(ImageReferenceTest ImageReferenceTest.cpp LIBRARIES Magnum) corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum) corrade_add_test(RendererTest RendererTest.cpp LIBRARIES Magnum) corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES MagnumTestLib) diff --git a/src/Test/ImageReferenceTest.cpp b/src/Test/ImageReferenceTest.cpp new file mode 100644 index 000000000..eeb80a59f --- /dev/null +++ b/src/Test/ImageReferenceTest.cpp @@ -0,0 +1,69 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "ColorFormat.h" +#include "ImageReference.h" + +namespace Magnum { namespace Test { + +class ImageReferenceTest: public TestSuite::Tester { + public: + explicit ImageReferenceTest(); + + void construct(); + void setData(); +}; + +ImageReferenceTest::ImageReferenceTest() { + addTests({&ImageReferenceTest::construct, + &ImageReferenceTest::setData}); +} + +void ImageReferenceTest::construct() { + const unsigned char data[3] = {}; + ImageReference2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + + CORRADE_COMPARE(a.format(), ColorFormat::Red); + CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.size(), Vector2i(1, 3)); + CORRADE_COMPARE(a.data(), data); +} + +void ImageReferenceTest::setData() { + const unsigned char data[3] = {}; + ImageReference2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + const unsigned char data2[8] = {}; + a.setData(data2); + + CORRADE_COMPARE(a.format(), ColorFormat::Red); + CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.size(), Vector2i(1, 3)); + CORRADE_COMPARE(a.data(), reinterpret_cast(data2)); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::ImageReferenceTest) diff --git a/src/Test/ImageTest.cpp b/src/Test/ImageTest.cpp index 1f81ace24..7ea196199 100644 --- a/src/Test/ImageTest.cpp +++ b/src/Test/ImageTest.cpp @@ -33,53 +33,87 @@ class ImageTest: public TestSuite::Tester { public: explicit ImageTest(); - void moveConstructor(); - void moveAssignment(); + void construct(); + void constructCopy(); + void constructMove(); + + void setData(); void toReference(); void release(); }; ImageTest::ImageTest() { - addTests({&ImageTest::moveConstructor, - &ImageTest::moveAssignment, + addTests({&ImageTest::construct, + &ImageTest::constructCopy, + &ImageTest::constructMove, + + &ImageTest::setData, &ImageTest::toReference, &ImageTest::release}); } -void ImageTest::moveConstructor() { - unsigned char* data = new unsigned char[3]; +void ImageTest::construct() { + auto data = new unsigned char[3]; Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + CORRADE_COMPARE(a.format(), ColorFormat::Red); + CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.size(), Vector2i(1, 3)); + CORRADE_COMPARE(a.data(), data); +} + +void ImageTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void ImageTest::constructMove() { + auto data = new unsigned char[3]; + Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); Image2D b(std::move(a)); - CORRADE_VERIFY(!a.data()); + + CORRADE_COMPARE(a.data(), nullptr); + CORRADE_COMPARE(a.size(), Vector2i()); + CORRADE_COMPARE(b.format(), ColorFormat::Red); CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); - CORRADE_VERIFY(b.data() == data); + CORRADE_COMPARE(b.data(), data); + + auto data2 = new unsigned char[3]; + Image2D c(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 6}, data2); + c = std::move(b); + + CORRADE_COMPARE(b.data(), data2); + CORRADE_COMPARE(b.size(), Vector2i(2, 6)); + + CORRADE_COMPARE(c.format(), ColorFormat::Red); + CORRADE_COMPARE(c.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(c.size(), Vector2i(1, 3)); + CORRADE_COMPARE(c.data(), data); } -void ImageTest::moveAssignment() { - unsigned char* data = new unsigned char[3]; +void ImageTest::setData() { + auto data = new unsigned char[3]; Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + auto data2 = new unsigned short[2*4]; + a.setData(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 1}, data2); - Image2D b(ColorFormat::Red, ColorType::UnsignedByte); - b = std::move(a); - CORRADE_VERIFY(!a.data()); - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); - CORRADE_COMPARE(b.size(), Vector2i(1, 3)); - CORRADE_VERIFY(b.data() == data); + CORRADE_COMPARE(a.format(), ColorFormat::RGBA); + CORRADE_COMPARE(a.type(), ColorType::UnsignedShort); + CORRADE_COMPARE(a.size(), Vector2i(2, 1)); + CORRADE_COMPARE(a.data(), reinterpret_cast(data2)); } void ImageTest::toReference() { - unsigned char* data = new unsigned char[3]; + auto data = new unsigned char[3]; const Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); - ImageReference2D b = a; + CORRADE_COMPARE(b.format(), ColorFormat::Red); CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); - CORRADE_VERIFY(b.data() == data); + CORRADE_COMPARE(b.data(), data); CORRADE_VERIFY((std::is_convertible::value)); { @@ -95,9 +129,10 @@ void ImageTest::release() { unsigned char data[] = {'c', 'a', 'f', 'e'}; Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 4}, data); const unsigned char* const pointer = a.release(); + CORRADE_COMPARE(pointer, data); - CORRADE_VERIFY(!a.data()); - CORRADE_VERIFY(a.size().isZero()); + CORRADE_COMPARE(a.data(), nullptr); + CORRADE_COMPARE(a.size(), Vector2i()); } }} diff --git a/src/Trade/Test/ImageDataTest.cpp b/src/Trade/Test/ImageDataTest.cpp index b805d2be9..040cccc94 100644 --- a/src/Trade/Test/ImageDataTest.cpp +++ b/src/Trade/Test/ImageDataTest.cpp @@ -33,49 +33,69 @@ class ImageDataTest: public TestSuite::Tester { public: explicit ImageDataTest(); - void moveConstructor(); - void moveAssignment(); + void construct(); + void constructCopy(); + void constructMove(); + void toReference(); void release(); }; ImageDataTest::ImageDataTest() { - addTests({&ImageDataTest::moveConstructor, - &ImageDataTest::moveAssignment, + addTests({&ImageDataTest::construct, + &ImageDataTest::constructCopy, + &ImageDataTest::constructMove, + &ImageDataTest::toReference, &ImageDataTest::release}); } -void ImageDataTest::moveConstructor() { - unsigned char* data = new unsigned char[3]; +void ImageDataTest::construct() { + auto data = new unsigned char[3]; Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); - Trade::ImageData2D b(std::move(a)); - CORRADE_VERIFY(!a.data()); - CORRADE_COMPARE(b.format(), ColorFormat::Red); - CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); - CORRADE_COMPARE(b.size(), Vector2i(1, 3)); - CORRADE_VERIFY(b.data() == data); + CORRADE_COMPARE(a.format(), ColorFormat::Red); + CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.size(), Vector2i(1, 3)); + CORRADE_COMPARE(a.data(), data); +} + +void ImageDataTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); } -void ImageDataTest::moveAssignment() { - unsigned char* data = new unsigned char[3]; +void ImageDataTest::constructMove() { + auto data = new unsigned char[3]; Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); + Trade::ImageData2D b(std::move(a)); + + CORRADE_COMPARE(a.data(), nullptr); + CORRADE_COMPARE(a.size(), Vector2i()); - Trade::ImageData2D b(ColorFormat::Red, ColorType::UnsignedByte, {}, nullptr); - b = std::move(a); - CORRADE_VERIFY(!a.data()); CORRADE_COMPARE(b.format(), ColorFormat::Red); CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); - CORRADE_VERIFY(b.data() == data); + CORRADE_COMPARE(b.data(), data); + + auto data2 = new unsigned char[3]; + Trade::ImageData2D c(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 6}, data2); + c = std::move(b); + + CORRADE_COMPARE(b.data(), data2); + CORRADE_COMPARE(b.size(), Vector2i(2, 6)); + + CORRADE_COMPARE(c.format(), ColorFormat::Red); + CORRADE_COMPARE(c.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(c.size(), Vector2i(1, 3)); + CORRADE_COMPARE(c.data(), data); } void ImageDataTest::toReference() { - unsigned char* data = new unsigned char[3]; + auto data = new unsigned char[3]; const Trade::ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data); - ImageReference2D b = a; + CORRADE_COMPARE(b.format(), ColorFormat::Red); CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(1, 3)); @@ -95,9 +115,10 @@ void ImageDataTest::release() { unsigned char data[] = {'b', 'e', 'e', 'r'}; ImageData2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 4}, data); const unsigned char* const pointer = a.release(); + CORRADE_COMPARE(pointer, data); - CORRADE_VERIFY(!a.data()); - CORRADE_VERIFY(a.size().isZero()); + CORRADE_COMPARE(a.data(), nullptr); + CORRADE_COMPARE(a.size(), Vector2i()); } }}} From 98d77e5bd1033a6da2316dfa12e255b8a2653092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 18:39:09 +0100 Subject: [PATCH 32/64] Improved BufferImage API, added test. Move constructor and move assignment now behaves similarly to Image (not only the buffer but also size is swapped). Added constructor taking size + data, reordered setData() parameters to match order in Image. The old setData() function is now alias to the new one, is marked as deprecated and will be removed in future release. --- src/AbstractFramebuffer.cpp | 2 +- src/AbstractTexture.cpp | 2 +- src/BufferImage.cpp | 8 ++- src/BufferImage.h | 56 +++++++++++++-- src/Test/BufferImageGLTest.cpp | 127 +++++++++++++++++++++++++++++++++ src/Test/CMakeLists.txt | 4 ++ 6 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 src/Test/BufferImageGLTest.cpp diff --git a/src/AbstractFramebuffer.cpp b/src/AbstractFramebuffer.cpp index bbd5659f8..96ec4f94f 100644 --- a/src/AbstractFramebuffer.cpp +++ b/src/AbstractFramebuffer.cpp @@ -208,7 +208,7 @@ void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Buf /* If the buffer doesn't have sufficient size, resize it */ /** @todo Explicitly reset also when buffer usage changes */ if(image.size() != size) - image.setData(size, image.format(), image.type(), nullptr, usage); + image.setData(image.format(), image.type(), size, nullptr, usage); image.buffer().bind(Buffer::Target::PixelPack); /** @todo De-duplicate buffer size computation */ diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 0f7d1684e..c97bbc0f0 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -999,7 +999,7 @@ template void AbstractTexture::image(GLenum target, GLin const Math::Vector size = DataHelper::imageSize(this, target, level); const std::size_t dataSize = size.product()*image.pixelSize(); if(image.size() != size) - image.setData(size, image.format(), image.type(), nullptr, usage); + image.setData(image.format(), image.type(), size, nullptr, usage); image.buffer().bind(Buffer::Target::PixelPack); (this->*getImageImplementation)(target, level, image.format(), image.type(), dataSize, nullptr); diff --git a/src/BufferImage.cpp b/src/BufferImage.cpp index 81d877d52..3d3a12f39 100644 --- a/src/BufferImage.cpp +++ b/src/BufferImage.cpp @@ -27,7 +27,13 @@ namespace Magnum { #ifndef MAGNUM_TARGET_GLES2 -template void BufferImage::setData(const typename DimensionTraits::VectorType& size, ColorFormat format, ColorType type, const void* data, BufferUsage usage) { +template BufferImage::BufferImage(ColorFormat format, ColorType type, const typename DimensionTraits< Dimensions, Int >::VectorType& size, const void* data, BufferUsage usage): AbstractImage(format, type), _size(size), _buffer(Buffer::Target::PixelPack) { + _buffer.setData({data, pixelSize()*size.product()}, usage); +} + +template BufferImage::BufferImage(ColorFormat format, ColorType type): AbstractImage(format, type), _buffer(Buffer::Target::PixelPack) {} + +template void BufferImage::setData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data, BufferUsage usage) { _format = format; _type = type; _size = size; diff --git a/src/BufferImage.h b/src/BufferImage.h index d92d62ef5..637a995e5 100644 --- a/src/BufferImage.h +++ b/src/BufferImage.h @@ -54,13 +54,36 @@ template class MAGNUM_EXPORT BufferImage: public Abstrac * @brief Constructor * @param format Format of pixel data * @param type Data type of pixel data + * @param size %Image size + * @param data %Image data + * @param usage %Image buffer usage * - * Dimensions and buffer are empty, call @ref setData() to fill the + * Note that the image data are not copied on construction, but they + * are deleted on class destruction. + */ + explicit BufferImage(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data, BufferUsage usage); + + /** + * @brief Constructor + * @param format Format of pixel data + * @param type Data type of pixel data + * + * Size is zero and buffer are empty, call @ref setData() to fill the * image with data. */ - explicit BufferImage(ColorFormat format, ColorType type): AbstractImage(format, type) { - _buffer.setTargetHint(Buffer::Target::PixelPack); - } + explicit BufferImage(ColorFormat format, ColorType type); + + /** @brief Copying is not allowed */ + BufferImage(const BufferImage&) = delete; + + /** @brief Move constructor */ + BufferImage(BufferImage&& other) noexcept; + + /** @brief Copying is not allowed */ + BufferImage& operator=(const BufferImage&) = delete; + + /** @brief Move assignment */ + BufferImage& operator=(BufferImage&& other) noexcept; /** @brief %Image size */ typename DimensionTraits::VectorType size() const { return _size; } @@ -70,9 +93,9 @@ template class MAGNUM_EXPORT BufferImage: public Abstrac /** * @brief Set image data - * @param size %Image size * @param format Format of pixel data * @param type Data type of pixel data + * @param size %Image size * @param data %Image data * @param usage %Image buffer usage * @@ -80,7 +103,17 @@ template class MAGNUM_EXPORT BufferImage: public Abstrac * after filling the buffer. * @see @ref Buffer::setData() */ - void setData(const typename DimensionTraits::VectorType& size, ColorFormat format, ColorType type, const void* data, BufferUsage usage); + void setData(ColorFormat format, ColorType type, const typename DimensionTraits::VectorType& size, const void* data, BufferUsage usage); + + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @copybrief setData(ColorFormat, ColorType, const typename DimensionTraits::VectorType&, const void*, BufferUsage) + * @deprecated Use @ref Magnum::BufferImage::setData(ColorFormat, ColorType, const typename DimensionTraits::VectorType&, const void*, BufferUsage) "setData(ColorFormat, ColorType, const typename DimensionTraits::VectorType&, const void*, BufferUsage)" instead. + */ + CORRADE_DEPRECATED("use setData(ColorFormat, ColorType, VectorNi, const void*, BufferUsage) instead") void setData(const typename DimensionTraits::VectorType& size, ColorFormat format, ColorType type, const void* data, BufferUsage usage) { + setData(format, type, size, data, usage); + } + #endif private: Math::Vector _size; @@ -95,6 +128,17 @@ typedef BufferImage<2> BufferImage2D; /** @brief Three-dimensional buffer image */ typedef BufferImage<3> BufferImage3D; + +template inline BufferImage::BufferImage(BufferImage&& other) noexcept: AbstractImage(std::move(other)), _size(other._size), _buffer(std::move(other._buffer)) { + other._size = {}; +} + +template inline BufferImage& BufferImage::operator=(BufferImage&& other) noexcept { + AbstractImage::operator=(std::move(other)); + std::swap(_size, other._size); + std::swap(_buffer, other._buffer); + return *this; +} #endif } diff --git a/src/Test/BufferImageGLTest.cpp b/src/Test/BufferImageGLTest.cpp new file mode 100644 index 000000000..38db4ef88 --- /dev/null +++ b/src/Test/BufferImageGLTest.cpp @@ -0,0 +1,127 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "BufferImage.h" +#include "ColorFormat.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class BufferImageTest: public AbstractOpenGLTester { + public: + explicit BufferImageTest(); + + void construct(); + void constructCopy(); + void constructMove(); + + void setData(); +}; + +BufferImageTest::BufferImageTest() { + addTests({&BufferImageTest::construct, + &BufferImageTest::constructCopy, + &BufferImageTest::constructMove, + + &BufferImageTest::setData}); +} + +void BufferImageTest::construct() { + const unsigned char data[] = { 'a', 'b', 'c' }; + BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw); + const auto imageData = a.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(a.format(), ColorFormat::Red); + CORRADE_COMPARE(a.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(a.size(), Vector2i(1, 3)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 3), + TestSuite::Compare::Container); +} + +void BufferImageTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void BufferImageTest::constructMove() { + const unsigned char data[3] = { 'a', 'b', 'c' }; + BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw); + const Int id = a.buffer().id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + BufferImage2D b(std::move(a)); + + CORRADE_COMPARE(a.buffer().id(), 0); + CORRADE_COMPARE(a.size(), Vector2i()); + + CORRADE_COMPARE(b.format(), ColorFormat::Red); + CORRADE_COMPARE(b.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(b.size(), Vector2i(1, 3)); + CORRADE_COMPARE(b.buffer().id(), id); + + const unsigned short data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + BufferImage2D c(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 1}, data2, BufferUsage::StaticDraw); + const Int cId = c.buffer().id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.buffer().id(), cId); + CORRADE_COMPARE(b.size(), Vector2i(2, 1)); + + CORRADE_COMPARE(c.format(), ColorFormat::Red); + CORRADE_COMPARE(c.type(), ColorType::UnsignedByte); + CORRADE_COMPARE(c.size(), Vector2i(1, 3)); + CORRADE_COMPARE(c.buffer().id(), id); +} + +void BufferImageTest::setData() { + const unsigned char data[3] = { 'a', 'b', 'c' }; + BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw); + + const unsigned short data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + a.setData(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 1}, data2, BufferUsage::StaticDraw); + const auto imageData = a.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(a.format(), ColorFormat::RGBA); + CORRADE_COMPARE(a.type(), ColorType::UnsignedShort); + CORRADE_COMPARE(a.size(), Vector2i(2, 1)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data2, data2 + 8), + TestSuite::Compare::Container); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::BufferImageTest) diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index d484b063b..18aee42d9 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -48,6 +48,10 @@ if(BUILD_GL_TESTS) corrade_add_test(MeshGLTest MeshGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(RenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + + if(NOT MAGNUM_TARGET_GLES2) + corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + endif() endif() set_target_properties(ResourceManagerTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) From f3761b601dd5814932c3500d2ee74aaa0af7cea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 18:46:10 +0100 Subject: [PATCH 33/64] Added BufferImage&& overloads to *Texture*::set*Image() functions. The point is that we accept everything except const BufferImage&, as the buffer needs to be bound, which is not an constant operation, as it modifies internal GL state tracker. --- src/CubeMapTexture.h | 11 +++++++++++ src/CubeMapTextureArray.h | 10 ++++++++++ src/Texture.h | 10 ++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index 2281d7d69..80eb4f3b3 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -182,6 +182,11 @@ class CubeMapTexture: public AbstractTexture { DataHelper<2>::setImage(this, GLenum(coordinate), level, internalFormat, image); return *this; } + + /** @overload */ + CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D&& image) { + return setImage(coordinate, level, internalFormat, image); + } #endif /** @@ -206,6 +211,12 @@ class CubeMapTexture: public AbstractTexture { DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image); return *this; } + + /** @overload */ + CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) { + DataHelper<2>::setSubImage(this, GLenum(coordinate), level, offset, image); + return *this; + } #endif /** diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index 34eef8203..f4d54877a 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -185,6 +185,11 @@ class CubeMapTextureArray: public AbstractTexture { return *this; } + /** @overload */ + CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, BufferImage3D&& image) { + return setImage(level, internalFormat, image); + } + /** * @brief Set texture image 3D subdata * @param level Mip level @@ -209,6 +214,11 @@ class CubeMapTextureArray: public AbstractTexture { return *this; } + /** @overload */ + CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, BufferImage3D&& image) { + return setSubImage(level, offset, image); + } + /** * @brief Invalidate texture subimage * @param level Mip level diff --git a/src/Texture.h b/src/Texture.h index 85254346a..ad63a0b07 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -376,6 +376,11 @@ template class Texture: public AbstractTexture { DataHelper::setImage(this, _target, level, internalFormat, image); return *this; } + + /** @overload */ + Texture& setImage(Int level, TextureFormat internalFormat, BufferImage&& image) { + return setImage(level, internalFormat, image); + } #endif /** @@ -406,6 +411,11 @@ template class Texture: public AbstractTexture { DataHelper::setSubImage(this, _target, level, offset, image); return *this; } + + /** @overload */ + Texture& setSubImage(Int level, const typename DimensionTraits::VectorType& offset, BufferImage&& image) { + return setSubImage(level, offset, image); + } #endif /** From 42c2032d815309ef94be724abcad2dcddfc46682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 18:51:31 +0100 Subject: [PATCH 34/64] Simplified and tested Texture move constructor/assignment. Move constructor and move assignment is now noexcept and it just swaps the data of the two instances instead of calling GL API, thus it can be inline. Also removed unneded limitations in BufferTexture. --- src/AbstractTexture.cpp | 32 ++++---------------- src/AbstractTexture.h | 16 +++++++--- src/BufferTexture.h | 5 ---- src/Test/AbstractTextureGLTest.cpp | 48 +++++++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 36 deletions(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index c97bbc0f0..3d7c33135 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -124,8 +124,12 @@ Int AbstractTexture::maxIntegerSamples() { } #endif -void AbstractTexture::destroy() { - /* Moved out */ +AbstractTexture::AbstractTexture(GLenum target): _target(target) { + glGenTextures(1, &_id); +} + +AbstractTexture::~AbstractTexture() { + /* Moved out, nothing to do */ if(!_id) return; /* Remove all bindings */ @@ -135,30 +139,6 @@ void AbstractTexture::destroy() { glDeleteTextures(1, &_id); } -void AbstractTexture::move() { - _id = 0; -} - -AbstractTexture::AbstractTexture(GLenum target): _target(target) { - glGenTextures(1, &_id); -} - -AbstractTexture::~AbstractTexture() { destroy(); } - -AbstractTexture::AbstractTexture(AbstractTexture&& other): _target(other._target), _id(other._id) { - other.move(); -} - -AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) { - destroy(); - - _target = other._target; - _id = other._id; - - other.move(); - return *this; -} - std::string AbstractTexture::label() const { return Context::current()->state().debug->getLabelImplementation(GL_TEXTURE, _id); } diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 495aeef00..95b4cd4b0 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -158,13 +158,13 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { AbstractTexture(const AbstractTexture&) = delete; /** @brief Move constructor */ - AbstractTexture(AbstractTexture&& other); + AbstractTexture(AbstractTexture&& other) noexcept; /** @brief Copying is not allowed */ AbstractTexture& operator=(const AbstractTexture&) = delete; /** @brief Move assignment */ - AbstractTexture& operator=(AbstractTexture&& other); + AbstractTexture& operator=(AbstractTexture&& other) noexcept; /** * @brief %Texture label @@ -482,8 +482,6 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { #endif static InvalidateSubImageImplementation invalidateSubImageImplementation; - void MAGNUM_LOCAL destroy(); - void MAGNUM_LOCAL move(); ColorFormat MAGNUM_LOCAL imageFormatForInternalFormat(TextureFormat internalFormat); ColorType MAGNUM_LOCAL imageTypeForInternalFormat(TextureFormat internalFormat); @@ -597,6 +595,16 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { }; #endif +inline AbstractTexture::AbstractTexture(AbstractTexture&& other) noexcept: _target(other._target), _id(other._id) { + other._id = 0; +} + +inline AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) noexcept { + std::swap(_target, other._target); + std::swap(_id, other._id); + return *this; +} + } #endif diff --git a/src/BufferTexture.h b/src/BufferTexture.h index ac9d37286..f53c01e29 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -201,11 +201,6 @@ and respective function documentation for more information. class MAGNUM_EXPORT BufferTexture: private AbstractTexture { friend class Context; - BufferTexture(const BufferTexture&) = delete; - BufferTexture(BufferTexture&&) = delete; - BufferTexture& operator=(const BufferTexture&) = delete; - BufferTexture& operator=(BufferTexture&&) = delete; - public: /** @copydoc AbstractTexture::maxLabelLength() */ static Int maxLabelLength() { return AbstractTexture::maxLabelLength(); } diff --git a/src/Test/AbstractTextureGLTest.cpp b/src/Test/AbstractTextureGLTest.cpp index fdf8d9539..42865ae14 100644 --- a/src/Test/AbstractTextureGLTest.cpp +++ b/src/Test/AbstractTextureGLTest.cpp @@ -33,11 +33,57 @@ class AbstractTextureGLTest: public AbstractOpenGLTester { public: explicit AbstractTextureGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; AbstractTextureGLTest::AbstractTextureGLTest() { - addTests({&AbstractTextureGLTest::label}); + addTests({&AbstractTextureGLTest::construct, + &AbstractTextureGLTest::constructCopy, + &AbstractTextureGLTest::constructMove, + + &AbstractTextureGLTest::label}); +} + +void AbstractTextureGLTest::construct() { + { + const Texture2D texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractTextureGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void AbstractTextureGLTest::constructMove() { + Texture2D a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Texture2D b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + Texture2D c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); } void AbstractTextureGLTest::label() { From a4aad89cfb9499a0534a66bdcd161890c3771d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 18:56:42 +0100 Subject: [PATCH 35/64] Ability to print Shader::Type enum to Debug output. --- src/Shader.cpp | 19 +++++++++++++++ src/Shader.h | 3 +++ src/Test/CMakeLists.txt | 1 + src/Test/ShaderTest.cpp | 52 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 src/Test/ShaderTest.cpp diff --git a/src/Shader.cpp b/src/Shader.cpp index b75c91c16..a81b6e997 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -682,4 +682,23 @@ bool Shader::compile() { return success; } +#ifndef DOXYGEN_GENERATING_OUTPUT +Debug operator<<(Debug debug, const Shader::Type value) { + switch(value) { + #define _c(value) case Shader::Type::value: return debug << "Shader::Type::" #value; + _c(Vertex) + #ifndef MAGNUM_TARGET_GLES + _c(TessellationControl) + _c(TessellationEvaluation) + _c(Geometry) + _c(Compute) + #endif + _c(Fragment) + #undef _c + } + + return debug << "Shader::Type::(invalid)"; +} +#endif + } diff --git a/src/Shader.h b/src/Shader.h index e4a663673..826244d9a 100644 --- a/src/Shader.h +++ b/src/Shader.h @@ -522,6 +522,9 @@ class MAGNUM_EXPORT Shader: public AbstractObject { std::vector sources; }; +/** @debugoperator{Magnum::Shader} */ +Debug MAGNUM_EXPORT operator<<(Debug debug, Shader::Type value); + } #endif diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index 18aee42d9..4e0d05c5c 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -35,6 +35,7 @@ corrade_add_test(MeshTest MeshTest.cpp LIBRARIES Magnum) corrade_add_test(RendererTest RendererTest.cpp LIBRARIES Magnum) corrade_add_test(ResourceManagerTest ResourceManagerTest.cpp LIBRARIES MagnumTestLib) corrade_add_test(SamplerTest SamplerTest.cpp LIBRARIES Magnum) +corrade_add_test(ShaderTest ShaderTest.cpp LIBRARIES Magnum) if(BUILD_GL_TESTS) corrade_add_test(AbstractObjectGLTest AbstractObjectGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) diff --git a/src/Test/ShaderTest.cpp b/src/Test/ShaderTest.cpp new file mode 100644 index 000000000..451be692a --- /dev/null +++ b/src/Test/ShaderTest.cpp @@ -0,0 +1,52 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include "Shader.h" + +namespace Magnum { namespace Test { + +class ShaderTest: public TestSuite::Tester { + public: + explicit ShaderTest(); + + void debugType(); +}; + +ShaderTest::ShaderTest() { + addTests({&ShaderTest::debugType}); +} + +void ShaderTest::debugType() { + std::ostringstream out; + + Debug(&out) << Shader::Type::Fragment; + CORRADE_COMPARE(out.str(), "Shader::Type::Fragment\n"); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::ShaderTest) From 5f51652aff5c31577b9816b41bbc92414d86b493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 18:58:20 +0100 Subject: [PATCH 36/64] Updated, documented and tested Shader and ShaderProgram movement. Added Shader::type() and Shader::sources() accessors for testing purposes, it involved renaming private members (no functional change). --- src/Shader.cpp | 63 ++++++++----------- src/Shader.h | 36 ++++++++--- src/Test/AbstractShaderProgramGLTest.cpp | 62 +++++++++++++++++-- src/Test/ShaderGLTest.cpp | 78 +++++++++++++++++++++++- 4 files changed, 187 insertions(+), 52 deletions(-) diff --git a/src/Shader.cpp b/src/Shader.cpp index a81b6e997..b6b307893 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -540,19 +540,19 @@ Shader::Shader(const Version version, const Type type): _type(type), _id(0) { switch(version) { #ifndef MAGNUM_TARGET_GLES - case Version::GL210: sources.push_back("#version 120\n"); return; - case Version::GL300: sources.push_back("#version 130\n"); return; - case Version::GL310: sources.push_back("#version 140\n"); return; - case Version::GL320: sources.push_back("#version 150\n"); return; - case Version::GL330: sources.push_back("#version 330\n"); return; - case Version::GL400: sources.push_back("#version 400\n"); return; - case Version::GL410: sources.push_back("#version 410\n"); return; - case Version::GL420: sources.push_back("#version 420\n"); return; - case Version::GL430: sources.push_back("#version 430\n"); return; - case Version::GL440: sources.push_back("#version 440\n"); return; + case Version::GL210: _sources.push_back("#version 120\n"); return; + case Version::GL300: _sources.push_back("#version 130\n"); return; + case Version::GL310: _sources.push_back("#version 140\n"); return; + case Version::GL320: _sources.push_back("#version 150\n"); return; + case Version::GL330: _sources.push_back("#version 330\n"); return; + case Version::GL400: _sources.push_back("#version 400\n"); return; + case Version::GL410: _sources.push_back("#version 410\n"); return; + case Version::GL420: _sources.push_back("#version 420\n"); return; + case Version::GL430: _sources.push_back("#version 430\n"); return; + case Version::GL440: _sources.push_back("#version 440\n"); return; #else - case Version::GLES200: sources.push_back("#version 100\n"); return; - case Version::GLES300: sources.push_back("#version 300\n"); return; + case Version::GLES200: _sources.push_back("#version 100\n"); return; + case Version::GLES300: _sources.push_back("#version 300\n"); return; #endif case Version::None: @@ -562,24 +562,11 @@ Shader::Shader(const Version version, const Type type): _type(type), _id(0) { CORRADE_ASSERT_UNREACHABLE(); } -Shader::Shader(Shader&& other): _type(other._type), _id(other._id), sources(std::move(other.sources)) { - other._id = 0; -} - Shader::~Shader() { - if(_id) glDeleteShader(_id); -} + /* Moved out, nothing to do */ + if(!_id) return; -Shader& Shader::operator=(Shader&& other) { glDeleteShader(_id); - - _type = other._type; - sources = std::move(other.sources); - _id = other._id; - - other._id = 0; - - return *this; } std::string Shader::label() const { @@ -599,6 +586,8 @@ Shader& Shader::setLabel(const std::string& label) { return *this; } +std::vector Shader::sources() const { return _sources; } + Shader& Shader::addSource(std::string source) { if(!source.empty()) { #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(__MINGW32__) @@ -608,14 +597,14 @@ Shader& Shader::addSource(std::string source) { /* Fix line numbers, so line 41 of third added file is marked as 3(41). Source 0 is the #version string added in constructor. */ - sources.push_back("#line 1 " + + _sources.push_back("#line 1 " + #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(__MINGW32__) - std::to_string((sources.size()+1)/2) + + std::to_string((_sources.size()+1)/2) + #else converter.str() + #endif '\n'); - sources.push_back(std::move(source)); + _sources.push_back(std::move(source)); } return *this; @@ -630,20 +619,20 @@ Shader& Shader::addFile(const std::string& filename) { } bool Shader::compile() { - CORRADE_ASSERT(sources.size() > 1, "Shader::compile(): no files added", false); + CORRADE_ASSERT(_sources.size() > 1, "Shader::compile(): no files added", false); /* Array of source string pointers and their lengths */ /** @todo Use `Containers::ArrayTuple` to avoid one allocation if it ever gets to be implemented (we need properly aligned memory too) */ - Containers::Array pointers(sources.size()); - Containers::Array sizes(sources.size()); - for(std::size_t i = 0; i != sources.size(); ++i) { - pointers[i] = static_cast(sources[i].data()); - sizes[i] = sources[i].size(); + Containers::Array pointers(_sources.size()); + Containers::Array sizes(_sources.size()); + for(std::size_t i = 0; i != _sources.size(); ++i) { + pointers[i] = static_cast(_sources[i].data()); + sizes[i] = _sources[i].size(); } /* Create shader and set its source */ - glShaderSource(_id, sources.size(), pointers, sizes); + glShaderSource(_id, _sources.size(), pointers, sizes); /* Compile shader */ glCompileShader(_id); diff --git a/src/Shader.h b/src/Shader.h index 826244d9a..6764fde00 100644 --- a/src/Shader.h +++ b/src/Shader.h @@ -44,9 +44,6 @@ namespace Magnum { See AbstractShaderProgram for more information. */ class MAGNUM_EXPORT Shader: public AbstractObject { - Shader(const Shader&) = delete; - Shader& operator=(const Shader&) = delete; - public: /** * @brief %Shader type @@ -439,6 +436,12 @@ class MAGNUM_EXPORT Shader: public AbstractObject { */ explicit Shader(Version version, Type type); + /** @brief Copying is not allowed */ + Shader(const Shader&) = delete; + + /** @brief Move constructor */ + Shader(Shader&& other) noexcept; + /** * @brief Destructor * @@ -447,11 +450,11 @@ class MAGNUM_EXPORT Shader: public AbstractObject { */ ~Shader(); - /** @brief Move constructor */ - Shader(Shader&& other); + /** @brief Copying is not allowed */ + Shader& operator=(const Shader&) = delete; - /** @brief Move assignment operator */ - Shader& operator=(Shader&& other); + /** @brief Move assignment */ + Shader& operator=(Shader&& other) noexcept; /** @brief OpenGL shader ID */ GLuint id() const { return _id; } @@ -482,6 +485,12 @@ class MAGNUM_EXPORT Shader: public AbstractObject { */ Shader& setLabel(const std::string& label); + /** @brief Shader type */ + Type type() const { return _type; } + + /** @brief Shader sources */ + std::vector sources() const; + /** * @brief Add shader source * @param source String with shader source @@ -519,12 +528,23 @@ class MAGNUM_EXPORT Shader: public AbstractObject { Type _type; GLuint _id; - std::vector sources; + std::vector _sources; }; /** @debugoperator{Magnum::Shader} */ Debug MAGNUM_EXPORT operator<<(Debug debug, Shader::Type value); +inline Shader::Shader(Shader&& other) noexcept: _type(other._type), _id(other._id), _sources(std::move(other._sources)) { + other._id = 0; +} + +inline Shader& Shader::operator=(Shader&& other) noexcept { + std::swap(_type, other._type); + std::swap(_id, other._id); + std::swap(_sources, other._sources); + return *this; +} + } #endif diff --git a/src/Test/AbstractShaderProgramGLTest.cpp b/src/Test/AbstractShaderProgramGLTest.cpp index 3bb3a7a6b..0881927c5 100644 --- a/src/Test/AbstractShaderProgramGLTest.cpp +++ b/src/Test/AbstractShaderProgramGLTest.cpp @@ -33,11 +33,66 @@ class AbstractShaderProgramGLTest: public AbstractOpenGLTester { public: explicit AbstractShaderProgramGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() { - addTests({&AbstractShaderProgramGLTest::label}); + addTests({&AbstractShaderProgramGLTest::construct, + &AbstractShaderProgramGLTest::constructCopy, + &AbstractShaderProgramGLTest::constructMove, + + &AbstractShaderProgramGLTest::label}); +} + +namespace { + +class MyShader: public AbstractShaderProgram { + public: + explicit MyShader() {} +}; + +} + +void AbstractShaderProgramGLTest::construct() { + { + const MyShader shader; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(shader.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractShaderProgramGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void AbstractShaderProgramGLTest::constructMove() { + MyShader a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + MyShader b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + MyShader c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); } void AbstractShaderProgramGLTest::label() { @@ -46,11 +101,6 @@ void AbstractShaderProgramGLTest::label() { !Context::current()->isExtensionSupported()) CORRADE_SKIP("Required extension is not available"); - class MyShader: public AbstractShaderProgram { - public: - explicit MyShader() {} - }; - MyShader shader; CORRADE_COMPARE(shader.label(), ""); diff --git a/src/Test/ShaderGLTest.cpp b/src/Test/ShaderGLTest.cpp index 43d1d131e..8e5846b8a 100644 --- a/src/Test/ShaderGLTest.cpp +++ b/src/Test/ShaderGLTest.cpp @@ -33,11 +33,87 @@ class ShaderGLTest: public AbstractOpenGLTester { public: explicit ShaderGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; ShaderGLTest::ShaderGLTest() { - addTests({&ShaderGLTest::label}); + addTests({&ShaderGLTest::construct, + &ShaderGLTest::constructCopy, + &ShaderGLTest::constructMove, + + &ShaderGLTest::label}); +} + +void ShaderGLTest::construct() { + { + #ifndef MAGNUM_TARGET_GLES + const Shader shader(Version::GL300, Shader::Type::Fragment); + #else + const Shader shader(Version::GLES300, Shader::Type::Fragment); + #endif + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(shader.id() > 0); + CORRADE_COMPARE(shader.type(), Shader::Type::Fragment); + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(shader.sources(), std::vector{"#version 130\n"}); + #else + CORRADE_COMPARE(shader.sources(), std::vector{"#version 300\n"}); + #endif + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void ShaderGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void ShaderGLTest::constructMove() { + #ifndef MAGNUM_TARGET_GLES + Shader a(Version::GL300, Shader::Type::Fragment); + #else + Shader a(Version::GLES300, Shader::Type::Fragment); + #endif + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Shader b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + CORRADE_COMPARE(b.type(), Shader::Type::Fragment); + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(b.sources(), std::vector{"#version 130\n"}); + #else + CORRADE_COMPARE(b.sources(), std::vector{"#version 300\n"}); + #endif + + #ifndef MAGNUM_TARGET_GLES + Shader c(Version::GL210, Shader::Type::Vertex); + #else + Shader c(Version::GLES200, Shader::Type::Vertex); + #endif + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); + CORRADE_COMPARE(c.type(), Shader::Type::Fragment); + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(c.sources(), std::vector{"#version 130\n"}); + #else + CORRADE_COMPARE(c.sources(), std::vector{"#version 300\n"}); + #endif } void ShaderGLTest::label() { From 17ac78f22424c6f93d58326de577739f9dba2e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:01:44 +0100 Subject: [PATCH 37/64] Added missing Framebuffer::id(). --- src/Framebuffer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 6abf5f870..97ce8058f 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -304,6 +304,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje */ ~Framebuffer(); + /** @brief OpenGL framebuffer ID */ + GLuint id() const { return _id; } + /** * @brief %Framebuffer label * From 3fd165e9bbb700f8b047ba06d5c6c15eac2d084c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:04:01 +0100 Subject: [PATCH 38/64] Added move constructor/assignment to Framebuffer classes. Also updated the tests. --- src/AbstractFramebuffer.h | 5 ---- src/DefaultFramebuffer.h | 12 ++++++++ src/Framebuffer.cpp | 3 ++ src/Framebuffer.h | 25 ++++++++++++++++ src/Renderbuffer.cpp | 5 ++++ src/Renderbuffer.h | 28 ++++++++++++++---- src/Test/FramebufferGLTest.cpp | 51 ++++++++++++++++++++++++++++++++- src/Test/RenderbufferGLTest.cpp | 48 ++++++++++++++++++++++++++++++- 8 files changed, 164 insertions(+), 13 deletions(-) diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index a82058fe4..886da9d2b 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -145,11 +145,6 @@ from buffer overflow. class MAGNUM_EXPORT AbstractFramebuffer { friend class Context; - AbstractFramebuffer(const AbstractFramebuffer&) = delete; - AbstractFramebuffer(AbstractFramebuffer&&) = delete; - AbstractFramebuffer& operator=(const AbstractFramebuffer&) = delete; - AbstractFramebuffer& operator=(AbstractFramebuffer&&) = delete; - public: /** @todo `GL_IMPLEMENTATION_COLOR_READ_FORMAT`, `GL_IMPLEMENTATION_COLOR_READ_TYPE`, seems to be depending on currently bound FB (aargh) (@extension{ARB,ES2_compatibility}). */ diff --git a/src/DefaultFramebuffer.h b/src/DefaultFramebuffer.h index 245fc4998..1c902b408 100644 --- a/src/DefaultFramebuffer.h +++ b/src/DefaultFramebuffer.h @@ -291,6 +291,18 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { explicit MAGNUM_LOCAL DefaultFramebuffer(); + /** @brief Copying is not allowed */ + DefaultFramebuffer(const DefaultFramebuffer&) = delete; + + /** @brief Moving is not allowed */ + DefaultFramebuffer(DefaultFramebuffer&&) = delete; + + /** @brief Copying is not allowed */ + DefaultFramebuffer& operator=(const DefaultFramebuffer&) = delete; + + /** @brief Moving is not allowed */ + DefaultFramebuffer& operator=(DefaultFramebuffer&& other) = delete; + /** * @brief Check framebuffer status * @param target Target for which to check the status diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index 79942aad7..2c733127b 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -79,6 +79,9 @@ Framebuffer::Framebuffer(const Range2Di& viewport) { } Framebuffer::~Framebuffer() { + /* Moved out, nothing to do */ + if(!_id) return; + /* If bound, remove itself from state */ Implementation::FramebufferState* state = Context::current()->state().framebuffer; if(state->readBinding == _id) state->readBinding = 0; diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 97ce8058f..49a8c34ec 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -296,6 +296,12 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje */ explicit Framebuffer(const Range2Di& viewport); + /** @brief Copying is not allowed */ + Framebuffer(const Framebuffer&) = delete; + + /** @brief Move constructor */ + Framebuffer(Framebuffer&& other) noexcept; + /** * @brief Destructor * @@ -304,6 +310,12 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje */ ~Framebuffer(); + /** @brief Copying is not allowed */ + Framebuffer& operator=(const Framebuffer&) = delete; + + /** @brief Move assignment */ + Framebuffer& operator=(Framebuffer&& other) noexcept; + /** @brief OpenGL framebuffer ID */ GLuint id() const { return _id; } @@ -577,6 +589,19 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** @debugoperator{DefaultFramebuffer} */ Debug MAGNUM_EXPORT operator<<(Debug debug, Framebuffer::Status value); +inline Framebuffer::Framebuffer(Framebuffer&& other) noexcept { + _id = other._id; + _viewport = other._viewport; + other._id = 0; + other._viewport = {}; +} + +inline Framebuffer& Framebuffer::operator=(Framebuffer&& other) noexcept { + std::swap(_id, other._id); + std::swap(_viewport, other._viewport); + return *this; +} + } #endif diff --git a/src/Renderbuffer.cpp b/src/Renderbuffer.cpp index 10900c100..03fd45c74 100644 --- a/src/Renderbuffer.cpp +++ b/src/Renderbuffer.cpp @@ -71,7 +71,12 @@ Int Renderbuffer::maxSamples() { return value; } +Renderbuffer::Renderbuffer() { glGenRenderbuffers(1, &_id); } + Renderbuffer::~Renderbuffer() { + /* Moved out, nothing to do */ + if(!_id) return; + /* If bound, remove itself from state */ GLuint& binding = Context::current()->state().framebuffer->renderbufferBinding; if(binding == _id) binding = 0; diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index a97ed7c91..c616c2dc6 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -56,11 +56,6 @@ See its documentation for more information. class MAGNUM_EXPORT Renderbuffer: public AbstractObject { friend class Context; - Renderbuffer(const Renderbuffer&) = delete; - Renderbuffer(Renderbuffer&&) = delete; - Renderbuffer& operator=(const Renderbuffer&) = delete; - Renderbuffer& operator=(Renderbuffer&&) = delete; - public: /** * @brief Max supported renderbuffer size @@ -89,7 +84,13 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { * Generates new OpenGL renderbuffer. * @see @fn_gl{GenRenderbuffers} */ - explicit Renderbuffer() { glGenRenderbuffers(1, &_id); } + explicit Renderbuffer(); + + /** @brief Copying is not allowed */ + Renderbuffer(const Renderbuffer&) = delete; + + /** @brief Move constructor */ + Renderbuffer(Renderbuffer&& other) noexcept; /** * @brief Destructor @@ -99,6 +100,12 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { */ ~Renderbuffer(); + /** @brief Copying is not allowed */ + Renderbuffer& operator=(const Renderbuffer&) = delete; + + /** @brief Move assignment */ + Renderbuffer& operator=(Renderbuffer&& other) noexcept; + /** @brief OpenGL internal renderbuffer ID */ GLuint id() const { return _id; } @@ -189,6 +196,15 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { GLuint _id; }; +inline Renderbuffer::Renderbuffer(Renderbuffer&& other) noexcept: _id(other._id) { + other._id = 0; +} + +inline Renderbuffer& Renderbuffer::operator=(Renderbuffer&& other) noexcept { + std::swap(_id, other._id); + return *this; +} + } #endif diff --git a/src/Test/FramebufferGLTest.cpp b/src/Test/FramebufferGLTest.cpp index 3b3dd7b9e..298d1d684 100644 --- a/src/Test/FramebufferGLTest.cpp +++ b/src/Test/FramebufferGLTest.cpp @@ -33,11 +33,60 @@ class FramebufferGLTest: public AbstractOpenGLTester { public: explicit FramebufferGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; FramebufferGLTest::FramebufferGLTest() { - addTests({&FramebufferGLTest::label}); + addTests({&FramebufferGLTest::construct, + &FramebufferGLTest::constructCopy, + &FramebufferGLTest::constructMove, + + &FramebufferGLTest::label}); +} + +void FramebufferGLTest::construct() { + { + const Framebuffer framebuffer({{32, 16}, {128, 256}}); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(framebuffer.id() > 0); + CORRADE_COMPARE(framebuffer.viewport(), Range2Di({32, 16}, {128, 256})); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void FramebufferGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void FramebufferGLTest::constructMove() { + Framebuffer a({{32, 16}, {128, 256}}); + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Framebuffer b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + CORRADE_COMPARE(b.viewport(), Range2Di({32, 16}, {128, 256})); + + Framebuffer c({{128, 256}, {32, 16}}); + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); + CORRADE_COMPARE(c.viewport(), Range2Di({32, 16}, {128, 256})); } void FramebufferGLTest::label() { diff --git a/src/Test/RenderbufferGLTest.cpp b/src/Test/RenderbufferGLTest.cpp index f6cd2862c..4f44ac41f 100644 --- a/src/Test/RenderbufferGLTest.cpp +++ b/src/Test/RenderbufferGLTest.cpp @@ -33,11 +33,57 @@ class RenderbufferGLTest: public AbstractOpenGLTester { public: explicit RenderbufferGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; RenderbufferGLTest::RenderbufferGLTest() { - addTests({&RenderbufferGLTest::label}); + addTests({&RenderbufferGLTest::construct, + &RenderbufferGLTest::constructCopy, + &RenderbufferGLTest::constructMove, + + &RenderbufferGLTest::label}); +} + +void RenderbufferGLTest::construct() { + { + const Renderbuffer renderbuffer; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(renderbuffer.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void RenderbufferGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void RenderbufferGLTest::constructMove() { + Renderbuffer a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Renderbuffer b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + Renderbuffer c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); } void RenderbufferGLTest::label() { From 9a9b5a90e1ea46fdd6b63c3c463b8fe29d68b999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:05:47 +0100 Subject: [PATCH 39/64] Added move constructor/assignment to Query classes. Also updated the test. --- src/Query.cpp | 3 ++ src/Query.h | 23 ++++++++++++ src/Test/AbstractQueryGLTest.cpp | 63 +++++++++++++++++++++++++++++++- 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/Query.cpp b/src/Query.cpp index acebc666b..c98178168 100644 --- a/src/Query.cpp +++ b/src/Query.cpp @@ -43,6 +43,9 @@ AbstractQuery::AbstractQuery(): target() { } AbstractQuery::~AbstractQuery() { + /* Moved out, nothing to do */ + if(!_id) return; + /** @todo Get some extension wrangler instead to avoid undeclared glGenQueries() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 glDeleteQueries(1, &_id); diff --git a/src/Query.h b/src/Query.h index 8ac079f13..e268f17df 100644 --- a/src/Query.h +++ b/src/Query.h @@ -45,6 +45,18 @@ information. */ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { public: + /** @brief Copying is not allowed */ + AbstractQuery(const AbstractQuery&) = delete; + + /** @brief Move constructor */ + AbstractQuery(AbstractQuery&& other) noexcept; + + /** @brief Copying is not allowed */ + AbstractQuery& operator=(const AbstractQuery&) = delete; + + /** @brief Move assignment */ + AbstractQuery& operator=(AbstractQuery&& other) noexcept; + /** @brief OpenGL query ID */ GLuint id() const { return _id; } @@ -420,6 +432,17 @@ class TimeQuery: public AbstractQuery { #endif }; + +inline AbstractQuery::AbstractQuery(AbstractQuery&& other) noexcept: _id(other._id), target(other.target) { + other._id = 0; +} + +inline AbstractQuery& AbstractQuery::operator=(AbstractQuery&& other) noexcept { + std::swap(_id, other._id); + std::swap(target, other.target); + return *this; +} + } #endif diff --git a/src/Test/AbstractQueryGLTest.cpp b/src/Test/AbstractQueryGLTest.cpp index b7ecd37bf..5060f9df9 100644 --- a/src/Test/AbstractQueryGLTest.cpp +++ b/src/Test/AbstractQueryGLTest.cpp @@ -33,14 +33,75 @@ class AbstractQueryGLTest: public AbstractOpenGLTester { public: explicit AbstractQueryGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; AbstractQueryGLTest::AbstractQueryGLTest() { - addTests({&AbstractQueryGLTest::label}); + addTests({&AbstractQueryGLTest::construct, + &AbstractQueryGLTest::constructCopy, + &AbstractQueryGLTest::constructMove, + + &AbstractQueryGLTest::label}); +} + +void AbstractQueryGLTest::construct() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported.")); + #endif + + { + const SampleQuery query; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(query.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void AbstractQueryGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void AbstractQueryGLTest::constructMove() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported.")); + #endif + + SampleQuery a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + SampleQuery b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + SampleQuery c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); } void AbstractQueryGLTest::label() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported.")); + #endif + /* No-Op version is tested in AbstractObjectGLTest */ if(!Context::current()->isExtensionSupported() && !Context::current()->isExtensionSupported()) From 34c6565e711fe4df477cd63bc1eb221d350ef0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:06:31 +0100 Subject: [PATCH 40/64] Testing Mesh move constructor and assignment. --- src/Mesh.cpp | 5 ++++- src/Test/MeshGLTest.cpp | 48 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 7224c78df..aa8c7eec0 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -93,6 +93,9 @@ Mesh::Mesh(MeshPrimitive primitive): _primitive(primitive), _vertexCount(0), _in } Mesh::~Mesh() { + /* Moved out, nothing to do */ + if(!_id) return; + /* Remove current vao from the state */ GLuint& current = Context::current()->state().mesh->currentVAO; if(current == _id) current = 0; @@ -278,7 +281,7 @@ void Mesh::destroyImplementationDefault() {} void Mesh::destroyImplementationVAO() { /** @todo Get some extension wrangler instead to avoid linker errors to glDeleteVertexArrays() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 - if(_id) glDeleteVertexArrays(1, &_id); + glDeleteVertexArrays(1, &_id); #endif } diff --git a/src/Test/MeshGLTest.cpp b/src/Test/MeshGLTest.cpp index 6efd4dc20..62215d181 100644 --- a/src/Test/MeshGLTest.cpp +++ b/src/Test/MeshGLTest.cpp @@ -33,11 +33,57 @@ class MeshGLTest: public AbstractOpenGLTester { public: explicit MeshGLTest(); + void construct(); + void constructCopy(); + void constructMove(); + void label(); }; MeshGLTest::MeshGLTest() { - addTests({&MeshGLTest::label}); + addTests({&MeshGLTest::construct, + &MeshGLTest::constructCopy, + &MeshGLTest::constructMove, + + &MeshGLTest::label}); +} + +void MeshGLTest::construct() { + { + const Mesh mesh; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(mesh.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void MeshGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void MeshGLTest::constructMove() { + Mesh a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Mesh b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); + + Mesh c; + const Int cId = c.id(); + c = std::move(b); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); } void MeshGLTest::label() { From f7a512fae412ba6ecf69cbf5802d0c0cca14ee88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:07:07 +0100 Subject: [PATCH 41/64] Testing Buffer move construction and assignment. --- src/Test/BufferGLTest.cpp | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/Test/BufferGLTest.cpp b/src/Test/BufferGLTest.cpp index f510948c8..a1e5b2502 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Test/BufferGLTest.cpp @@ -38,6 +38,9 @@ class BufferGLTest: public AbstractOpenGLTester { explicit BufferGLTest(); void construct(); + void constructCopy(); + void constructMove(); + void label(); void data(); void map(); @@ -74,13 +77,43 @@ BufferGLTest::BufferGLTest() { } void BufferGLTest::construct() { - Buffer buffer; + { + Buffer buffer; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(buffer.id() > 0); + CORRADE_COMPARE(buffer.targetHint(), Buffer::Target::Array); + CORRADE_COMPARE(buffer.size(), 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void BufferGLTest::constructCopy() { + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + +void BufferGLTest::constructMove() { + Buffer a; + const Int id = a.id(); + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(id > 0); + + Buffer b(std::move(a)); + + CORRADE_COMPARE(a.id(), 0); + CORRADE_COMPARE(b.id(), id); - CORRADE_COMPARE(buffer.targetHint(), Buffer::Target::Array); + Buffer c; + const Int cId = c.id(); + c = std::move(b); - CORRADE_COMPARE(buffer.size(), 0); MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(cId > 0); + CORRADE_COMPARE(b.id(), cId); + CORRADE_COMPARE(c.id(), id); } void BufferGLTest::label() { From fa4f090f9034cbf1e5f0b0dbeca70f240c7e88bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:07:36 +0100 Subject: [PATCH 42/64] Enabled synchronous debug output for AbstractOpenGLTester. --- src/Test/AbstractOpenGLTester.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Test/AbstractOpenGLTester.h b/src/Test/AbstractOpenGLTester.h index 9c2c204cb..ef1c7c0be 100644 --- a/src/Test/AbstractOpenGLTester.h +++ b/src/Test/AbstractOpenGLTester.h @@ -27,6 +27,9 @@ #include #include +#include "Context.h" +#include "Extensions.h" +#include "DebugMessage.h" #include "Renderer.h" #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_DESKTOP_GLES) @@ -39,7 +42,7 @@ namespace Magnum { namespace Test { class AbstractOpenGLTester: public TestSuite::Tester, public Platform::WindowlessApplication { public: - explicit AbstractOpenGLTester(): Platform::WindowlessApplication({zero, nullptr}) {} + explicit AbstractOpenGLTester(); using TestSuite::Tester::exec; int exec() override final { return TestSuite::Tester::exec(); } @@ -48,6 +51,14 @@ class AbstractOpenGLTester: public TestSuite::Tester, public Platform::Windowles static int zero; }; +AbstractOpenGLTester::AbstractOpenGLTester(): Platform::WindowlessApplication({zero, nullptr}) { + if(Context::current()->isExtensionSupported()) { + Renderer::setFeature(Renderer::Feature::DebugOutput, true); + Renderer::setFeature(Renderer::Feature::DebugOutputSynchronous, true); + DebugMessage::setDefaultCallback(); + } +} + int AbstractOpenGLTester::zero = 0; #define MAGNUM_VERIFY_NO_ERROR() CORRADE_COMPARE(Magnum::Renderer::error(), Magnum::Renderer::Error::NoError) From 3bdf405f7fd5cf6a071026dbe437abe4b0b99911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:08:26 +0100 Subject: [PATCH 43/64] Fixed GL debug output performance warnings in Buffer test. --- src/Test/BufferGLTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Test/BufferGLTest.cpp b/src/Test/BufferGLTest.cpp index a1e5b2502..3e050266d 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Test/BufferGLTest.cpp @@ -325,10 +325,10 @@ void BufferGLTest::mapRangeExplicitFlush() { void BufferGLTest::copy() { Buffer buffer1; constexpr char data[] = {2, 7, 5, 13, 25}; - buffer1.setData(data, BufferUsage::StaticDraw); + buffer1.setData(data, BufferUsage::StaticCopy); Buffer buffer2; - buffer2.setData({nullptr, 5}, BufferUsage::StaticDraw); + buffer2.setData({nullptr, 5}, BufferUsage::StaticRead); Buffer::copy(buffer1, buffer2, 1, 2, 3); MAGNUM_VERIFY_NO_ERROR(); From 7dd4cf1ea330f2a241805ae5e94a85669825ed73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 19:09:18 +0100 Subject: [PATCH 44/64] Fixed CubeMapTextureArray::image(). This was copypasted from CubeMapTexture and apparently wasn't tested once. The Coordinate enum is now not needed at all. --- src/CubeMapTextureArray.h | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index f4d54877a..b89cf6b02 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -79,16 +79,6 @@ the six sides of the cube map, fourth part is layer in the array. See also */ class CubeMapTextureArray: public AbstractTexture { public: - /** @brief Cube map coordinate */ - enum class Coordinate: GLsizei { - PositiveX = 0, /**< +X cube side */ - NegativeX = 1, /**< -X cube side */ - PositiveY = 2, /**< +Y cube side */ - NegativeY = 3, /**< -Y cube side */ - PositiveZ = 4, /**< +Z cube side */ - NegativeZ = 5 /**< -Z cube side */ - }; - /** * @brief Constructor * @@ -109,13 +99,12 @@ class CubeMapTextureArray: public AbstractTexture { /** * @brief %Image size in given mip level - * @param coordinate Coordinate * @param level Mip level * * See @ref Texture::imageSize() for more information. */ - Vector3i imageSize(Coordinate coordinate, Int level) { - return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_POSITIVE_X + GLenum(coordinate), level); + Vector3i imageSize(Int level) { + return DataHelper<3>::imageSize(this, GL_TEXTURE_CUBE_MAP_ARRAY, level); } /** @@ -132,20 +121,18 @@ class CubeMapTextureArray: public AbstractTexture { #ifndef MAGNUM_TARGET_GLES /** * @brief Read given mip level of texture to image - * @param coordinate Coordinate * @param level Mip level * @param image %Image where to put the data * * See @ref Texture::image(Int, Image&) for more information. * @requires_gl %Texture image queries are not available in OpenGL ES. */ - void image(Coordinate coordinate, Int level, Image3D& image) { - AbstractTexture::image<3>(GL_TEXTURE_CUBE_MAP_POSITIVE_X + GLenum(coordinate), level, image); + void image(Int level, Image3D& image) { + AbstractTexture::image<3>(GL_TEXTURE_CUBE_MAP_ARRAY, level, image); } /** * @brief Read given mip level of texture to buffer image - * @param coordinate Coordinate * @param level Mip level * @param image %Buffer image where to put the data * @param usage %Buffer usage @@ -154,8 +141,8 @@ class CubeMapTextureArray: public AbstractTexture { * information. * @requires_gl %Texture image queries are not available in OpenGL ES. */ - void image(Coordinate coordinate, Int level, BufferImage3D& image, BufferUsage usage) { - AbstractTexture::image<3>(GL_TEXTURE_CUBE_MAP_POSITIVE_X + GLenum(coordinate), level, image, usage); + void image(Int level, BufferImage3D& image, BufferUsage usage) { + AbstractTexture::image<3>(GL_TEXTURE_CUBE_MAP_ARRAY, level, image, usage); } #endif From 4a5308ef39ed1444a8fc943ffff823b6a260f932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 21:54:34 +0100 Subject: [PATCH 45/64] Make BufferTexture::id() public. --- src/BufferTexture.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BufferTexture.h b/src/BufferTexture.h index f53c01e29..2981efa50 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -207,6 +207,9 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} + /** @copydoc AbstractTexture::id() */ + Int id() const { return AbstractTexture::id(); } + /** @copydoc AbstractTexture::label() */ std::string label() const { return AbstractTexture::label(); } From 13692f489575cb7ad9b74c1ee3f5a69f368f0fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 21:55:03 +0100 Subject: [PATCH 46/64] Added BufferTexture::offsetAlignment() limit query. --- src/BufferTexture.cpp | 16 ++++++++++++++++ src/BufferTexture.h | 10 ++++++++++ src/Implementation/TextureState.cpp | 2 +- src/Implementation/TextureState.h | 3 ++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/BufferTexture.cpp b/src/BufferTexture.cpp index 7ff447fa4..28688b929 100644 --- a/src/BufferTexture.cpp +++ b/src/BufferTexture.cpp @@ -29,11 +29,27 @@ #include "Context.h" #include "Extensions.h" +#include "Implementation/State.h" +#include "Implementation/TextureState.h" + namespace Magnum { BufferTexture::SetBufferImplementation BufferTexture::setBufferImplementation = &BufferTexture::setBufferImplementationDefault; BufferTexture::SetBufferRangeImplementation BufferTexture::setBufferRangeImplementation = &BufferTexture::setBufferRangeImplementationDefault; +Int BufferTexture::offsetAlignment() { + if(!Context::current()->isExtensionSupported()) + return 0; + + GLint& value = Context::current()->state().texture->bufferOffsetAlignment; + + /* Get the value, if not already cached */ + if(value == 0) + glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, &value); + + return value; +} + void BufferTexture::initializeContextBasedFunctionality(Context& context) { if(context.isExtensionSupported()) { Debug() << "BufferTexture: using" << Extensions::GL::EXT::direct_state_access::string() << "features"; diff --git a/src/BufferTexture.h b/src/BufferTexture.h index 2981efa50..a322d649b 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -205,6 +205,16 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { /** @copydoc AbstractTexture::maxLabelLength() */ static Int maxLabelLength() { return AbstractTexture::maxLabelLength(); } + /** + * @brief Minimum required alignment for texture buffer offsets + * + * The result is cached, repeated queries don't result in repeated + * OpenGL calls. If extension @extension{ARB,texture_buffer_range} + * (part of OpenGL 4.3) is not available, returns `0`. + * @see @fn_gl{Get} with @def_gl{TEXTURE_BUFFER_OFFSET_ALIGNMENT} + */ + static Int offsetAlignment(); + explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} /** @copydoc AbstractTexture::id() */ diff --git a/src/Implementation/TextureState.cpp b/src/Implementation/TextureState.cpp index 7c08ebceb..68e36264f 100644 --- a/src/Implementation/TextureState.cpp +++ b/src/Implementation/TextureState.cpp @@ -28,7 +28,7 @@ namespace Magnum { namespace Implementation { TextureState::TextureState(): maxAnisotropy(0.0f), currentLayer(0) #ifndef MAGNUM_TARGET_GLES - , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0) + , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0), bufferOffsetAlignment(0) #endif {} diff --git a/src/Implementation/TextureState.h b/src/Implementation/TextureState.h index 91875bc9e..54508124b 100644 --- a/src/Implementation/TextureState.h +++ b/src/Implementation/TextureState.h @@ -39,7 +39,8 @@ struct TextureState { #ifndef MAGNUM_TARGET_GLES GLint maxColorSamples, maxDepthSamples, - maxIntegerSamples; + maxIntegerSamples, + bufferOffsetAlignment; #endif std::vector bindings; From fcfcc84e190726e18bb2330b54c1b9ed20261e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Dec 2013 21:55:30 +0100 Subject: [PATCH 47/64] Platform: show BufferTexture::offsetAlignment() in magnum-info. --- src/Platform/magnum-info.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Platform/magnum-info.cpp b/src/Platform/magnum-info.cpp index 7a674b4f5..854c5f107 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Platform/magnum-info.cpp @@ -31,6 +31,7 @@ #include "AbstractShaderProgram.h" #include "Buffer.h" +#include "BufferTexture.h" #include "Context.h" #include "DebugMessage.h" #include "Extensions.h" @@ -314,6 +315,12 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat _l(Shader::maxTessellationEvaluationInputComponents()) _l(Shader::maxTessellationEvaluationOutputComponents()) } + + if(c->isExtensionSupported()) { + _h(ARB::texture_buffer_range) + + _l(BufferTexture::offsetAlignment()) + } #endif #ifndef MAGNUM_TARGET_GLES2 From a8d35fb60f29e7fa47314a32222a24e1e3f302be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 00:42:11 +0100 Subject: [PATCH 48/64] Testing all *Texture functionality. --- src/Test/BufferTextureGLTest.cpp | 98 ++ src/Test/CMakeLists.txt | 7 + src/Test/CubeMapTextureArrayGLTest.cpp | 371 +++++ src/Test/CubeMapTextureGLTest.cpp | 309 ++++ src/Test/TextureGLTest.cpp | 1908 ++++++++++++++++++++++++ 5 files changed, 2693 insertions(+) create mode 100644 src/Test/BufferTextureGLTest.cpp create mode 100644 src/Test/CubeMapTextureArrayGLTest.cpp create mode 100644 src/Test/CubeMapTextureGLTest.cpp create mode 100644 src/Test/TextureGLTest.cpp diff --git a/src/Test/BufferTextureGLTest.cpp b/src/Test/BufferTextureGLTest.cpp new file mode 100644 index 000000000..e7029f69f --- /dev/null +++ b/src/Test/BufferTextureGLTest.cpp @@ -0,0 +1,98 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "Buffer.h" +#include "BufferTexture.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class BufferTextureGLTest: public AbstractOpenGLTester { + public: + explicit BufferTextureGLTest(); + + void construct(); + void setBuffer(); + void setBufferOffset(); +}; + +BufferTextureGLTest::BufferTextureGLTest() { + addTests({&BufferTextureGLTest::construct, + &BufferTextureGLTest::setBuffer, + &BufferTextureGLTest::setBufferOffset}); +} + +void BufferTextureGLTest::construct() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported.")); + + { + BufferTexture texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void BufferTextureGLTest::setBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported.")); + + BufferTexture texture; + Buffer buffer; + constexpr UnsignedByte data[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f + }; + buffer.setData(data, BufferUsage::StaticDraw); + texture.setBuffer(BufferTextureFormat::R8UI, buffer); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void BufferTextureGLTest::setBufferOffset() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported.")); + + BufferTexture texture; + Buffer buffer; + constexpr UnsignedByte data[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f + }; + buffer.setData(data, BufferUsage::StaticDraw); + texture.setBuffer(BufferTextureFormat::R8UI, buffer, 16, 8); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::BufferTextureGLTest) diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index 4e0d05c5c..43c63b64b 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -44,15 +44,22 @@ if(BUILD_GL_TESTS) corrade_add_test(AbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(BufferGLTest BufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ContextGLTest ContextGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(CubeMapTextureGLTest CubeMapTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(DebugGLTest DebugGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(FramebufferGLTest FramebufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(MeshGLTest MeshGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(RenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(TextureGLTest TextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) if(NOT MAGNUM_TARGET_GLES2) corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) endif() + + if(NOT MAGNUM_TARGET_GLES) + corrade_add_test(BufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(CubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + endif() endif() set_target_properties(ResourceManagerTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) diff --git a/src/Test/CubeMapTextureArrayGLTest.cpp b/src/Test/CubeMapTextureArrayGLTest.cpp new file mode 100644 index 000000000..5c7206dfb --- /dev/null +++ b/src/Test/CubeMapTextureArrayGLTest.cpp @@ -0,0 +1,371 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "BufferImage.h" +#include "ColorFormat.h" +#include "Image.h" +#include "CubeMapTextureArray.h" +#include "TextureFormat.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class CubeMapTextureArrayGLTest: public AbstractOpenGLTester { + public: + explicit CubeMapTextureArrayGLTest(); + + void construct(); + void sampling(); + void storage(); + void image(); + void imageBuffer(); + void subImage(); + void subImageBuffer(); + void generateMipmap(); + void invalidateImage(); + void invalidateSubImage(); +}; + +CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { + addTests({&CubeMapTextureArrayGLTest::construct, + &CubeMapTextureArrayGLTest::sampling, + &CubeMapTextureArrayGLTest::storage, + &CubeMapTextureArrayGLTest::image, + &CubeMapTextureArrayGLTest::imageBuffer, + &CubeMapTextureArrayGLTest::subImage, + &CubeMapTextureArrayGLTest::subImageBuffer, + &CubeMapTextureArrayGLTest::generateMipmap, + &CubeMapTextureArrayGLTest::invalidateImage, + &CubeMapTextureArrayGLTest::invalidateSubImage}); +} + +void CubeMapTextureArrayGLTest::construct() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + { + CubeMapTextureArray texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureArrayGLTest::sampling() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + CubeMapTextureArray texture; + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureArrayGLTest::storage() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + CubeMapTextureArray texture; + texture.setStorage(5, TextureFormat::RGBA8, {32, 32, 24}); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 24)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 24)); + CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 24)); + CORRADE_COMPARE(texture.imageSize(3), Vector3i( 4, 4, 24)); + CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2, 2, 24)); + CORRADE_COMPARE(texture.imageSize(5), Vector3i(0)); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureArrayGLTest::image() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte data[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x16, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x1e, 0x4f, + + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f + }; + CubeMapTextureArray texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 6}, data)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 96), TestSuite::Compare::Container); +} + +void CubeMapTextureArrayGLTest::imageBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte data[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x16, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x1e, 0x4f, + + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f + }; + CubeMapTextureArray texture; + texture.setImage(0, TextureFormat::RGBA8, + BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 6}, data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 96), TestSuite::Compare::Container); +} + +void CubeMapTextureArrayGLTest::subImage() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte zero[4*4*4*6] = {}; + constexpr UnsignedByte subData[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f + }; + CubeMapTextureArray texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 6}, zero)); + texture.setSubImage(0, Vector3i(1), + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 4}, subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, + 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0, 0, 0, 0, + 0, 0, 0, 0, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0, 0, 0, 0, + 0, 0, 0, 0, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} + +void CubeMapTextureArrayGLTest::subImageBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte zero[4*4*4*6] = {}; + constexpr UnsignedByte subData[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f + }; + CubeMapTextureArray texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, {4, 4, 6}, zero)); + texture.setSubImage(0, Vector3i(1), + BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, {2, 2, 4}, subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, + 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0, 0, 0, 0, + 0, 0, 0, 0, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0, 0, 0, 0, + 0, 0, 0, 0, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} + +void CubeMapTextureArrayGLTest::generateMipmap() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + CubeMapTextureArray texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, {32, 32, 24})); + + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 24)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(0)); + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 24)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 24)); + CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 24)); + CORRADE_COMPARE(texture.imageSize(3), Vector3i( 4, 4, 24)); + CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2, 2, 24)); + CORRADE_COMPARE(texture.imageSize(5), Vector3i( 1, 1, 24)); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureArrayGLTest::invalidateImage() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + CubeMapTextureArray texture; + texture.setStorage(2, TextureFormat::RGBA8, {32, 32, 24}); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureArrayGLTest::invalidateSubImage() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + + CubeMapTextureArray texture; + texture.setStorage(2, TextureFormat::RGBA8, {32, 32, 24}); + texture.invalidateSubImage(1, Vector3i(2), Vector3i(8)); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureArrayGLTest) diff --git a/src/Test/CubeMapTextureGLTest.cpp b/src/Test/CubeMapTextureGLTest.cpp new file mode 100644 index 000000000..ac3268758 --- /dev/null +++ b/src/Test/CubeMapTextureGLTest.cpp @@ -0,0 +1,309 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "BufferImage.h" +#include "ColorFormat.h" +#include "Image.h" +#include "CubeMapTexture.h" +#include "TextureFormat.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class CubeMapTextureGLTest: public AbstractOpenGLTester { + public: + explicit CubeMapTextureGLTest(); + + void construct(); + void sampling(); + void storage(); + void image(); + #ifndef MAGNUM_TARGET_GLES2 + void imageBuffer(); + #endif + void subImage(); + #ifndef MAGNUM_TARGET_GLES2 + void subImageBuffer(); + #endif + void generateMipmap(); + void invalidateImage(); + void invalidateSubImage(); +}; + +CubeMapTextureGLTest::CubeMapTextureGLTest() { + addTests({&CubeMapTextureGLTest::construct, + &CubeMapTextureGLTest::sampling, + &CubeMapTextureGLTest::storage, + &CubeMapTextureGLTest::image, + #ifndef MAGNUM_TARGET_GLES2 + &CubeMapTextureGLTest::imageBuffer, + #endif + &CubeMapTextureGLTest::subImage, + #ifndef MAGNUM_TARGET_GLES2 + &CubeMapTextureGLTest::subImageBuffer, + #endif + &CubeMapTextureGLTest::generateMipmap, + &CubeMapTextureGLTest::invalidateImage, + &CubeMapTextureGLTest::invalidateSubImage}); +} + +void CubeMapTextureGLTest::construct() { + { + CubeMapTexture texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureGLTest::sampling() { + CubeMapTexture texture; + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureGLTest::storage() { + CubeMapTexture texture; + texture.setStorage(5, TextureFormat::RGBA8, Vector2i(32)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeY, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveZ, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeZ, 0), Vector2i(32)); + + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeY, 1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveZ, 1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeZ, 1), Vector2i(16)); + + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 2), Vector2i(8)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 2), Vector2i(8)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 2), Vector2i(8)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeY, 2), Vector2i(8)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveZ, 2), Vector2i(8)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeZ, 2), Vector2i(8)); + + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 3), Vector2i(4)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 3), Vector2i(4)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 3), Vector2i(4)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeY, 3), Vector2i(4)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveZ, 3), Vector2i(4)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeZ, 3), Vector2i(4)); + + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 4), Vector2i(2)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 4), Vector2i(2)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 4), Vector2i(2)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeY, 4), Vector2i(2)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveZ, 4), Vector2i(2)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeZ, 4), Vector2i(2)); + + /* Not available */ + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 5), Vector2i(0)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeX, 5), Vector2i(0)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveY, 5), Vector2i(0)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeY, 5), Vector2i(0)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveZ, 5), Vector2i(0)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::NegativeZ, 5), Vector2i(0)); + + MAGNUM_VERIFY_NO_ERROR(); + #endif +} + +void CubeMapTextureGLTest::image() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(CubeMapTexture::Coordinate::PositiveX, 0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data+16), TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void CubeMapTextureGLTest::imageBuffer() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(CubeMapTexture::Coordinate::PositiveX, 0, image, BufferUsage::StaticRead); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + const auto imageData = image.buffer().data(); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data+16), TestSuite::Compare::Container); + #endif +} +#endif + +void CubeMapTextureGLTest::subImage() { + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i(1), + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(CubeMapTexture::Coordinate::PositiveX, 0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void CubeMapTextureGLTest::subImageBuffer() { + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i(1), + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(CubeMapTexture::Coordinate::PositiveX, 0, image, BufferUsage::StaticRead); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + const auto imageData = image.buffer().data(); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +void CubeMapTextureGLTest::generateMipmap() { + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 1), Vector2i( 0)); + #endif + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 2), Vector2i( 8)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 3), Vector2i( 4)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 4), Vector2i( 2)); + CORRADE_COMPARE(texture.imageSize(CubeMapTexture::Coordinate::PositiveX, 5), Vector2i( 1)); + + MAGNUM_VERIFY_NO_ERROR(); + #endif +} + +void CubeMapTextureGLTest::invalidateImage() { + CubeMapTexture texture; + texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void CubeMapTextureGLTest::invalidateSubImage() { + CubeMapTexture texture; + texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateSubImage(1, Vector3i(2), Vector3i(8)); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureGLTest) diff --git a/src/Test/TextureGLTest.cpp b/src/Test/TextureGLTest.cpp new file mode 100644 index 000000000..58e192ce9 --- /dev/null +++ b/src/Test/TextureGLTest.cpp @@ -0,0 +1,1908 @@ +/* + This file is part of Magnum. + + Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include "BufferImage.h" +#include "ColorFormat.h" +#include "Image.h" +#include "Texture.h" +#include "TextureFormat.h" +#include "Test/AbstractOpenGLTester.h" + +namespace Magnum { namespace Test { + +class TextureGLTest: public AbstractOpenGLTester { + public: + explicit TextureGLTest(); + + #ifndef MAGNUM_TARGET_GLES + void construct1D(); + #endif + void construct2D(); + void construct3D(); + #ifndef MAGNUM_TARGET_GLES + void construct1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void construct2DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES + void construct2DMultisample(); + void construct2DMultisampleArray(); + void constructRectangle(); + #endif + + #ifndef MAGNUM_TARGET_GLES + void sampling1D(); + #endif + void sampling2D(); + void sampling3D(); + #ifndef MAGNUM_TARGET_GLES + void sampling1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void sampling2DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES + void samplingRectangle(); + #endif + + #ifdef MAGNUM_TARGET_GLES + void samplingBorder2D(); + void samplingBorder3D(); + #ifndef MAGNUM_TARGET_GLES2 + void samplingBorder2DArray(); + #endif + #endif + + #ifndef MAGNUM_TARGET_GLES + void storage1D(); + #endif + void storage2D(); + void storage3D(); + #ifndef MAGNUM_TARGET_GLES + void storage1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void storage2DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES + void storage2DMultisample(); + void storage2DMultisampleArray(); + void storageRectangle(); + #endif + + #ifndef MAGNUM_TARGET_GLES + void image1D(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void image1DBuffer(); + #endif + void image2D(); + #ifndef MAGNUM_TARGET_GLES2 + void image2DBuffer(); + #endif + void image3D(); + #ifndef MAGNUM_TARGET_GLES2 + void image3DBuffer(); + #endif + #ifndef MAGNUM_TARGET_GLES + void image1DArray(); + void image1DArrayBuffer(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void image2DArray(); + void image2DArrayBuffer(); + #endif + #ifndef MAGNUM_TARGET_GLES + void image2DMultisample(); + void image2DMultisampleBuffer(); + void image2DMultisampleArray(); + void image2DMultisampleArrayBuffer(); + void imageRectangle(); + void imageRectangleBuffer(); + #endif + + #ifndef MAGNUM_TARGET_GLES + void subImage1D(); + void subImage1DBuffer(); + #endif + void subImage2D(); + #ifndef MAGNUM_TARGET_GLES2 + void subImage2DBuffer(); + #endif + void subImage3D(); + #ifndef MAGNUM_TARGET_GLES2 + void subImage3DBuffer(); + #endif + #ifndef MAGNUM_TARGET_GLES + void subImage1DArray(); + void subImage1DArrayBuffer(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void subImage2DArray(); + void subImage2DArrayBuffer(); + #endif + #ifndef MAGNUM_TARGET_GLES + void subImage2DMultisample(); + void subImage2DMultisampleBuffer(); + void subImage2DMultisampleArray(); + void subImage2DMultisampleArrayBuffer(); + void subImageRectangle(); + void subImageRectangleBuffer(); + #endif + + #ifndef MAGNUM_TARGET_GLES + void generateMipmap1D(); + #endif + void generateMipmap2D(); + void generateMipmap3D(); + #ifndef MAGNUM_TARGET_GLES + void generateMipmap1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void generateMipmap2DArray(); + #endif + + #ifndef MAGNUM_TARGET_GLES + void invalidateImage1D(); + #endif + void invalidateImage2D(); + void invalidateImage3D(); + #ifndef MAGNUM_TARGET_GLES + void invalidateImage1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void invalidateImage2DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES + void invalidateImage2DMultisample(); + void invalidateImage2DMultisampleArray(); + void invalidateImageRectangle(); + #endif + + #ifndef MAGNUM_TARGET_GLES + void invalidateSubImage1D(); + #endif + void invalidateSubImage2D(); + void invalidateSubImage3D(); + #ifndef MAGNUM_TARGET_GLES + void invalidateSubImage1DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES2 + void invalidateSubImage2DArray(); + #endif + #ifndef MAGNUM_TARGET_GLES + void invalidateSubImage2DMultisample(); + void invalidateSubImage2DMultisampleArray(); + void invalidateSubImageRectangle(); + #endif +}; + +TextureGLTest::TextureGLTest() { + addTests({ + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::construct1D, + #endif + &TextureGLTest::construct2D, + &TextureGLTest::construct3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::construct1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::construct2DArray, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::construct2DMultisample, + &TextureGLTest::construct2DMultisampleArray, + &TextureGLTest::constructRectangle, + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::sampling1D, + #endif + &TextureGLTest::sampling2D, + &TextureGLTest::sampling3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::sampling1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::sampling2DArray, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::samplingRectangle, + #endif + + #ifdef MAGNUM_TARGET_GLES + &TextureGLTest::samplingBorder2D, + &TextureGLTest::samplingBorder3D, + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::samplingBorder2DArray, + #endif + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::storage1D, + #endif + &TextureGLTest::storage2D, + &TextureGLTest::storage3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::storage1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::storage2DArray, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::storage2DMultisample, + &TextureGLTest::storage2DMultisampleArray, + &TextureGLTest::storageRectangle, + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::image1D, + &TextureGLTest::image1DBuffer, + #endif + &TextureGLTest::image2D, + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::image2DBuffer, + #endif + &TextureGLTest::image3D, + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::image3DBuffer, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::image1DArray, + &TextureGLTest::image1DArrayBuffer, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::image2DArray, + &TextureGLTest::image2DArrayBuffer, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::image2DMultisample, + &TextureGLTest::image2DMultisampleBuffer, + &TextureGLTest::image2DMultisampleArray, + &TextureGLTest::image2DMultisampleArrayBuffer, + &TextureGLTest::imageRectangle, + &TextureGLTest::imageRectangleBuffer, + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::subImage1D, + &TextureGLTest::subImage1DBuffer, + #endif + &TextureGLTest::subImage2D, + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::subImage2DBuffer, + #endif + &TextureGLTest::subImage3D, + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::subImage3DBuffer, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::subImage1DArray, + &TextureGLTest::subImage1DArrayBuffer, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::subImage2DArray, + &TextureGLTest::subImage2DArrayBuffer, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::subImage2DMultisample, + &TextureGLTest::subImage2DMultisampleBuffer, + &TextureGLTest::subImage2DMultisampleArray, + &TextureGLTest::subImage2DMultisampleArrayBuffer, + &TextureGLTest::subImageRectangle, + &TextureGLTest::subImageRectangleBuffer, + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::generateMipmap1D, + #endif + &TextureGLTest::generateMipmap2D, + &TextureGLTest::generateMipmap3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::generateMipmap1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::generateMipmap2DArray, + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::invalidateImage1D, + #endif + &TextureGLTest::invalidateImage2D, + &TextureGLTest::invalidateImage3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::invalidateImage1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::invalidateImage2DArray, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::invalidateImage2DMultisample, + &TextureGLTest::invalidateImage2DMultisampleArray, + &TextureGLTest::invalidateImageRectangle, + #endif + + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::invalidateSubImage1D, + #endif + &TextureGLTest::invalidateSubImage2D, + &TextureGLTest::invalidateSubImage3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::invalidateSubImage1DArray, + #endif + #ifndef MAGNUM_TARGET_GLES2 + &TextureGLTest::invalidateSubImage2DArray, + #endif + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::invalidateSubImage2DMultisample, + &TextureGLTest::invalidateSubImage2DMultisampleArray, + &TextureGLTest::invalidateSubImageRectangle + #endif + }); +} + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::construct1D() { + { + Texture1D texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::construct2D() { + { + Texture2D texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void TextureGLTest::construct3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + { + Texture3D texture; + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::construct1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + { + Texture2D texture(Texture2D::Target::Texture1DArray); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::construct2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + { + Texture3D texture(Texture3D::Target::Texture2DArray); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::construct2DMultisample() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + { + Texture2D texture(Texture2D::Target::Texture2DMultisample); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void TextureGLTest::construct2DMultisampleArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + { + Texture3D texture(Texture3D::Target::Texture2DMultisampleArray); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} + +void TextureGLTest::constructRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + { + Texture2D texture(Texture2D::Target::Rectangle); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_VERIFY(texture.id() > 0); + } + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::sampling1D() { + Texture1D texture; + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::sampling2D() { + Texture2D texture; + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + #ifndef MAGNUM_TARGET_GLES + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + #else + .setWrapping(Sampler::Wrapping::ClampToEdge) + #endif + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifdef MAGNUM_TARGET_GLES +void TextureGLTest::samplingBorder2D() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); + + Texture2D texture; + texture.setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::sampling3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + Texture3D texture; + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + #ifndef MAGNUM_TARGET_GLES + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + #else + .setWrapping(Sampler::Wrapping::ClampToEdge) + #endif + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifdef MAGNUM_TARGET_GLES +void TextureGLTest::samplingBorder3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); + + Texture3D texture; + texture.setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::sampling1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::sampling2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + #ifndef MAGNUM_TARGET_GLES + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + #else + .setWrapping(Sampler::Wrapping::ClampToEdge) + #endif + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifdef MAGNUM_TARGET_GLES +void TextureGLTest::samplingBorder2DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); + + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::samplingRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Rectangle); + texture.setMinificationFilter(Sampler::Filter::Linear) + .setMagnificationFilter(Sampler::Filter::Linear) + .setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)) + .setMaxAnisotropy(Sampler::maxAnisotropy()); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::storage1D() { + Texture1D texture; + texture.setStorage(5, TextureFormat::RGBA8, 32); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), 32); + CORRADE_COMPARE(texture.imageSize(1), 16); + CORRADE_COMPARE(texture.imageSize(2), 8); + CORRADE_COMPARE(texture.imageSize(3), 4); + CORRADE_COMPARE(texture.imageSize(4), 2); + CORRADE_COMPARE(texture.imageSize(5), 0); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::storage2D() { + Texture2D texture; + texture.setStorage(5, TextureFormat::RGBA8, Vector2i(32)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(2), Vector2i( 8)); + CORRADE_COMPARE(texture.imageSize(3), Vector2i( 4)); + CORRADE_COMPARE(texture.imageSize(4), Vector2i( 2)); + CORRADE_COMPARE(texture.imageSize(5), Vector2i( 0)); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); + #endif +} + +void TextureGLTest::storage3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + Texture3D texture; + texture.setStorage(5, TextureFormat::RGBA8, Vector3i(32)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(16)); + CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8)); + CORRADE_COMPARE(texture.imageSize(3), Vector3i( 4)); + CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2)); + CORRADE_COMPARE(texture.imageSize(5), Vector3i( 0)); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); + #endif +} + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::storage1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setStorage(5, TextureFormat::RGBA8, Vector2i(32)); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32, 32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i(16, 32)); + CORRADE_COMPARE(texture.imageSize(2), Vector2i( 8, 32)); + CORRADE_COMPARE(texture.imageSize(3), Vector2i( 4, 32)); + CORRADE_COMPARE(texture.imageSize(4), Vector2i( 2, 32)); + CORRADE_COMPARE(texture.imageSize(5), Vector2i( 0, 0)); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::storage2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setStorage(5, TextureFormat::RGBA8, Vector3i(32)); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 32)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 32)); + CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 32)); + CORRADE_COMPARE(texture.imageSize(3), Vector3i( 4, 4, 32)); + CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2, 2, 32)); + CORRADE_COMPARE(texture.imageSize(5), Vector3i( 0, 0, 0)); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::storage2DMultisample() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::storage2DMultisampleArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::storageRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Rectangle); + texture.setStorage(1, TextureFormat::RGBA8, Vector2i(32)); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i( 0)); /* not available */ + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::image1D() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07 }; + Texture1D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, data)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image1D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), 2); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 8), TestSuite::Compare::Container); +} + +void TextureGLTest::image1DBuffer() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07 }; + Texture1D texture; + texture.setImage(0, TextureFormat::RGBA8, + BufferImage1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage1D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticDraw); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), 2); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 8), TestSuite::Compare::Container); +} +#endif + +void TextureGLTest::image2D() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 16), TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::image2DBuffer() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture; + texture.setImage(0, TextureFormat::RGBA8, + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 16), TestSuite::Compare::Container); +} +#endif + +void TextureGLTest::image3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), data)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 32), TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::image3DBuffer() { + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture; + texture.setImage(0, TextureFormat::RGBA8, + BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 32), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::image1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 16), TestSuite::Compare::Container); +} + +void TextureGLTest::image1DArrayBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setImage(0, TextureFormat::RGBA8, + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 16), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::image2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), data)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 32), TestSuite::Compare::Container); +} + +void TextureGLTest::image2DArrayBuffer() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setImage(0, TextureFormat::RGBA8, + BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data + 32), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::image2DMultisample() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::image2DMultisampleBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::image2DMultisampleArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::image2DMultisampleArrayBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::imageRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Rectangle); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), + std::vector(data, data + 16), TestSuite::Compare::Container); +} + +void TextureGLTest::imageRectangleBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + constexpr UnsignedByte data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture; + texture.setImage(0, TextureFormat::RGBA8, + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), + std::vector(data, data+16), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::subImage1D() { + constexpr UnsignedByte zero[4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07 }; + Texture1D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference1D(ColorFormat::RGBA, ColorType::UnsignedByte, 4, zero)); + texture.setSubImage(0, 1, + ImageReference1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image1D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), 4); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} + +void TextureGLTest::subImage1DBuffer() { + constexpr UnsignedByte zero[4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07 }; + Texture1D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference1D(ColorFormat::RGBA, ColorType::UnsignedByte, 4, zero)); + texture.setSubImage(0, 1, + BufferImage1D(ColorFormat::RGBA, ColorType::UnsignedByte, 2, subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage1D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), 4); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +void TextureGLTest::subImage2D() { + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(0, Vector2i(1), + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::subImage2DBuffer() { + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(0, Vector2i(1), + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +void TextureGLTest::subImage3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + constexpr UnsignedByte zero[4*4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), zero)); + texture.setSubImage(0, Vector3i(1), + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(4)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, + 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::subImage3DBuffer() { + constexpr UnsignedByte zero[4*4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), zero)); + texture.setSubImage(0, Vector3i(1), + BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(4)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, + 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::subImage1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(0, Vector2i(1), + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} + +void TextureGLTest::subImage1DArrayBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(0, Vector2i(1), + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::subImage2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + constexpr UnsignedByte zero[4*4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), zero)); + texture.setSubImage(0, Vector3i(1), + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(4)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, + 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} + +void TextureGLTest::subImage2DArrayBuffer() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + constexpr UnsignedByte zero[4*4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, + 0x1c, 0x1d, 0x1e, 0x1f }; + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(4), zero)); + texture.setSubImage(0, Vector3i(1), + BufferImage3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(2), subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(4)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0, 0, 0, 0, + 0, 0, 0, 0, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::subImage2DMultisample() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::subImage2DMultisampleBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::subImage2DMultisampleArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::subImage2DMultisampleArrayBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Not implemented yet."); +} + +void TextureGLTest::subImageRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Rectangle); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(0, Vector2i(1), + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData)); + + MAGNUM_VERIFY_NO_ERROR(); + + Image2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(image.data(), image.data()+image.pixelSize()*image.size().product()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} + +void TextureGLTest::subImageRectangleBuffer() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + constexpr UnsignedByte zero[4*4*4] = {}; + constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + Texture2D texture(Texture2D::Target::Rectangle); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); + texture.setSubImage(0, Vector2i(1), + BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); + texture.image(0, image, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(4)); + CORRADE_COMPARE_AS(std::vector(imageData.begin(), imageData.end()), (std::vector{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, + 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }), TestSuite::Compare::Container); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::generateMipmap1D() { + Texture1D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference1D(ColorFormat::RGBA, ColorType::UnsignedByte, 32)); + + CORRADE_COMPARE(texture.imageSize(0), 32); + CORRADE_COMPARE(texture.imageSize(1), 0); + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), 32); + CORRADE_COMPARE(texture.imageSize(1), 16); + CORRADE_COMPARE(texture.imageSize(2), 8); + CORRADE_COMPARE(texture.imageSize(3), 4); + CORRADE_COMPARE(texture.imageSize(4), 2); + CORRADE_COMPARE(texture.imageSize(5), 1); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::generateMipmap2D() { + Texture2D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i( 0)); + #endif + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i(16)); + CORRADE_COMPARE(texture.imageSize(2), Vector2i( 8)); + CORRADE_COMPARE(texture.imageSize(3), Vector2i( 4)); + CORRADE_COMPARE(texture.imageSize(4), Vector2i( 2)); + CORRADE_COMPARE(texture.imageSize(5), Vector2i( 1)); + + MAGNUM_VERIFY_NO_ERROR(); + #endif +} + +void TextureGLTest::generateMipmap3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + Texture3D texture; + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(32))); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i( 0)); + #endif + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(16)); + CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8)); + CORRADE_COMPARE(texture.imageSize(3), Vector3i( 4)); + CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2)); + CORRADE_COMPARE(texture.imageSize(5), Vector3i( 1)); + + MAGNUM_VERIFY_NO_ERROR(); + #endif +} + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::generateMipmap1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(32))); + + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i( 0)); + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector2i(32, 32)); + CORRADE_COMPARE(texture.imageSize(1), Vector2i(16, 32)); + CORRADE_COMPARE(texture.imageSize(2), Vector2i( 8, 32)); + CORRADE_COMPARE(texture.imageSize(3), Vector2i( 4, 32)); + CORRADE_COMPARE(texture.imageSize(4), Vector2i( 2, 32)); + CORRADE_COMPARE(texture.imageSize(5), Vector2i( 1, 32)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::generateMipmap2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setImage(0, TextureFormat::RGBA8, + ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(32))); + + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i( 0)); + + texture.generateMipmap(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 32)); + CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 32)); + CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 32)); + CORRADE_COMPARE(texture.imageSize(3), Vector3i( 4, 4, 32)); + CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2, 2, 32)); + CORRADE_COMPARE(texture.imageSize(5), Vector3i( 1, 1, 32)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::invalidateImage1D() { + Texture1D texture; + texture.setStorage(2, TextureFormat::RGBA8, 32); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::invalidateImage2D() { + Texture2D texture; + texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void TextureGLTest::invalidateImage3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + Texture3D texture; + texture.setStorage(2, TextureFormat::RGBA8, Vector3i(32)); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::invalidateImage1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::invalidateImage2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setStorage(2, TextureFormat::RGBA8, Vector3i(32)); + texture.invalidateImage(1); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::invalidateImage2DMultisample() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Multisample storage is not implemented yet."); +} + +void TextureGLTest::invalidateImage2DMultisampleArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Multisample storage is not implemented yet."); +} + +void TextureGLTest::invalidateImageRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Rectangle); + texture.setStorage(1, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateImage(0); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::invalidateSubImage1D() { + Texture1D texture; + texture.setStorage(2, TextureFormat::RGBA8, 32); + texture.invalidateSubImage(1, 2, 8); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::invalidateSubImage2D() { + Texture2D texture; + texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateSubImage(1, Vector2i(2), Vector2i(8)); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void TextureGLTest::invalidateSubImage3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + Texture3D texture; + texture.setStorage(2, TextureFormat::RGBA8, Vector3i(32)); + texture.invalidateSubImage(1, Vector3i(2), Vector3i(8)); + + MAGNUM_VERIFY_NO_ERROR(); +} + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::invalidateSubImage1DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Texture1DArray); + texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateSubImage(1, Vector2i(2), Vector2i(8)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES2 +void TextureGLTest::invalidateSubImage2DArray() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + Texture3D texture(Texture3D::Target::Texture2DArray); + texture.setStorage(2, TextureFormat::RGBA8, Vector3i(32)); + texture.invalidateSubImage(1, Vector3i(2), Vector3i(8)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::invalidateSubImage2DMultisample() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Multisample storage is not implemented yet."); +} + +void TextureGLTest::invalidateSubImage2DMultisampleArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + CORRADE_SKIP("Multisample storage is not implemented yet."); +} + +void TextureGLTest::invalidateSubImageRectangle() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + Texture2D texture(Texture2D::Target::Rectangle); + texture.setStorage(1, TextureFormat::RGBA8, Vector2i(32)); + texture.invalidateSubImage(0, Vector2i(4), Vector2i(16)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +}} + +CORRADE_TEST_MAIN(Magnum::Test::TextureGLTest) From 1f15ac1d92a544c7cdbb8ca63300862b1ea23e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 00:45:50 +0100 Subject: [PATCH 49/64] Added no-op fallback for unsupported EXT_texture_filter_anisotropic. This extension is ubiquitous, but to make users' life even easier we now provide no-op fallback for both Sampler::maxAnisotropy() and Texture::setMaxAnisotropy(). --- src/AbstractTexture.cpp | 16 ++++++++++++++-- src/AbstractTexture.h | 17 +++++++++++------ src/Sampler.cpp | 4 ++++ src/Sampler.h | 5 ++--- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index 3d7c33135..cae7d7049 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -45,6 +45,8 @@ AbstractTexture::ParameterfImplementation AbstractTexture::parameterfImplementat &AbstractTexture::parameterImplementationDefault; AbstractTexture::ParameterfvImplementation AbstractTexture::parameterfvImplementation = &AbstractTexture::parameterImplementationDefault; +AbstractTexture::SetMaxAnisotropyImplementation AbstractTexture::setMaxAnisotropyImplementation = + &AbstractTexture::setMaxAnisotropyImplementationNoOp; #ifndef MAGNUM_TARGET_GLES AbstractTexture::GetLevelParameterivImplementation AbstractTexture::getLevelParameterivImplementation = &AbstractTexture::getLevelParameterImplementationDefault; @@ -270,9 +272,13 @@ void AbstractTexture::initializeContextBasedFunctionality(Context& context) { storage3DImplementation = &AbstractTexture::storageImplementationDefault; } } - #else - static_cast(context); #endif + + if(context.isExtensionSupported()) { + Debug() << "AbstractTexture: using" << Extensions::GL::EXT::texture_filter_anisotropic::string() << "features"; + + setMaxAnisotropyImplementation = &AbstractTexture::setMaxAnisotropyImplementationExt; + } } ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat internalFormat) { @@ -677,6 +683,12 @@ void AbstractTexture::parameterImplementationDSA(GLenum parameter, const GLfloat } #endif +void AbstractTexture::setMaxAnisotropyImplementationNoOp(GLfloat) {} + +void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) { + (this->*parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); +} + #ifndef MAGNUM_TARGET_GLES void AbstractTexture::getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values) { bindInternal(); diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 95b4cd4b0..65fc80203 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -273,18 +273,18 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @return Reference to self (for method chaining) * * Default value is `1.0f`, which means no anisotropy. Set to value - * greater than `1.0f` for anisotropic filtering. If - * @extension{EXT,direct_state_access} is not available, the texture - * is bound to some layer before the operation. + * greater than `1.0f` for anisotropic filtering. If extension + * @extension{EXT,texture_filter_anisotropic} (desktop or ES) is not + * available, this function does nothing. If + * @extension{EXT,direct_state_access} is not available, the texture is + * bound to some layer before the operation. * @see @ref Sampler::maxAnisotropy(), @fn_gl{ActiveTexture}, * @fn_gl{BindTexture} and @fn_gl{TexParameter} or * @fn_gl_extension{TextureParameter,EXT,direct_state_access} with * @def_gl{TEXTURE_MAX_ANISOTROPY_EXT} - * @requires_extension %Extension @extension{EXT,texture_filter_anisotropic} - * @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic} */ AbstractTexture& setMaxAnisotropy(Float anisotropy) { - (this->*parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); + (this->*setMaxAnisotropyImplementation)(anisotropy); return *this; } @@ -380,6 +380,11 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { #endif static ParameterfvImplementation parameterfvImplementation; + typedef void(AbstractTexture::*SetMaxAnisotropyImplementation)(GLfloat); + void MAGNUM_LOCAL setMaxAnisotropyImplementationNoOp(GLfloat); + void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy); + static SetMaxAnisotropyImplementation setMaxAnisotropyImplementation; + #ifndef MAGNUM_TARGET_GLES typedef void(AbstractTexture::*GetLevelParameterivImplementation)(GLenum, GLint, GLenum, GLint*); void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values); diff --git a/src/Sampler.cpp b/src/Sampler.cpp index 15bfd75d0..7b8d44993 100644 --- a/src/Sampler.cpp +++ b/src/Sampler.cpp @@ -29,6 +29,7 @@ #include "Context.h" #include "Implementation/State.h" #include "Implementation/TextureState.h" +#include "Extensions.h" namespace Magnum { @@ -46,6 +47,9 @@ static_assert((filter_or(Nearest, Base) == GL_NEAREST) && #undef filter_or Float Sampler::maxAnisotropy() { + if(!Context::current()->isExtensionSupported()) + return 0.0f; + GLfloat& value = Context::current()->state().texture->maxAnisotropy; /** @todo Re-enable when extension header is available */ diff --git a/src/Sampler.h b/src/Sampler.h index 85360d4af..7ffcb055f 100644 --- a/src/Sampler.h +++ b/src/Sampler.h @@ -136,10 +136,9 @@ class MAGNUM_EXPORT Sampler { * @brief Max supported anisotropy * * The result is cached, repeated queries don't result in repeated - * OpenGL calls. + * OpenGL calls. If extension @extension{EXT,texture_filter_anisotropic} + * (desktop or ES) is not available, returns `0.0f`. * @see setMaxAnisotropy(), @fn_gl{Get} with @def_gl{MAX_TEXTURE_MAX_ANISOTROPY_EXT} - * @requires_extension %Extension @extension{EXT,texture_filter_anisotropic} - * @requires_es_extension %Extension @es_extension2{EXT,texture_filter_anisotropic,texture_filter_anisotropic} */ static Float maxAnisotropy(); From fac8f7233c375ce4410e2071081cc5aa54f000d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 00:48:41 +0100 Subject: [PATCH 50/64] Sampler: remove old ES-specific workaround. It caused Sampler::maxAnisotropy() to return 0.0f on all ES systems. And I thought this was some driver issue. --- src/Sampler.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Sampler.cpp b/src/Sampler.cpp index 7b8d44993..eae511626 100644 --- a/src/Sampler.cpp +++ b/src/Sampler.cpp @@ -52,12 +52,9 @@ Float Sampler::maxAnisotropy() { GLfloat& value = Context::current()->state().texture->maxAnisotropy; - /** @todo Re-enable when extension header is available */ - #ifndef MAGNUM_TARGET_GLES /* Get the value, if not already cached */ if(value == 0.0f) glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &value); - #endif return value; } From 7fe926dcabf017f892d1b304382c447fdf9f55e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 00:49:54 +0100 Subject: [PATCH 51/64] Fix AbstractTexture::setWrapping() for rectangle textures. Sampler::Wrapping::ClampToBorder was mistakenly disallowed. All the tests are now passing again. --- src/AbstractTexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index cae7d7049..bdf8edd0c 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -1107,7 +1107,7 @@ void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture* const texture, void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture* texture, const Array2D& wrapping) { #ifndef MAGNUM_TARGET_GLES - CORRADE_ASSERT(texture->_target != GL_TEXTURE_RECTANGLE || ((wrapping.x() == Sampler::Wrapping::ClampToEdge || wrapping.x() == Sampler::Wrapping::ClampToBorder) && (wrapping.y() == Sampler::Wrapping::ClampToEdge || wrapping.y() == Sampler::Wrapping::ClampToEdge)), "AbstractTexture: rectangle texture wrapping must either clamp to border or to edge", ); + CORRADE_ASSERT(texture->_target != GL_TEXTURE_RECTANGLE || ((wrapping.x() == Sampler::Wrapping::ClampToEdge || wrapping.x() == Sampler::Wrapping::ClampToBorder) && (wrapping.y() == Sampler::Wrapping::ClampToEdge || wrapping.y() == Sampler::Wrapping::ClampToBorder)), "Texture2D::setWrapping(): rectangle texture must be clamped to border or to edge", ); #endif (texture->*parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); From bd955a77b71aa2bbdbbee5659c357213f368ce21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 10:24:24 +0100 Subject: [PATCH 52/64] Renamed Sampler::maxAnisotropy() to Sampler::maxMaxAnisotropy(). Finally a non-confusing name, hopefully. Sorry it took me too long. The original Sampler::maxAnisotropy() (and also Sampler::maxSupportedAnisotropy()) is now alias to the new one, is marked as deprecated and will be removed in future release. --- src/AbstractTexture.h | 2 +- src/Implementation/TextureState.cpp | 2 +- src/Implementation/TextureState.h | 2 +- src/Platform/magnum-info.cpp | 2 +- src/Sampler.cpp | 4 ++-- src/Sampler.h | 17 ++++++++++++----- src/Test/CubeMapTextureArrayGLTest.cpp | 2 +- src/Test/CubeMapTextureGLTest.cpp | 2 +- src/Test/TextureGLTest.cpp | 12 ++++++------ src/Texture.h | 2 +- 10 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 65fc80203..35bd33f76 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -278,7 +278,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * available, this function does nothing. If * @extension{EXT,direct_state_access} is not available, the texture is * bound to some layer before the operation. - * @see @ref Sampler::maxAnisotropy(), @fn_gl{ActiveTexture}, + * @see @ref Sampler::maxMaxAnisotropy(), @fn_gl{ActiveTexture}, * @fn_gl{BindTexture} and @fn_gl{TexParameter} or * @fn_gl_extension{TextureParameter,EXT,direct_state_access} with * @def_gl{TEXTURE_MAX_ANISOTROPY_EXT} diff --git a/src/Implementation/TextureState.cpp b/src/Implementation/TextureState.cpp index 68e36264f..689b7aa40 100644 --- a/src/Implementation/TextureState.cpp +++ b/src/Implementation/TextureState.cpp @@ -26,7 +26,7 @@ namespace Magnum { namespace Implementation { -TextureState::TextureState(): maxAnisotropy(0.0f), currentLayer(0) +TextureState::TextureState(): maxMaxAnisotropy(0.0f), currentLayer(0) #ifndef MAGNUM_TARGET_GLES , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0), bufferOffsetAlignment(0) #endif diff --git a/src/Implementation/TextureState.h b/src/Implementation/TextureState.h index 54508124b..ab5d237fa 100644 --- a/src/Implementation/TextureState.h +++ b/src/Implementation/TextureState.h @@ -34,7 +34,7 @@ struct TextureState { explicit TextureState(); ~TextureState(); - GLfloat maxAnisotropy; + GLfloat maxMaxAnisotropy; GLint currentLayer; #ifndef MAGNUM_TARGET_GLES GLint maxColorSamples, diff --git a/src/Platform/magnum-info.cpp b/src/Platform/magnum-info.cpp index 854c5f107..1d9f8e386 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Platform/magnum-info.cpp @@ -355,7 +355,7 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat if(c->isExtensionSupported()) { _h(EXT::texture_filter_anisotropic) - _l(Sampler::maxAnisotropy()) + _l(Sampler::maxMaxAnisotropy()) } if(c->isExtensionSupported()) { diff --git a/src/Sampler.cpp b/src/Sampler.cpp index eae511626..9e6a9311e 100644 --- a/src/Sampler.cpp +++ b/src/Sampler.cpp @@ -46,11 +46,11 @@ static_assert((filter_or(Nearest, Base) == GL_NEAREST) && "Unsupported constants for GL texture filtering"); #undef filter_or -Float Sampler::maxAnisotropy() { +Float Sampler::maxMaxAnisotropy() { if(!Context::current()->isExtensionSupported()) return 0.0f; - GLfloat& value = Context::current()->state().texture->maxAnisotropy; + GLfloat& value = Context::current()->state().texture->maxMaxAnisotropy; /* Get the value, if not already cached */ if(value == 0.0f) diff --git a/src/Sampler.h b/src/Sampler.h index 7ffcb055f..974d60c2e 100644 --- a/src/Sampler.h +++ b/src/Sampler.h @@ -133,22 +133,29 @@ class MAGNUM_EXPORT Sampler { }; /** - * @brief Max supported anisotropy + * @brief Max supported max anisotropy * * The result is cached, repeated queries don't result in repeated * OpenGL calls. If extension @extension{EXT,texture_filter_anisotropic} * (desktop or ES) is not available, returns `0.0f`. * @see setMaxAnisotropy(), @fn_gl{Get} with @def_gl{MAX_TEXTURE_MAX_ANISOTROPY_EXT} */ - static Float maxAnisotropy(); + static Float maxMaxAnisotropy(); #ifdef MAGNUM_BUILD_DEPRECATED /** - * @copybrief maxAnisotropy() - * @deprecated Use @ref Magnum::Sampler::maxAnisotropy() "maxAnisotropy()" + * @copybrief maxMaxAnisotropy() + * @deprecated Use @ref Magnum::Sampler::maxMaxAnisotropy() "maxMaxAnisotropy()" * instead. */ - static CORRADE_DEPRECATED("use maxAnisotropy() instead") Float maxSupportedAnisotropy() { return maxAnisotropy(); } + static CORRADE_DEPRECATED("use maxMaxAnisotropy() instead") Float maxAnisotropy() { return maxMaxAnisotropy(); } + + /** + * @copybrief maxMaxAnisotropy() + * @deprecated Use @ref Magnum::Sampler::maxMaxAnisotropy() "maxMaxAnisotropy()" + * instead. + */ + static CORRADE_DEPRECATED("use maxMaxAnisotropy() instead") Float maxSupportedAnisotropy() { return maxMaxAnisotropy(); } #endif }; diff --git a/src/Test/CubeMapTextureArrayGLTest.cpp b/src/Test/CubeMapTextureArrayGLTest.cpp index 5c7206dfb..455f24cfe 100644 --- a/src/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Test/CubeMapTextureArrayGLTest.cpp @@ -85,7 +85,7 @@ void CubeMapTextureArrayGLTest::sampling() { .setMagnificationFilter(Sampler::Filter::Linear) .setWrapping(Sampler::Wrapping::ClampToBorder) .setBorderColor(Color3(0.5f)) - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } diff --git a/src/Test/CubeMapTextureGLTest.cpp b/src/Test/CubeMapTextureGLTest.cpp index ac3268758..387f81018 100644 --- a/src/Test/CubeMapTextureGLTest.cpp +++ b/src/Test/CubeMapTextureGLTest.cpp @@ -87,7 +87,7 @@ void CubeMapTextureGLTest::sampling() { .setMagnificationFilter(Sampler::Filter::Linear) .setWrapping(Sampler::Wrapping::ClampToBorder) .setBorderColor(Color3(0.5f)) - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } diff --git a/src/Test/TextureGLTest.cpp b/src/Test/TextureGLTest.cpp index 58e192ce9..73edceb96 100644 --- a/src/Test/TextureGLTest.cpp +++ b/src/Test/TextureGLTest.cpp @@ -491,7 +491,7 @@ void TextureGLTest::sampling1D() { .setMagnificationFilter(Sampler::Filter::Linear) .setWrapping(Sampler::Wrapping::ClampToBorder) .setBorderColor(Color3(0.5f)) - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } @@ -507,7 +507,7 @@ void TextureGLTest::sampling2D() { #else .setWrapping(Sampler::Wrapping::ClampToEdge) #endif - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } @@ -540,7 +540,7 @@ void TextureGLTest::sampling3D() { #else .setWrapping(Sampler::Wrapping::ClampToEdge) #endif - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } @@ -573,7 +573,7 @@ void TextureGLTest::sampling1DArray() { .setMagnificationFilter(Sampler::Filter::Linear) .setWrapping(Sampler::Wrapping::ClampToBorder) .setBorderColor(Color3(0.5f)) - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } @@ -595,7 +595,7 @@ void TextureGLTest::sampling2DArray() { #else .setWrapping(Sampler::Wrapping::ClampToEdge) #endif - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } @@ -624,7 +624,7 @@ void TextureGLTest::samplingRectangle() { .setMagnificationFilter(Sampler::Filter::Linear) .setWrapping(Sampler::Wrapping::ClampToBorder) .setBorderColor(Color3(0.5f)) - .setMaxAnisotropy(Sampler::maxAnisotropy()); + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()); MAGNUM_VERIFY_NO_ERROR(); } diff --git a/src/Texture.h b/src/Texture.h index ad63a0b07..b765c0fa9 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -51,7 +51,7 @@ Texture2D texture; texture.setMagnificationFilter(Sampler::Filter::Linear) .setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) .setWrapping(Sampler::Wrapping::ClampToEdge) - .setMaxAnisotropy(Sampler::maxAnisotropy()) + .setMaxAnisotropy(Sampler::maxMaxAnisotropy()) .setStorage(Math::log2(4096)+1, TextureFormat::RGBA8, {4096, 4096}) .setSubImage(0, {}, image) .generateMipmap(); From ce7102df46ebe335bb97f815812e1282f8fefc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 11:00:23 +0100 Subject: [PATCH 53/64] GCC 4.6 compatibility: no std::is_assignable. Just disabling it, as it appears only in tests. --- src/Test/AbstractQueryGLTest.cpp | 7 +++++-- src/Test/AbstractShaderProgramGLTest.cpp | 7 +++++-- src/Test/AbstractTextureGLTest.cpp | 7 +++++-- src/Test/BufferGLTest.cpp | 7 +++++-- src/Test/BufferImageGLTest.cpp | 7 +++++-- src/Test/FramebufferGLTest.cpp | 7 +++++-- src/Test/ImageTest.cpp | 7 +++++-- src/Test/MeshGLTest.cpp | 7 +++++-- src/Test/RenderbufferGLTest.cpp | 7 +++++-- src/Test/ShaderGLTest.cpp | 7 +++++-- src/Trade/Test/ImageDataTest.cpp | 7 +++++-- 11 files changed, 55 insertions(+), 22 deletions(-) diff --git a/src/Test/AbstractQueryGLTest.cpp b/src/Test/AbstractQueryGLTest.cpp index 5060f9df9..39c00c777 100644 --- a/src/Test/AbstractQueryGLTest.cpp +++ b/src/Test/AbstractQueryGLTest.cpp @@ -65,8 +65,11 @@ void AbstractQueryGLTest::construct() { } void AbstractQueryGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void AbstractQueryGLTest::constructMove() { diff --git a/src/Test/AbstractShaderProgramGLTest.cpp b/src/Test/AbstractShaderProgramGLTest.cpp index 0881927c5..2f0ac36fe 100644 --- a/src/Test/AbstractShaderProgramGLTest.cpp +++ b/src/Test/AbstractShaderProgramGLTest.cpp @@ -69,8 +69,11 @@ void AbstractShaderProgramGLTest::construct() { } void AbstractShaderProgramGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void AbstractShaderProgramGLTest::constructMove() { diff --git a/src/Test/AbstractTextureGLTest.cpp b/src/Test/AbstractTextureGLTest.cpp index 42865ae14..753d90337 100644 --- a/src/Test/AbstractTextureGLTest.cpp +++ b/src/Test/AbstractTextureGLTest.cpp @@ -60,8 +60,11 @@ void AbstractTextureGLTest::construct() { } void AbstractTextureGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void AbstractTextureGLTest::constructMove() { diff --git a/src/Test/BufferGLTest.cpp b/src/Test/BufferGLTest.cpp index 3e050266d..a5718eab2 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Test/BufferGLTest.cpp @@ -90,8 +90,11 @@ void BufferGLTest::construct() { } void BufferGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void BufferGLTest::constructMove() { diff --git a/src/Test/BufferImageGLTest.cpp b/src/Test/BufferImageGLTest.cpp index 38db4ef88..ff01edf04 100644 --- a/src/Test/BufferImageGLTest.cpp +++ b/src/Test/BufferImageGLTest.cpp @@ -65,8 +65,11 @@ void BufferImageTest::construct() { } void BufferImageTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void BufferImageTest::constructMove() { diff --git a/src/Test/FramebufferGLTest.cpp b/src/Test/FramebufferGLTest.cpp index 298d1d684..f02fcd538 100644 --- a/src/Test/FramebufferGLTest.cpp +++ b/src/Test/FramebufferGLTest.cpp @@ -61,8 +61,11 @@ void FramebufferGLTest::construct() { } void FramebufferGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void FramebufferGLTest::constructMove() { diff --git a/src/Test/ImageTest.cpp b/src/Test/ImageTest.cpp index 7ea196199..2a464cf55 100644 --- a/src/Test/ImageTest.cpp +++ b/src/Test/ImageTest.cpp @@ -63,8 +63,11 @@ void ImageTest::construct() { } void ImageTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void ImageTest::constructMove() { diff --git a/src/Test/MeshGLTest.cpp b/src/Test/MeshGLTest.cpp index 62215d181..a20a98081 100644 --- a/src/Test/MeshGLTest.cpp +++ b/src/Test/MeshGLTest.cpp @@ -60,8 +60,11 @@ void MeshGLTest::construct() { } void MeshGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void MeshGLTest::constructMove() { diff --git a/src/Test/RenderbufferGLTest.cpp b/src/Test/RenderbufferGLTest.cpp index 4f44ac41f..58572a93b 100644 --- a/src/Test/RenderbufferGLTest.cpp +++ b/src/Test/RenderbufferGLTest.cpp @@ -60,8 +60,11 @@ void RenderbufferGLTest::construct() { } void RenderbufferGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void RenderbufferGLTest::constructMove() { diff --git a/src/Test/ShaderGLTest.cpp b/src/Test/ShaderGLTest.cpp index 8e5846b8a..86d7fbeb0 100644 --- a/src/Test/ShaderGLTest.cpp +++ b/src/Test/ShaderGLTest.cpp @@ -70,8 +70,11 @@ void ShaderGLTest::construct() { } void ShaderGLTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void ShaderGLTest::constructMove() { diff --git a/src/Trade/Test/ImageDataTest.cpp b/src/Trade/Test/ImageDataTest.cpp index 040cccc94..a2310158b 100644 --- a/src/Trade/Test/ImageDataTest.cpp +++ b/src/Trade/Test/ImageDataTest.cpp @@ -61,8 +61,11 @@ void ImageDataTest::construct() { } void ImageDataTest::constructCopy() { - CORRADE_VERIFY(!(std::is_constructible{})); - CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_constructible{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } void ImageDataTest::constructMove() { From ddc7fba3918e7ec672f69722d49607707433e5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 11:03:25 +0100 Subject: [PATCH 54/64] Fixed compilation of tests on Clang. --- src/Query.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Query.h b/src/Query.h index e268f17df..8becdf1ec 100644 --- a/src/Query.h +++ b/src/Query.h @@ -193,6 +193,8 @@ class PrimitiveQuery: public AbstractQuery { TransformFeedbackPrimitivesWritten = GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN }; + explicit PrimitiveQuery() {} + /** * @brief Begin query * @@ -319,6 +321,8 @@ class SampleQuery: public AbstractQuery { }; #endif + explicit SampleQuery() {} + /** @copydoc PrimitiveQuery::begin() */ void begin(Target target) { AbstractQuery::begin(GLenum(target)); @@ -403,6 +407,8 @@ class TimeQuery: public AbstractQuery { #endif }; + explicit TimeQuery() {} + /** * @brief Query timestamp * From 8c0257e6e8fcb4ab12bab3525b49169a662efc6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 16:30:40 +0100 Subject: [PATCH 55/64] Abort the application on attempt to use any ES extension function. We don't have extension loader for ES yet, thus we need to abort on these to avoid undefined behavior. The only exception is NaCl, which provides _some_ extensions without the need for extension loader. These extensions are implemented in particular: CHROMIUM_map_sub EXT_occlusion_query_boolean --- src/AbstractFramebuffer.cpp | 35 ++++++++++++++++------------ src/AbstractObject.cpp | 9 ++++---- src/AbstractTexture.cpp | 26 +++++++++++++-------- src/Buffer.cpp | 22 +++++++++++------- src/Context.cpp | 39 +++++++++++++++++++++++++++++++ src/DebugMessage.cpp | 2 ++ src/Framebuffer.cpp | 4 +++- src/Mesh.cpp | 15 +++++++----- src/Query.cpp | 46 ++++++++++++++++++++++--------------- src/Renderbuffer.cpp | 2 +- src/Renderer.cpp | 4 ++-- 11 files changed, 139 insertions(+), 65 deletions(-) diff --git a/src/AbstractFramebuffer.cpp b/src/AbstractFramebuffer.cpp index 96ec4f94f..aceb75896 100644 --- a/src/AbstractFramebuffer.cpp +++ b/src/AbstractFramebuffer.cpp @@ -142,7 +142,7 @@ FramebufferTarget AbstractFramebuffer::bindInternal() { void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter) { source.bindInternal(FramebufferTarget::Read); destination.bindInternal(FramebufferTarget::Draw); - /** @todo Get some extension wrangler instead to avoid undeclared glBlitFramebuffer() on ES2 */ + /** @todo Re-enable when extension loader is available for ES, add also ANGLE version */ #ifndef MAGNUM_TARGET_GLES2 glBlitFramebuffer(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter)); #else @@ -150,6 +150,8 @@ void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer& static_cast(destinationRectangle); static_cast(mask); static_cast(filter); + //glBlitFramebufferNV(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter)); + CORRADE_INTERNAL_ASSERT(false); #endif } @@ -217,25 +219,27 @@ void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Buf #endif void AbstractFramebuffer::invalidateImplementation(GLsizei count, GLenum* attachments) { - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glInvalidateFramebuffer(GLenum(bindInternal()), count, attachments); #else - //glDiscardFramebufferEXT(GLenum(bindInternal()), count, attachments); static_cast(count); static_cast(attachments); + CORRADE_INTERNAL_ASSERT(false); + //glDiscardFramebufferEXT(GLenum(bindInternal()), count, attachments); #endif } void AbstractFramebuffer::invalidateImplementation(GLsizei count, GLenum* attachments, const Range2Di& rectangle) { - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glInvalidateSubFramebuffer(GLenum(bindInternal()), count, attachments, rectangle.left(), rectangle.bottom(), rectangle.sizeX(), rectangle.sizeY()); #else - //glDiscardSubFramebufferEXT(GLenum(bindInternal()), count, attachments, rectangle.left(), rectangle.bottom(), rectangle.width(), rectangle.height()); static_cast(count); static_cast(attachments); static_cast(rectangle); + CORRADE_INTERNAL_ASSERT(false); + //glDiscardSubFramebufferEXT(GLenum(bindInternal()), count, attachments, rectangle.left(), rectangle.bottom(), rectangle.width(), rectangle.height()); #endif } @@ -286,13 +290,10 @@ void AbstractFramebuffer::initializeContextBasedFunctionality(Context& context) #ifndef MAGNUM_TARGET_GLES Debug() << "AbstractFramebuffer: using" << Extensions::GL::ARB::robustness::string() << "features"; #else - //Debug() << "AbstractFramebuffer: using" << Extensions::GL::EXT::robustness::string() << "features"; + Debug() << "AbstractFramebuffer: using" << Extensions::GL::EXT::robustness::string() << "features"; #endif - /** @todo Enable when extension wrangler for ES is available */ - #ifndef MAGNUM_TARGET_GLES readImplementation = &AbstractFramebuffer::readImplementationRobustness; - #endif } } @@ -308,7 +309,7 @@ GLenum AbstractFramebuffer::checkStatusImplementationDSA(const FramebufferTarget #endif void AbstractFramebuffer::drawBuffersImplementationDefault(GLsizei count, const GLenum* buffers) { - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2 bindInternal(FramebufferTarget::Draw); @@ -329,7 +330,7 @@ void AbstractFramebuffer::drawBuffersImplementationDSA(GLsizei count, const GLen #endif void AbstractFramebuffer::drawBufferImplementationDefault(GLenum buffer) { - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2 bindInternal(FramebufferTarget::Draw); @@ -343,6 +344,8 @@ void AbstractFramebuffer::drawBufferImplementationDefault(GLenum buffer) { #endif #else static_cast(buffer); + CORRADE_INTERNAL_ASSERT(false); + //glDrawBuffersNV(1, &buffer); #endif } @@ -353,7 +356,7 @@ void AbstractFramebuffer::drawBufferImplementationDSA(GLenum buffer) { #endif void AbstractFramebuffer::readBufferImplementationDefault(GLenum buffer) { - /** @todo Get some extension wrangler instead to avoid undeclared glReadBuffer() on ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2 bindInternal(FramebufferTarget::Read); @@ -363,6 +366,8 @@ void AbstractFramebuffer::readBufferImplementationDefault(GLenum buffer) { glReadBuffer(buffer); #else static_cast(buffer); + CORRADE_INTERNAL_ASSERT(false); + //glReadBufferNV(buffer); #endif } @@ -377,18 +382,18 @@ void AbstractFramebuffer::readImplementationDefault(const Vector2i& offset, cons } void AbstractFramebuffer::readImplementationRobustness(const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { - /** @todo Enable when extension wrangler for ES is available */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glReadnPixelsARB(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), dataSize, data); #else - CORRADE_INTERNAL_ASSERT(false); - //glReadnPixelsEXT(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); static_cast(offset); static_cast(size); static_cast(format); static_cast(type); static_cast(dataSize); static_cast(data); + CORRADE_INTERNAL_ASSERT(false); + //glReadnPixelsEXT(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data); #endif } diff --git a/src/AbstractObject.cpp b/src/AbstractObject.cpp index 564cd90af..6b5d9265b 100644 --- a/src/AbstractObject.cpp +++ b/src/AbstractObject.cpp @@ -118,6 +118,7 @@ Int AbstractObject::maxLabelLength() { void AbstractObject::labelImplementationNoOp(GLenum, GLuint, const std::string&) {} void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const std::string& label) { + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glObjectLabel(identifier, name, label.size(), label.data()); #else @@ -131,7 +132,7 @@ void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuin void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const std::string& label) { const GLenum type = extTypeFromKhrIdentifier(identifier); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glLabelObjectEXT(type, name, label.size(), label.data()); #else @@ -174,7 +175,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c GLsizei size; std::string label; label.resize(maxLabelLength()); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glGetObjectLabel(identifier, name, label.size(), &size, &label[0]); #else @@ -192,7 +193,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c /* Get label size (w/o null terminator) */ GLsizei size; - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glGetObjectLabelEXT(type, name, 0, &size, nullptr); #else @@ -204,7 +205,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c /* Make place also for the null terminator */ std::string label; label.resize(size+1); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glGetObjectLabelEXT(identifier, name, size+1, nullptr, &label[0]); #endif diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index bdf8edd0c..342500779 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -714,15 +714,16 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G void AbstractTexture::storageImplementationDefault(GLenum target, GLsizei levels, TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size) { bindInternal(); - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glTexStorage1D(target, levels, GLenum(internalFormat), size[0]); #else - //glTexStorage2DEXT(target, levels, GLenum(internalFormat), size.x(), size.y()); static_cast(target); static_cast(levels); static_cast(internalFormat); static_cast(size); + CORRADE_INTERNAL_ASSERT(false); + //glTexStorage2DEXT(target, levels, GLenum(internalFormat), size.x(), size.y()); #endif } @@ -772,15 +773,16 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G void AbstractTexture::storageImplementationDefault(GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector2i& size) { bindInternal(); - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glTexStorage2D(target, levels, GLenum(internalFormat), size.x(), size.y()); #else - //glTexStorage2DEXT(target, levels, GLenum(internalFormat), size.x(), size.y()); static_cast(target); static_cast(levels); static_cast(internalFormat); static_cast(size); + CORRADE_INTERNAL_ASSERT(false); + //glTexStorage2DEXT(target, levels, GLenum(internalFormat), size.x(), size.y()); #endif } @@ -825,15 +827,16 @@ void AbstractTexture::storageImplementationFallback(GLenum target, GLsizei level void AbstractTexture::storageImplementationDefault(GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector3i& size) { bindInternal(); - /** @todo Re-enable when extension wrangler is available for ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glTexStorage3D(target, levels, GLenum(internalFormat), size.x(), size.y(), size.z()); #else - //glTexStorage3DEXT(target, levels, GLenum(internalFormat), size.x(), size.y(), size.z()); static_cast(target); static_cast(levels); static_cast(internalFormat); static_cast(size); + CORRADE_INTERNAL_ASSERT(false); + //glTexStorage3DEXT(target, levels, GLenum(internalFormat), size.x(), size.y(), size.z()); #endif } @@ -854,17 +857,18 @@ void AbstractTexture::getImageImplementationDSA(const GLenum target, const GLint } void AbstractTexture::getImageImplementationRobustness(const GLenum target, const GLint level, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) { + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES bindInternal(); glGetnTexImageARB(target, level, GLenum(format), GLenum(type), dataSize, data); #else - CORRADE_INTERNAL_ASSERT(false); static_cast(target); static_cast(level); static_cast(format); static_cast(type); static_cast(dataSize); static_cast(data); + CORRADE_INTERNAL_ASSERT(false); #endif } #endif @@ -893,7 +897,7 @@ void AbstractTexture::imageImplementationDSA(GLenum target, GLint level, Texture void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, TextureFormat internalFormat, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) { bindInternal(); - /** @todo Get some extension wrangler instead to avoid linker errors to glTexImage3D() on ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glTexImage3D(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data); #else @@ -904,6 +908,8 @@ void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, Tex static_cast(format); static_cast(type); static_cast(data); + CORRADE_INTERNAL_ASSERT(false); + //glTexImage3DOES(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data); #endif } @@ -937,7 +943,7 @@ void AbstractTexture::subImageImplementationDSA(GLenum target, GLint level, cons void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) { bindInternal(); - /** @todo Get some extension wrangler instead to avoid linker errors to glTexSubImage3D() on ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glTexSubImage3D(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); #else @@ -948,6 +954,8 @@ void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level, static_cast(format); static_cast(type); static_cast(data); + CORRADE_INTERNAL_ASSERT(false); + //glTexSubImage3DOES(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data); #endif } diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 809450ee2..aaf53b5ca 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -219,7 +219,7 @@ Int Buffer::size() { #ifdef MAGNUM_TARGET_GLES2 void* Buffer::mapSub(const GLintptr offset, const GLsizeiptr length, const MapAccess access) { - /** @todo Enable also in Emscripten (?) when extension wrangler is available */ + /** @todo Enable also in Emscripten (?) when extension loader is available */ #ifdef CORRADE_TARGET_NACL CORRADE_ASSERT(!_mappedBuffer, "Buffer::mapSub(): the buffer is already mapped", nullptr); return _mappedBuffer = glMapBufferSubDataCHROMIUM(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access)); @@ -232,6 +232,7 @@ void* Buffer::mapSub(const GLintptr offset, const GLsizeiptr length, const MapAc } void Buffer::unmapSub() { + /** @todo Enable also in Emscripten (?) when extension loader is available */ #ifdef CORRADE_TARGET_NACL CORRADE_ASSERT(_mappedBuffer, "Buffer::unmapSub(): the buffer is not mapped", ); glUnmapBufferSubDataCHROMIUM(_mappedBuffer); @@ -311,12 +312,13 @@ void Buffer::invalidateSubImplementationARB(GLintptr offset, GLsizeiptr length) #endif void* Buffer::mapImplementationDefault(MapAccess access) { - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES return glMapBuffer(GLenum(bindInternal(_targetHint)), GLenum(access)); #else static_cast(access); - return nullptr; + CORRADE_INTERNAL_ASSERT(false); + //return glMapBufferOES(GLenum(bindInternal(_targetHint)), GLenum(access)); #endif } @@ -327,14 +329,15 @@ void* Buffer::mapImplementationDSA(MapAccess access) { #endif void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length, MapFlags access) { - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 return glMapBufferRange(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access)); #else static_cast(offset); static_cast(length); static_cast(access); - return nullptr; + CORRADE_INTERNAL_ASSERT(false); + //return glMapBufferRangeEXT(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access)); #endif } @@ -345,12 +348,14 @@ void* Buffer::mapRangeImplementationDSA(GLintptr offset, GLsizeiptr length, MapF #endif void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr length) { - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glFlushMappedBufferRange(GLenum(bindInternal(_targetHint)), offset, length); #else static_cast(offset); static_cast(length); + CORRADE_INTERNAL_ASSERT(false); + //glFlushMappedBufferRangeEXT(GLenum(bindInternal(_targetHint)), offset, length); #endif } @@ -361,11 +366,12 @@ void Buffer::flushMappedRangeImplementationDSA(GLintptr offset, GLsizeiptr lengt #endif bool Buffer::unmapImplementationDefault() { - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 return glUnmapBuffer(GLenum(bindInternal(_targetHint))); #else - return false; + CORRADE_INTERNAL_ASSERT(false); + //return glUnmapBufferOES(GLenum(bindInternal(_targetHint))); #endif } diff --git a/src/Context.cpp b/src/Context.cpp index 856175a24..de481159d 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -415,6 +415,45 @@ Context::Context() { } #endif + /* Disable extensions for which we need extension loader, as they would + crash otherwise. */ + /** @todo Remove this when extension loader for ES is available */ + #ifdef MAGNUM_TARGET_GLES + #define _disable(prefix, vendor, extension) \ + extensionStatus.reset(Extensions::prefix::vendor::extension::Index); + #ifndef CORRADE_TARGET_NACL + _disable(GL,CHROMIUM,map_sub) + #endif + _disable(GL,EXT,debug_label) + _disable(GL,EXT,debug_marker) + _disable(GL,EXT,disjoint_timer_query) + _disable(GL,EXT,separate_shader_objects) + _disable(GL,EXT,multisampled_render_to_texture) + _disable(GL,EXT,robustness) + _disable(GL,KHR,debug) + _disable(GL,NV,read_buffer_front) + _disable(GL,OES,mapbuffer) + _disable(GL,OES,texture_3D) + #ifdef MAGNUM_TARGET_GLES2 + _disable(GL,ANGLE,framebuffer_blit) + _disable(GL,ANGLE,framebuffer_multisample) + _disable(GL,APPLE,framebuffer_multisample) + _disable(GL,EXT,discard_framebuffer) + _disable(GL,EXT,blend_minmax) + #ifndef CORRADE_TARGET_NACL + _disable(GL,EXT,occlusion_query_boolean) + #endif + _disable(GL,EXT,texture_storage) + _disable(GL,EXT,map_buffer_range) + _disable(GL,NV,draw_buffers) + _disable(GL,NV,fbo_color_attachments) // ?? + _disable(GL,NV,read_buffer) + _disable(GL,NV,framebuffer_multisample) + _disable(GL,OES,vertex_array_object) + #endif + #undef _disable + #endif + /* Set this context as current */ CORRADE_ASSERT(!_current, "Context: Another context currently active", ); _current = this; diff --git a/src/DebugMessage.cpp b/src/DebugMessage.cpp index b087c09c1..8e989f5ad 100644 --- a/src/DebugMessage.cpp +++ b/src/DebugMessage.cpp @@ -144,6 +144,7 @@ void DebugMessage::callbackImplementationKhr(const Callback callback, const void /* Adding callback */ if(!original && callback) { + /** @todo Re-enable when extension wrangler is available for ES */ #ifndef MAGNUM_TARGET_GLES glDebugMessageCallback(callbackWrapper, userParam); #else @@ -154,6 +155,7 @@ void DebugMessage::callbackImplementationKhr(const Callback callback, const void /* Deleting callback */ } else if(original && !callback) { + /** @todo Re-enable when extension wrangler is available for ES */ #ifndef MAGNUM_TARGET_GLES glDebugMessageCallback(nullptr, nullptr); #else diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index 2c733127b..4d9bbbe6d 100644 --- a/src/Framebuffer.cpp +++ b/src/Framebuffer.cpp @@ -185,7 +185,7 @@ void Framebuffer::texture2DImplementationDSA(BufferAttachment attachment, GLenum void Framebuffer::texture3DImplementationDefault(BufferAttachment attachment, Texture3D& texture, GLint mipLevel, GLint layer) { /** @todo Check for texture target compatibility */ - /** @todo Get some extension wrangler for glFramebufferTexture3D() (extension only) */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES glFramebufferTexture3D(GLenum(bindInternal()), GLenum(attachment), GLenum(texture.target()), texture.id(), mipLevel, layer); #else @@ -193,6 +193,8 @@ void Framebuffer::texture3DImplementationDefault(BufferAttachment attachment, Te static_cast(texture); static_cast(mipLevel); static_cast(layer); + CORRADE_INTERNAL_ASSERT(false); + //glFramebufferTexture3DOES(GLenum(bindInternal()), GLenum(attachment), GLenum(texture.target()), texture.id(), mipLevel, layer); #endif } diff --git a/src/Mesh.cpp b/src/Mesh.cpp index aa8c7eec0..dacc794e5 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -206,13 +206,16 @@ void Mesh::drawInternal(Int firstVertex, Int vertexCount, GLintptr indexOffset, } void Mesh::bindVAO(GLuint vao) { - /** @todo Get some extension wrangler instead to avoid linker errors to glBindVertexArray() on ES2 */ - #ifndef MAGNUM_TARGET_GLES2 + /** @todo Re-enable when extension loader is available for ES */ GLuint& current = Context::current()->state().mesh->currentVAO; - if(current != vao) glBindVertexArray(current = vao); - #else - static_cast(vao); - #endif + if(current != vao) { + #ifndef MAGNUM_TARGET_GLES2 + glBindVertexArray(current = vao); + #else + CORRADE_INTERNAL_ASSERT(false); + //glBindVertexArrayOES(current = vao); + #endif + } } void Mesh::vertexAttribPointer(const Attribute& attribute) { diff --git a/src/Query.cpp b/src/Query.cpp index c98178168..1e3adfa56 100644 --- a/src/Query.cpp +++ b/src/Query.cpp @@ -33,12 +33,13 @@ namespace Magnum { AbstractQuery::AbstractQuery(): target() { - /** @todo Get some extension wrangler instead to avoid undeclared glGenQueries() on ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glGenQueries(1, &_id); + #elif defined(CORRADE_TARGET_NACL) + glGenQueriesEXT(1, &_id); #else CORRADE_INTERNAL_ASSERT(false); - //glGenQueriesEXT(1, &_id); #endif } @@ -46,12 +47,13 @@ AbstractQuery::~AbstractQuery() { /* Moved out, nothing to do */ if(!_id) return; - /** @todo Get some extension wrangler instead to avoid undeclared glGenQueries() on ES2 */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glDeleteQueries(1, &_id); + #elif defined(CORRADE_TARGET_NACL) + glDeleteQueriesEXT(1, &_id); #else CORRADE_INTERNAL_ASSERT(false); - //glDeleteQueriesEXT(1, &_id); #endif } @@ -75,13 +77,14 @@ AbstractQuery& AbstractQuery::setLabel(const std::string& label) { bool AbstractQuery::resultAvailable() { CORRADE_ASSERT(!target, "AbstractQuery::resultAvailable(): the query is currently running", false); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ GLuint result; #ifndef MAGNUM_TARGET_GLES2 glGetQueryObjectuiv(_id, GL_QUERY_RESULT_AVAILABLE, &result); + #elif defined(CORRADE_TARGET_NACL) + glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT_AVAILABLE, &result); #else CORRADE_INTERNAL_ASSERT(false); - //glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT_AVAILABLE, &result); #endif return result == GL_TRUE; } @@ -90,13 +93,14 @@ bool AbstractQuery::resultAvailable() { template<> bool AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ GLuint result; #ifndef MAGNUM_TARGET_GLES2 glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result); + #elif defined(CORRADE_TARGET_NACL) + glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result); #else CORRADE_INTERNAL_ASSERT(false); - //glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result); #endif return result == GL_TRUE; } @@ -104,13 +108,14 @@ template<> bool AbstractQuery::result() { template<> UnsignedInt AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ UnsignedInt result; #ifndef MAGNUM_TARGET_GLES2 glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result); + #elif defined(CORRADE_TARGET_NACL) + glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result); #else CORRADE_INTERNAL_ASSERT(false); - //glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result); #endif return result; } @@ -118,13 +123,14 @@ template<> UnsignedInt AbstractQuery::result() { template<> Int AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ Int result; #ifndef MAGNUM_TARGET_GLES glGetQueryObjectiv(_id, GL_QUERY_RESULT, &result); + #elif defined(CORRADE_TARGET_NACL) + glGetQueryObjectivEXT(_id, GL_QUERY_RESULT, &result); #else CORRADE_INTERNAL_ASSERT(false); - //glGetQueryObjectivEXT(_id, GL_QUERY_RESULT, &result); #endif return result; } @@ -132,7 +138,7 @@ template<> Int AbstractQuery::result() { template<> UnsignedLong AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ UnsignedLong result; #ifndef MAGNUM_TARGET_GLES glGetQueryObjectui64v(_id, GL_QUERY_RESULT, &result); @@ -146,7 +152,7 @@ template<> UnsignedLong AbstractQuery::result() { template<> Long AbstractQuery::result() { CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {}); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ Long result; #ifndef MAGNUM_TARGET_GLES glGetQueryObjecti64v(_id, GL_QUERY_RESULT, &result); @@ -161,25 +167,27 @@ template<> Long AbstractQuery::result() { void AbstractQuery::begin(GLenum target) { CORRADE_ASSERT(!this->target, "AbstractQuery::begin(): the query is already running", ); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glBeginQuery(this->target = target, id()); + #elif defined(CORRADE_TARGET_NACL) + glBeginQueryEXT(this->target = target, id()); #else - CORRADE_INTERNAL_ASSERT(false); static_cast(target); - //glBeginQueryEXT(this->target = target, id()); + CORRADE_INTERNAL_ASSERT(false); #endif } void AbstractQuery::end() { CORRADE_ASSERT(target, "AbstractQuery::end(): the query is not running", ); - /** @todo Re-enable when extension wrangler is available for ES */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 glEndQuery(target); + #elif defined(CORRADE_TARGET_NACL) + glEndQueryEXT(target); #else CORRADE_INTERNAL_ASSERT(false); - //glEndQueryEXT(target); #endif target = {}; } diff --git a/src/Renderbuffer.cpp b/src/Renderbuffer.cpp index 03fd45c74..2ec609d99 100644 --- a/src/Renderbuffer.cpp +++ b/src/Renderbuffer.cpp @@ -136,7 +136,7 @@ void Renderbuffer::storageImplementationDSA(RenderbufferFormat internalFormat, c } #endif -/** @todo Enable when extension wrangler for ES is done */ +/** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES2 void Renderbuffer::storageMultisampleImplementationDefault(const GLsizei samples, const RenderbufferFormat internalFormat, const Vector2i& size) { diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 6ce26485d..55675d6dc 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -217,12 +217,12 @@ Renderer::GraphicsResetStatus Renderer::graphicsResetStatusImplementationDefault } Renderer::GraphicsResetStatus Renderer::graphicsResetStatusImplementationRobustness() { - /** @todo Enable when extension wrangler for ES is available */ + /** @todo Re-enable when extension loader is available for ES */ #ifndef MAGNUM_TARGET_GLES return GraphicsResetStatus(glGetGraphicsResetStatusARB()); #else - //return GraphicsResetStatus(glGetGraphicsResetStatusEXT()); CORRADE_INTERNAL_ASSERT(false); + //return GraphicsResetStatus(glGetGraphicsResetStatusEXT()); #endif } From 64c1b6cbd49c347d1bd07d40da86191e816e9885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 17:18:23 +0100 Subject: [PATCH 56/64] Text: disable test case if required extension is not available. --- src/Text/Test/RendererGLTest.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Text/Test/RendererGLTest.cpp b/src/Text/Test/RendererGLTest.cpp index c3a8b1e9d..13a85d42d 100644 --- a/src/Text/Test/RendererGLTest.cpp +++ b/src/Text/Test/RendererGLTest.cpp @@ -253,6 +253,17 @@ void RendererGLTest::renderMeshIndexType() { } void RendererGLTest::mutableText() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported")); + #elif defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_EMSCRIPTEN) + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) { + CORRADE_SKIP("No required extension is supported"); + } + #endif + TestFont font; Text::Renderer2D renderer(font, *static_cast(nullptr), 0.25f); MAGNUM_VERIFY_NO_ERROR(); From 5115fb8624513b221804b890eec4f3260c8c6fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 17:18:05 +0100 Subject: [PATCH 57/64] Doc++, added todos. --- src/AbstractFramebuffer.h | 2 ++ src/AbstractShaderProgram.h | 2 +- src/DefaultFramebuffer.h | 2 +- src/Framebuffer.h | 4 ++++ src/Renderbuffer.h | 3 ++- src/Texture.h | 1 + 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index 886da9d2b..f66f378b6 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -201,6 +201,8 @@ class MAGNUM_EXPORT AbstractFramebuffer { * @see @fn_gl{BlitFramebuffer} * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_blit} or * @es_extension{NV,framebuffer_blit} + * @todo NaCl exports `BlitFramebufferEXT` (although no such extension + * exists for ES) */ static void blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, FramebufferBlitMask mask, FramebufferBlitFilter filter); diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 7917e1f4b..df2dd6ce6 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -171,7 +171,7 @@ bindFragmentDataLocationIndexed(NormalOutput, 1, "normal"); supported in OpenGL ES 2.0, use bindAttributeLocation() instead. @requires_gles30 Multiple fragment shader outputs are not available in OpenGL ES 2.0, similar functionality is available in extension - @extension{NV,draw_buffers}. + @es_extension{NV,draw_buffers}. @subsection AbstractShaderProgram-uniform-location Uniform locations diff --git a/src/DefaultFramebuffer.h b/src/DefaultFramebuffer.h index 1c902b408..eb8706cbd 100644 --- a/src/DefaultFramebuffer.h +++ b/src/DefaultFramebuffer.h @@ -92,7 +92,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { /** * The default framebuffer does not exist. - * @requires_es_extension %Extension @es_extension{OES,surfaceless_context} + * @requires_gles30 %Extension @es_extension{OES,surfaceless_context} */ #ifndef MAGNUM_TARGET_GLES2 Undefined = GL_FRAMEBUFFER_UNDEFINED diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 49a8c34ec..d168e0e22 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -99,6 +99,7 @@ to avoid unnecessary calls to @fn_gl{BindFramebuffer}. See their respective documentation for more information. @requires_gl30 %Extension @extension{ARB,framebuffer_object} +@todo `MAX_COLOR_ATTACHMENTS` */ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObject { friend class Context; @@ -117,6 +118,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** * @brief Constructor * @param id Color attachment id + * + * @requires_gles30 %Extension @es_extension{NV,fbo_color_attachments} + * is required for @p id greater than 0. */ constexpr explicit ColorAttachment(UnsignedInt id): attachment(GL_COLOR_ATTACHMENT0 + id) {} diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index c616c2dc6..8ff9b4c15 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -160,10 +160,11 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { * framebufferbuffer is not currently bound, it is bound before the * operation. * @see @ref maxSize(), @ref maxSamples(), @fn_gl{BindRenderbuffer}, - * @fn_gl{RenderbufferStorage} or @fn_gl_extension{NamedRenderbufferStorage,EXT,direct_state_access} + * @fn_gl{RenderbufferStorageMultisample} or @fn_gl_extension{NamedRenderbufferStorageMultisample,EXT,direct_state_access} * @requires_gles30 %Extension @es_extension{ANGLE,framebuffer_multisample} * or @es_extension{NV,framebuffer_multisample} * @todo How about @es_extension{APPLE,framebuffer_multisample}? + * @todo NaCl has @fn_gl_extension{RenderbufferStorageMultisample,EXT,multisampled_render_to_texture} */ void setStorageMultisample(Int samples, RenderbufferFormat internalFormat, const Vector2i& size) { (this->*storageMultisampleImplementation)(samples, internalFormat, size); diff --git a/src/Texture.h b/src/Texture.h index b765c0fa9..b7aa34608 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -132,6 +132,7 @@ documentation for more information. @see @ref Texture1D, @ref Texture2D, @ref Texture3D, @ref CubeMapTexture, @ref CubeMapTextureArray, @ref BufferTexture @todo @extension{AMD,sparse_texture} +@todo Separate multisample, array and rectangle texture classes to avoid confusion, then remove Target enum */ template class Texture: public AbstractTexture { public: From cacd4c06ebf23526323890a8013d048965a22825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 17:35:51 +0100 Subject: [PATCH 58/64] NV_read_{depth,depth_stencil} is not available in unextended ES3. --- src/Context.cpp | 4 ++-- src/Extensions.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index de481159d..158073f7b 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -231,7 +231,9 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,EXT,robustness), _extension(GL,KHR,debug), _extension(GL,NV,read_buffer_front), + _extension(GL,NV,read_depth), _extension(GL,NV,read_stencil), + _extension(GL,NV,read_depth_stencil), _extension(GL,NV,texture_border_clamp), // done _extension(GL,OES,depth32), _extension(GL,OES,mapbuffer), @@ -254,8 +256,6 @@ const std::vector& Extension::extensions(Version version) { _extension(GL,NV,draw_buffers), _extension(GL,NV,fbo_color_attachments), _extension(GL,NV,read_buffer), - _extension(GL,NV,read_depth), - _extension(GL,NV,read_depth_stencil), _extension(GL,NV,framebuffer_blit), // done _extension(GL,NV,framebuffer_multisample), _extension(GL,OES,depth24), diff --git a/src/Extensions.h b/src/Extensions.h index cfef5eb41..4ae0faf3e 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -235,9 +235,9 @@ namespace GL { _extension(GL,NV,fbo_color_attachments, GLES200, GLES300) // #92 _extension(GL,NV,read_buffer, GLES200, GLES300) // #93 _extension(GL,NV,read_buffer_front, GLES200, None) // #93 - _extension(GL,NV,read_depth, GLES200, GLES300) // #94 + _extension(GL,NV,read_depth, GLES200, None) // #94 _extension(GL,NV,read_stencil, GLES200, None) // #94 - _extension(GL,NV,read_depth_stencil, GLES200, GLES300) // #94 + _extension(GL,NV,read_depth_stencil, GLES200, None) // #94 _extension(GL,NV,framebuffer_blit, GLES200, GLES300) // #142 _extension(GL,NV,framebuffer_multisample, GLES200, GLES300) // #143 _extension(GL,NV,texture_border_clamp, GLES200, None) // #149 From f373b6518e0b1fa3e4d0ffb19f77e80a8a56484c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 18:03:14 +0100 Subject: [PATCH 59/64] Disabling strict aliasing on GCC >= 4.8. Causes failure of DebugToolsCylinderRendererTest without any warning, only in release build, any attempt to add debug print results in issue disappearing. Not an issue on Clang or GCC < 4.8. --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b23e4206c..9df0dd1e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,6 +29,13 @@ if(CORRADE_GCC46_COMPATIBILITY) string(REPLACE "-pedantic" "" CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS}") endif() +# On 4.8.2 strict aliasing causes failure of DebugToolsCylinderRendererTest +# without any warning, only in release build, any attempt to add debug print +# results in issue disappearing. Not an issue on Clang or GCC < 4.8. +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8.0") + set(CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS} -fno-strict-aliasing") +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") include_directories( ${CMAKE_CURRENT_SOURCE_DIR} From 64a1d6be8877b0256fe4b077eb387ace0f691e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 18:50:03 +0100 Subject: [PATCH 60/64] Mesh: set VAO id to 0 when the extension is not available. Also expect this case in test. --- src/Mesh.cpp | 2 +- src/Mesh.h | 2 +- src/Test/MeshGLTest.cpp | 31 ++++++++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index dacc794e5..8fa370336 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -270,7 +270,7 @@ void Mesh::initializeContextBasedFunctionality(Context& context) { #endif } -void Mesh::createImplementationDefault() {} +void Mesh::createImplementationDefault() { _id = 0; } void Mesh::createImplementationVAO() { /** @todo Get some extension wrangler instead to avoid linker errors to glGenVertexArrays() on ES2 */ diff --git a/src/Mesh.h b/src/Mesh.h index 6d41aba32..893615125 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -411,7 +411,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @brief OpenGL mesh ID * * If @extension{APPLE,vertex_array_object} is not available, returns - * 0. + * `0`. */ GLuint id() const { return _id; } diff --git a/src/Test/MeshGLTest.cpp b/src/Test/MeshGLTest.cpp index a20a98081..2596a56db 100644 --- a/src/Test/MeshGLTest.cpp +++ b/src/Test/MeshGLTest.cpp @@ -53,7 +53,15 @@ void MeshGLTest::construct() { const Mesh mesh; MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(mesh.id() > 0); + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(Context::current()->isExtensionSupported()) + #endif + { + CORRADE_VERIFY(mesh.id() > 0); + } } MAGNUM_VERIFY_NO_ERROR(); @@ -72,7 +80,15 @@ void MeshGLTest::constructMove() { const Int id = a.id(); MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(id > 0); + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(Context::current()->isExtensionSupported()) + #endif + { + CORRADE_VERIFY(id > 0); + } Mesh b(std::move(a)); @@ -84,7 +100,16 @@ void MeshGLTest::constructMove() { c = std::move(b); MAGNUM_VERIFY_NO_ERROR(); - CORRADE_VERIFY(cId > 0); + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) + #elif defined(MAGNUM_TARGET_GLES2) + if(Context::current()->isExtensionSupported()) + #endif + { + CORRADE_VERIFY(cId > 0); + } + CORRADE_COMPARE(b.id(), cId); CORRADE_COMPARE(c.id(), id); } From c9103b8947bab282f67f54dfebc1e8bb4d5838d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 19:39:04 +0100 Subject: [PATCH 61/64] Fix compilation of Shader on MinGW32. Broken during renaming in 5f51652aff5c31577b9816b41bbc92414d86b493. --- src/Shader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shader.cpp b/src/Shader.cpp index b6b307893..c841841f5 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -592,7 +592,7 @@ Shader& Shader::addSource(std::string source) { if(!source.empty()) { #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(__MINGW32__) std::ostringstream converter; - converter << (sources.size()+1)/2; + converter << (_sources.size()+1)/2; #endif /* Fix line numbers, so line 41 of third added file is marked as 3(41). From e6200cc828c2ac1f0fecd8bca1822c1e570cdf07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 19:39:50 +0100 Subject: [PATCH 62/64] Use proper debug callback signature on Windows. --- src/DebugMessage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DebugMessage.cpp b/src/DebugMessage.cpp index 8e989f5ad..763c322de 100644 --- a/src/DebugMessage.cpp +++ b/src/DebugMessage.cpp @@ -35,6 +35,9 @@ namespace Magnum { namespace { +#ifdef CORRADE_TARGET_WINDOWS +APIENTRY +#endif void callbackWrapper(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) { Context::current()->state().debug->messageCallback(DebugMessage::Source(source), DebugMessage::Type(type), id, DebugMessage::Severity(severity), std::string(message, length), userParam); } From 168807ed64d04c0e90940f721c99f6ce74be7ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 19:40:27 +0100 Subject: [PATCH 63/64] DebugTools: fix warning on MinGW. --- src/DebugTools/ResourceManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DebugTools/ResourceManager.cpp b/src/DebugTools/ResourceManager.cpp index b13186081..94d9f29a4 100644 --- a/src/DebugTools/ResourceManager.cpp +++ b/src/DebugTools/ResourceManager.cpp @@ -35,11 +35,11 @@ namespace Magnum { -#ifndef CORRADE_TARGET_WINDOWS -template class ResourceManager; -#else -template class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager; +template class +#if defined(CORRADE_TARGET_WINDOWS) && _MSC_VER +MAGNUM_DEBUGTOOLS_EXPORT #endif +ResourceManager; namespace DebugTools { From 533ff3d3d3bb9d3b19f33c2fb6e44f5dc0a39dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Dec 2013 19:52:39 +0100 Subject: [PATCH 64/64] Don't modify CORRADE_CXX_FLAGS, but rather directly CMAKE_CXX_FLAGS. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9df0dd1e5..d1265f6d7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,7 +33,7 @@ endif() # without any warning, only in release build, any attempt to add debug print # results in issue disappearing. Not an issue on Clang or GCC < 4.8. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8.0") - set(CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS} -fno-strict-aliasing") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}")