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)\"" \ 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/external/OpenGL/GL/extensions.txt b/external/OpenGL/GL/extensions.txt index 9baf6b203..135a48876 100644 --- a/external/OpenGL/GL/extensions.txt +++ b/external/OpenGL/GL/extensions.txt @@ -9,4 +9,6 @@ EXT_texture_filter_anisotropic 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 7de5af8a4..f72669798 100644 --- a/external/OpenGL/GL/gl_magnum.c +++ b/external/OpenGL/GL/gl_magnum.c @@ -90,41 +90,43 @@ 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_EXT_debug_marker = 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 +134,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 +144,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 +156,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 +164,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 +205,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 +218,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 +226,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 +248,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 +273,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 +284,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 +294,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 +320,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 +377,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 +393,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 +407,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 +426,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 +508,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 +534,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 +550,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 +566,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 +594,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 +644,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 +666,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 +686,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 +738,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 +852,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 +884,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 +912,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 +933,41 @@ 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_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() { 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 +994,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 +1008,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 +1028,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 +1063,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 +1105,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 +1173,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 +1265,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 +1282,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 +1293,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 +1336,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 +1387,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 +1449,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 +1460,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 +1472,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 +1490,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 +1579,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 +1607,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 +1617,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 +1645,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 +1707,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 +1723,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 +1789,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 +1925,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 +2105,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 +2135,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 +2157,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 +2239,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 +2339,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 +2351,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 +2463,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 +2485,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 +2507,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 +2541,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 +2632,7 @@ typedef struct ogl_StrToExtMap_s PFN_LOADFUNCPOINTERS LoadExtension; } ogl_StrToExtMap; -static ogl_StrToExtMap ExtensionMap[8] = { +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}, @@ -2600,10 +2640,12 @@ 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_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 = 8; +static int g_extensionMapSize = 10; static void ClearExtensionVars() { @@ -2614,6 +2656,8 @@ 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_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 567373bfb..cd53bf8a7 100644 --- a/external/OpenGL/GL/gl_magnum.h +++ b/external/OpenGL/GL/gl_magnum.h @@ -170,6 +170,8 @@ 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_EXT_debug_marker; extern int ogl_ext_GREMEDY_string_marker; #define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 @@ -195,6 +197,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 +508,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 +1088,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 +1149,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 +1269,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 +1367,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 +1421,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 +1509,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 +1524,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 +1538,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 +1548,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 +1560,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 +1575,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 +1657,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 +1683,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 +1699,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 +1715,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 +1743,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 +1793,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 +1815,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 +1835,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 +1887,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 +2001,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 +2033,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 +2061,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 +2081,27 @@ 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_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 GLvoid *); +extern GLLOADGEN_EXPORT void (CODEGEN_FUNCPTR *_ptrc_glStringMarkerGREMEDY)(GLsizei, const void *); #define glStringMarkerGREMEDY _ptrc_glStringMarkerGREMEDY #endif /*GL_GREMEDY_string_marker*/ @@ -2112,7 +2149,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 +2177,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 +2187,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 +2216,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 +2282,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 +2298,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 +2365,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 +2501,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 +2683,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 +2715,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 +2737,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 +2821,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 +2922,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 +2934,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 +3046,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 +3068,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 +3091,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 +3126,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 *); diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index 8322dd94a..286b1f638 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -32,6 +32,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 @@ -189,6 +192,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) diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index 68ef7ae0f..49734c560 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -43,7 +43,14 @@ endif() # Include dir find_path(SDL2_INCLUDE_DIR - NAMES SDL.h SDL_scancode.h + # 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} ) diff --git a/src/AbstractFramebuffer.cpp b/src/AbstractFramebuffer.cpp index bbd5659f8..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 } @@ -208,7 +210,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 */ @@ -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/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index b2510a5b8..143e415bd 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -150,11 +150,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}). */ @@ -211,6 +206,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/AbstractObject.cpp b/src/AbstractObject.cpp new file mode 100644 index 000000000..6b5d9265b --- /dev/null +++ b/src/AbstractObject.cpp @@ -0,0 +1,218 @@ +/* + 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 { + 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) { + /** @todo Re-enable when extension loader is available for ES */ + #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 loader 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.resize(size); + return label; + #else + GLsizei size; + std::string label; + label.resize(maxLabelLength()); + /** @todo Re-enable when extension loader 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 loader 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 loader 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.resize(size); + return label; +} + +} diff --git a/src/AbstractObject.h b/src/AbstractObject.h new file mode 100644 index 000000000..33b0f26fc --- /dev/null +++ b/src/AbstractObject.h @@ -0,0 +1,78 @@ +#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 struct 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 @extension2{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 89123cae3..dd0fa3864 100644 --- a/src/AbstractShaderProgram.cpp +++ b/src/AbstractShaderProgram.cpp @@ -29,6 +29,7 @@ #include "Math/RectangularMatrix.h" #include "Extensions.h" #include "Shader.h" +#include "Implementation/DebugState.h" #include "Implementation/ShaderProgramState.h" #include "Implementation/State.h" @@ -119,9 +120,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; } @@ -254,6 +254,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); @@ -283,15 +300,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 @@ -332,7 +349,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/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index ffb740b9b..ebeee7994 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 { @@ -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 @@ -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 + * @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_extension2{GetObjectLabel,EXT,debug_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 + * @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_extension2{LabelObject,EXT,debug_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 42b4abe8f..424e47ca9 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" @@ -44,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; @@ -123,8 +126,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,27 +142,12 @@ void AbstractTexture::destroy() { glDeleteTextures(1, &_id); } -void AbstractTexture::move() { - _id = 0; +std::string AbstractTexture::label() const { + return Context::current()->state().debug->getLabelImplementation(GL_TEXTURE, _id); } -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(); +AbstractTexture& AbstractTexture::setLabel(const std::string& label) { + Context::current()->state().debug->labelImplementation(GL_TEXTURE, _id, label); return *this; } @@ -281,9 +273,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) { @@ -688,6 +684,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(); @@ -713,15 +715,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 } @@ -774,15 +777,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 } @@ -827,15 +831,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 } @@ -856,17 +861,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 @@ -895,7 +901,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 @@ -906,6 +912,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 } @@ -939,7 +947,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 @@ -950,6 +958,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 } @@ -993,7 +1003,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); @@ -1109,7 +1119,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())); diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 4687bac5e..817afa5bb 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" #ifdef CORRADE_GCC45_COMPATIBILITY #include "Buffer.h" @@ -101,7 +102,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: @@ -163,13 +164,39 @@ class MAGNUM_EXPORT AbstractTexture { 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 + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension2{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} or + * @fn_gl_extension2{GetObjectLabel,EXT,debug_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 + * @extension2{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or + * @fn_gl_extension2{LabelObject,EXT,debug_label} with + * @def_gl{TEXTURE} + */ + AbstractTexture& setLabel(const std::string& label); /** @brief OpenGL texture ID */ GLuint id() const { return _id; } @@ -252,18 +279,18 @@ class MAGNUM_EXPORT AbstractTexture { * @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. - * @see @ref Sampler::maxAnisotropy(), @fn_gl{ActiveTexture}, + * 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::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} - * @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; } @@ -359,6 +386,11 @@ class MAGNUM_EXPORT AbstractTexture { #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); @@ -461,8 +493,6 @@ class MAGNUM_EXPORT AbstractTexture { #endif static InvalidateSubImageImplementation invalidateSubImageImplementation; - void MAGNUM_LOCAL destroy(); - void MAGNUM_LOCAL move(); ColorFormat MAGNUM_LOCAL imageFormatForInternalFormat(TextureFormat internalFormat); ColorType MAGNUM_LOCAL imageTypeForInternalFormat(TextureFormat internalFormat); @@ -576,6 +606,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/Buffer.cpp b/src/Buffer.cpp index a0638faa7..aaf53b5ca 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)]; @@ -201,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)); @@ -214,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); @@ -293,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 } @@ -309,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 } @@ -327,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 } @@ -343,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/Buffer.h b/src/Buffer.h index 1c119c343..1667849ef 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 + * @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_extension2{GetObjectLabel,EXT,debug_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 + * @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_extension2{LabelObject,EXT,debug_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/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/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 8d92854de..a322d649b 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -201,14 +201,34 @@ 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(); } + + /** + * @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() */ + Int id() const { return AbstractTexture::id(); } + + /** @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 b27e00ce9..a73a6d92b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,9 +29,13 @@ if(CORRADE_GCC46_COMPATIBILITY AND NOT CORRADE_GCC45_COMPATIBILITY) string(REPLACE "-pedantic" "" CORRADE_CXX_FLAGS "${CORRADE_CXX_FLAGS}") endif() -# Disable strict aliasing for GCC 4.4, as it breaks non-const Matrix[34]::up() +# 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. +# +# Disable it also for GCC 4.4, as it breaks non-const Matrix[34]::up() # etc. accessors (and I have no better solution for that yet) -if(CORRADE_GCC44_COMPATIBILITY) +if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8.0") OR CORRADE_GCC44_COMPATIBILITY) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") endif() @@ -54,12 +58,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/magnumConfigure.h.cmake set(Magnum_SRCS AbstractFramebuffer.cpp AbstractImage.cpp + AbstractObject.cpp AbstractTexture.cpp AbstractShaderProgram.cpp Buffer.cpp ColorFormat.cpp Context.cpp - DebugMarker.cpp + DebugMessage.cpp DefaultFramebuffer.cpp Framebuffer.cpp Image.cpp @@ -75,6 +80,7 @@ set(Magnum_SRCS Timeline.cpp Implementation/BufferState.cpp + Implementation/DebugState.cpp Implementation/State.cpp Implementation/TextureState.cpp @@ -107,6 +113,7 @@ endif() set(Magnum_HEADERS AbstractFramebuffer.h AbstractImage.h + AbstractObject.h AbstractResourceLoader.h AbstractShaderProgram.h AbstractTexture.h @@ -116,7 +123,7 @@ set(Magnum_HEADERS ColorFormat.h Context.h CubeMapTexture.h - DebugMarker.h + DebugMessage.h DefaultFramebuffer.h DimensionTraits.h Extensions.h @@ -145,6 +152,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 c356664d0..755df8ae2 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" @@ -86,6 +85,8 @@ 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,EXT,debug_marker), _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), @@ -229,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), @@ -252,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), @@ -415,12 +417,51 @@ 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; /* Initialize state tracker */ - _state = new Implementation::State; + _state = new Implementation::State(*this); /* Initialize functionality based on current OpenGL version and extensions */ AbstractFramebuffer::initializeContextBasedFunctionality(*this); @@ -430,7 +471,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/CubeMapTexture.h b/src/CubeMapTexture.h index 1183a5081..80eb4f3b3 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. @@ -181,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 /** @@ -188,7 +194,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. @@ -204,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 /** @@ -224,6 +237,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..b89cf6b02 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, @@ -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,19 +99,19 @@ 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); } /** * @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); @@ -131,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 @@ -153,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 @@ -162,13 +150,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. */ @@ -183,20 +172,21 @@ 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 * @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. */ @@ -211,6 +201,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 @@ -218,8 +213,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. */ @@ -229,6 +223,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/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..763c322de --- /dev/null +++ b/src/DebugMessage.cpp @@ -0,0 +1,217 @@ +/* + 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 { + +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); +} + +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; + + 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::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) { + /** @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 + +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) { + /** @todo Re-enable when extension wrangler is available for ES */ + #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) { + /** @todo Re-enable when extension wrangler is available for ES */ + #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) { + #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..4f9804390 --- /dev/null +++ b/src/DebugMessage.h @@ -0,0 +1,329 @@ +#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 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 struct Implementation::DebugState; + + public: + /** + * @brief Message source + * + * @see @ref insert(), @ref setCallback() + */ + 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(), @ref setCallback() + */ + 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(), @ref setCallback() + */ + 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 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 + * + * 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); + + /** + * @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: + 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 + + static MAGNUM_LOCAL void callbackImplementationNoOp(Callback, const void*); + static MAGNUM_LOCAL void callbackImplementationKhr(Callback callback, const void* userParam); +}; + +/** @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/DebugTools/ResourceManager.cpp b/src/DebugTools/ResourceManager.cpp index 8a8491f55..94d9f29a4 100644 --- a/src/DebugTools/ResourceManager.cpp +++ b/src/DebugTools/ResourceManager.cpp @@ -35,11 +35,11 @@ namespace Magnum { -#ifndef _WIN32 -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 { diff --git a/src/DebugTools/ResourceManager.h b/src/DebugTools/ResourceManager.h index d075c51aa..ae10d147f 100644 --- a/src/DebugTools/ResourceManager.h +++ b/src/DebugTools/ResourceManager.h @@ -55,7 +55,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/DefaultFramebuffer.h b/src/DefaultFramebuffer.h index 245fc4998..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 @@ -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/Extensions.h b/src/Extensions.h index beef67726..4ae0faf3e 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -181,6 +181,8 @@ 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 + _extension(GL,EXT,debug_marker, GL210, None) // #440 } namespace GREMEDY { _extension(GL,GREMEDY,string_marker, GL210, None) // #311 } namespace INTEL { @@ -215,6 +217,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 @@ -232,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 diff --git a/src/Framebuffer.cpp b/src/Framebuffer.cpp index 89636c57b..39d50211b 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" @@ -78,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; @@ -86,6 +90,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; @@ -172,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 @@ -180,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/Framebuffer.h b/src/Framebuffer.h index 3f2ab2115..fdf5f3e86 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 { /** @@ -95,8 +99,9 @@ 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 { +class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObject { friend class Context; public: @@ -113,6 +118,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { /** * @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) {} @@ -308,6 +316,12 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { */ explicit Framebuffer(const Range2Di& viewport); + /** @brief Copying is not allowed */ + Framebuffer(const Framebuffer&) = delete; + + /** @brief Move constructor */ + Framebuffer(Framebuffer&& other) noexcept; + /** * @brief Destructor * @@ -316,6 +330,41 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { */ ~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; } + + /** + * @brief %Framebuffer label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension2{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} or + * @fn_gl_extension2{GetObjectLabel,EXT,debug_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 + * @extension2{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or + * @fn_gl_extension2{LabelObject,EXT,debug_label} with + * @def_gl{FRAMEBUFFER} + */ + Framebuffer& setLabel(const std::string& label); + /** * @brief Check framebuffer status * @param target Target for which check the status @@ -560,6 +609,19 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { /** @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/Implementation/DebugState.cpp b/src/Implementation/DebugState.cpp new file mode 100644 index 000000000..e00b1bb62 --- /dev/null +++ b/src/Implementation/DebugState.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 "DebugState.h" + +#include "AbstractObject.h" +#include "Context.h" +#include "Extensions.h" + +namespace Magnum { namespace Implementation { + +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()) { + 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; + + messageCallbackImplementation = &DebugMessage::callbackImplementationNoOp; + } +} + +}} diff --git a/src/Implementation/DebugState.h b/src/Implementation/DebugState.h new file mode 100644 index 000000000..0b3ec18f1 --- /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 "DebugMessage.h" + +namespace Magnum { namespace Implementation { + +struct DebugState { + DebugState(Context& context); + + std::string(*getLabelImplementation)(GLenum, GLuint); + 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; +}; + +}} + +#endif diff --git a/src/Implementation/State.cpp b/src/Implementation/State.cpp index 7fd1619f8..ff35e3c64 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,33 @@ 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(); + + 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() { delete texture; @@ -50,6 +72,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/Implementation/TextureState.cpp b/src/Implementation/TextureState.cpp index 7c08ebceb..689b7aa40 100644 --- a/src/Implementation/TextureState.cpp +++ b/src/Implementation/TextureState.cpp @@ -26,9 +26,9 @@ 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) + , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0), bufferOffsetAlignment(0) #endif {} diff --git a/src/Implementation/TextureState.h b/src/Implementation/TextureState.h index 91875bc9e..ab5d237fa 100644 --- a/src/Implementation/TextureState.h +++ b/src/Implementation/TextureState.h @@ -34,12 +34,13 @@ struct TextureState { explicit TextureState(); ~TextureState(); - GLfloat maxAnisotropy; + GLfloat maxMaxAnisotropy; GLint currentLayer; #ifndef MAGNUM_TARGET_GLES GLint maxColorSamples, maxDepthSamples, - maxIntegerSamples; + maxIntegerSamples, + bufferOffsetAlignment; #endif std::vector bindings; diff --git a/src/Magnum.h b/src/Magnum.h index e5fb3e8ab..1206eb0f9 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -572,7 +572,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/Math/Matrix4.h b/src/Math/Matrix4.h index 145105b57..2a7abdf1c 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/Mesh.cpp b/src/Mesh.cpp index bb2235e17..533796605 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" @@ -92,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; @@ -137,6 +141,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, @@ -185,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) { @@ -246,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 */ @@ -260,7 +284,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/Mesh.h b/src/Mesh.h index 57af67504..893615125 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; @@ -407,6 +407,40 @@ 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 %Mesh label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @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_extension2{GetObjectLabel,EXT,debug_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 + * @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_extension2{LabelObject,EXT,debug_label} + * with @def_gl{VERTEX_ARRAY_OBJECT_EXT} + */ + Mesh& setLabel(const std::string& label); + /** * @brief Index size * diff --git a/src/Platform/Sdl2Application.cpp b/src/Platform/Sdl2Application.cpp index a28f6a4e9..1999c7ee7 100644 --- a/src/Platform/Sdl2Application.cpp +++ b/src/Platform/Sdl2Application.cpp @@ -117,6 +117,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(), @@ -131,6 +171,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 diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index 616f0a4a4..0b839c18c 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/Platform/magnum-info.cpp b/src/Platform/magnum-info.cpp index 5d79d35f1..deb10c8a7 100644 --- a/src/Platform/magnum-info.cpp +++ b/src/Platform/magnum-info.cpp @@ -31,7 +31,9 @@ #include "AbstractShaderProgram.h" #include "Buffer.h" +#include "BufferTexture.h" #include "Context.h" +#include "DebugMessage.h" #include "Extensions.h" #include "Framebuffer.h" #include "Mesh.h" @@ -322,6 +324,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 @@ -356,7 +364,15 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat if(c->isExtensionSupported()) { _h(EXT::texture_filter_anisotropic) - _l(Sampler::maxAnisotropy()) + _l(Sampler::maxMaxAnisotropy()) + } + + if(c->isExtensionSupported()) { + _h(KHR::debug) + + _l(AbstractObject::maxLabelLength()) + _l(DebugMessage::maxLoggedMessages()) + _l(DebugMessage::maxMessageLength()) } #undef _l diff --git a/src/Query.cpp b/src/Query.cpp index 79203c0d7..1e3adfa56 100644 --- a/src/Query.cpp +++ b/src/Query.cpp @@ -26,38 +26,65 @@ #include +#include "Context.h" +#include "Implementation/DebugState.h" +#include "Implementation/State.h" + 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 } AbstractQuery::~AbstractQuery() { - /** @todo Get some extension wrangler instead to avoid undeclared glGenQueries() on ES2 */ + /* Moved out, nothing to do */ + if(!_id) return; + + /** @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 } +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); - /** @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; } @@ -66,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; } @@ -80,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; } @@ -94,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; } @@ -108,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); @@ -122,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); @@ -137,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/Query.h b/src/Query.h index 9e4f8fad0..8becdf1ec 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,49 @@ 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 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; } + /** + * @brief %Query label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @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_extension2{GetObjectLabel,EXT,debug_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 + * @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_extension2{LabelObject,EXT,debug_label} + * with @def_gl{QUERY_OBJECT_EXT} + */ + AbstractQuery& setLabel(const std::string& label); + /** * @brief Whether the result is available * @@ -157,6 +193,8 @@ class PrimitiveQuery: public AbstractQuery { TransformFeedbackPrimitivesWritten = GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN }; + explicit PrimitiveQuery() {} + /** * @brief Begin query * @@ -166,6 +204,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 @@ -275,6 +321,8 @@ class SampleQuery: public AbstractQuery { }; #endif + explicit SampleQuery() {} + /** @copydoc PrimitiveQuery::begin() */ void begin(Target target) { AbstractQuery::begin(GLenum(target)); @@ -303,6 +351,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 }; /** @@ -351,6 +407,8 @@ class TimeQuery: public AbstractQuery { #endif }; + explicit TimeQuery() {} + /** * @brief Query timestamp * @@ -370,8 +428,27 @@ 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 }; + +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/Renderbuffer.cpp b/src/Renderbuffer.cpp index b97d860e0..2ec609d99 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 { @@ -70,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; @@ -78,6 +84,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; @@ -121,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/Renderbuffer.h b/src/Renderbuffer.h index 095f22d69..3807f8ffe 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" #ifdef CORRADE_GCC45_COMPATIBILITY @@ -57,14 +57,9 @@ 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; - Renderbuffer(Renderbuffer&&) = delete; - Renderbuffer& operator=(const Renderbuffer&) = delete; - Renderbuffer& operator=(Renderbuffer&&) = delete; - public: /** * @brief Max supported renderbuffer size @@ -93,7 +88,13 @@ class MAGNUM_EXPORT Renderbuffer { * 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 @@ -103,9 +104,41 @@ class MAGNUM_EXPORT Renderbuffer { */ ~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; } + /** + * @brief %Renderbuffer label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @extension2{EXT,debug_label} desktop or ES extension is available, + * this function returns empty string. + * @see @fn_gl{GetObjectLabel} or + * @fn_gl_extension2{GetObjectLabel,EXT,debug_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 + * @extension2{EXT,debug_label} desktop or ES extension is available, + * this function does nothing. + * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or + * @fn_gl_extension2{LabelObject,EXT,debug_label} with + * @def_gl{RENDERBUFFER} + */ + Renderbuffer& setLabel(const std::string& label); + /** * @brief Set renderbuffer storage * @param internalFormat Internal format @@ -131,10 +164,11 @@ class MAGNUM_EXPORT Renderbuffer { * 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); @@ -167,6 +201,15 @@ class MAGNUM_EXPORT Renderbuffer { 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/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 } 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/Sampler.cpp b/src/Sampler.cpp index 15bfd75d0..9e6a9311e 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 { @@ -45,15 +46,15 @@ static_assert((filter_or(Nearest, Base) == GL_NEAREST) && "Unsupported constants for GL texture filtering"); #undef filter_or -Float Sampler::maxAnisotropy() { - GLfloat& value = Context::current()->state().texture->maxAnisotropy; +Float Sampler::maxMaxAnisotropy() { + if(!Context::current()->isExtensionSupported()) + return 0.0f; + + GLfloat& value = Context::current()->state().texture->maxMaxAnisotropy; - /** @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; } diff --git a/src/Sampler.h b/src/Sampler.h index 85360d4af..974d60c2e 100644 --- a/src/Sampler.h +++ b/src/Sampler.h @@ -133,23 +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. + * 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(); + 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/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index 986769565..d9d118081 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -215,7 +215,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 1488c056f..2502ca322 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -349,7 +349,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 d804f678e..e15679519 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -285,7 +285,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 49a02d052..64e76a967 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -150,7 +150,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 9516e05bf..77f2bafd6 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -388,7 +388,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 4b7ae52eb..531d5c820 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -126,7 +126,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 8d89c531a..a9a960a38 100644 --- a/src/SceneGraph/DualComplexTransformation.h +++ b/src/SceneGraph/DualComplexTransformation.h @@ -185,7 +185,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 8109c40eb..d6826f4ba 100644 --- a/src/SceneGraph/DualQuaternionTransformation.h +++ b/src/SceneGraph/DualQuaternionTransformation.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/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index d3d6f2f07..2d725118f 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -193,7 +193,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 78a1964b3..9be34f7ce 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -170,7 +170,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 032a38122..b3acdb6b5 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -218,7 +218,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 caf05a7fe..16df48896 100644 --- a/src/SceneGraph/RigidMatrixTransformation2D.h +++ b/src/SceneGraph/RigidMatrixTransformation2D.h @@ -204,7 +204,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 11b2ff1c2..37f3f275a 100644 --- a/src/SceneGraph/RigidMatrixTransformation3D.h +++ b/src/SceneGraph/RigidMatrixTransformation3D.h @@ -257,7 +257,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 bbb20e1c9..6c2423542 100644 --- a/src/SceneGraph/TranslationTransformation.h +++ b/src/SceneGraph/TranslationTransformation.h @@ -212,7 +212,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 diff --git a/src/Shader.cpp b/src/Shader.cpp index 8335083e9..82bfe5e54 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -31,6 +31,7 @@ #include #include "Extensions.h" +#include "Implementation/DebugState.h" #include "Implementation/State.h" #include "Implementation/ShaderState.h" @@ -439,8 +440,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 @@ -522,8 +523,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 @@ -541,19 +542,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: @@ -563,48 +564,54 @@ 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; +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; } +std::vector Shader::sources() const { return _sources; } + 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). Source 0 is the #version string added in constructor. */ - sources.push_back("#line 1 " + + _sources.push_back("#line 1 " + /* This shouldn't be ambiguous. But is. */ #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(__MINGW32__) #ifndef CORRADE_GCC44_COMPATIBILITY - std::to_string((sources.size()+1)/2) + + std::to_string((_sources.size()+1)/2) + #else - std::to_string(static_cast(sources.size()+1)/2) + + std::to_string(static_cast(_sources.size()+1)/2) + #endif #else converter.str() + #endif '\n'); - sources.push_back(std::move(source)); + _sources.push_back(std::move(source)); } return *this; @@ -619,20 +626,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); @@ -671,4 +678,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 5bfb732f3..6764fde00 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,10 +43,7 @@ namespace Magnum { See AbstractShaderProgram for more information. */ -class MAGNUM_EXPORT Shader { - Shader(const Shader&) = delete; - Shader& operator=(const Shader&) = delete; - +class MAGNUM_EXPORT Shader: public AbstractObject { public: /** * @brief %Shader type @@ -439,6 +436,12 @@ class MAGNUM_EXPORT Shader { */ 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,15 +450,47 @@ class MAGNUM_EXPORT Shader { */ ~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; } + /** + * @brief %Shader label + * + * The result is *not* cached, repeated queries will result in repeated + * OpenGL calls. If neither @extension{KHR,debug} nor + * @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_extension2{GetObjectLabel,EXT,debug_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 + * @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_extension2{LabelObject,EXT,debug_label} + * with @def_gl{SHADER_OBJECT_EXT} + */ + 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 @@ -493,9 +528,23 @@ class MAGNUM_EXPORT Shader { 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/DebugMarker.cpp b/src/Test/AbstractObjectGLTest.cpp similarity index 52% rename from src/DebugMarker.cpp rename to src/Test/AbstractObjectGLTest.cpp index 47049c742..fe27d3973 100644 --- a/src/DebugMarker.cpp +++ b/src/Test/AbstractObjectGLTest.cpp @@ -22,43 +22,34 @@ DEALINGS IN THE SOFTWARE. */ -#include "DebugMarker.h" - -#include - +#include "Buffer.h" #include "Context.h" #include "Extensions.h" +#include "Test/AbstractOpenGLTester.h" -namespace Magnum { +namespace Magnum { namespace Test { -DebugMarker::MarkImplementation DebugMarker::markImplementation = &DebugMarker::markImplementationDefault; +class AbstractObjectGLTest: public AbstractOpenGLTester { + public: + explicit AbstractObjectGLTest(); -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"; + void labelNoOp(); +}; - markImplementation = &DebugMarker::markImplementationDebugger; - } - #else - static_cast(context); - #endif +AbstractObjectGLTest::AbstractObjectGLTest() { + addTests({&AbstractObjectGLTest::labelNoOp}); } -void DebugMarker::markImplementationDefault(const std::string&) {} +void AbstractObjectGLTest::labelNoOp() { + if(Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is supported.")); -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()); - #else - #if 0 - glInsertEventMarkerEXT(string.length(), string.c_str()); - #else - static_cast(string); - #endif - #endif + Buffer buffer; + buffer.setLabel("MyBuffer"); + CORRADE_COMPARE(buffer.label(), ""); + MAGNUM_VERIFY_NO_ERROR(); } -} +}} + +CORRADE_TEST_MAIN(Magnum::Test::AbstractObjectGLTest) diff --git a/src/Test/AbstractOpenGLTester.h b/src/Test/AbstractOpenGLTester.h index e551b4639..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,15 +42,23 @@ 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 { return TestSuite::Tester::exec(); } + int exec() override final { return TestSuite::Tester::exec(); } private: 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) diff --git a/src/Test/AbstractQueryGLTest.cpp b/src/Test/AbstractQueryGLTest.cpp new file mode 100644 index 000000000..39c00c777 --- /dev/null +++ b/src/Test/AbstractQueryGLTest.cpp @@ -0,0 +1,124 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +AbstractQueryGLTest::AbstractQueryGLTest() { + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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()) + 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..2f0ac36fe --- /dev/null +++ b/src/Test/AbstractShaderProgramGLTest.cpp @@ -0,0 +1,118 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() { + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !Context::current()->isExtensionSupported()) + CORRADE_SKIP("Required extension is not available"); + + 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..753d90337 --- /dev/null +++ b/src/Test/AbstractTextureGLTest.cpp @@ -0,0 +1,109 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +AbstractTextureGLTest::AbstractTextureGLTest() { + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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() { + /* 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..a5718eab2 100644 --- a/src/Test/BufferGLTest.cpp +++ b/src/Test/BufferGLTest.cpp @@ -38,6 +38,10 @@ class BufferGLTest: public AbstractOpenGLTester { explicit BufferGLTest(); void construct(); + void constructCopy(); + void constructMove(); + + void label(); void data(); void map(); #ifdef MAGNUM_TARGET_GLES2 @@ -55,6 +59,7 @@ class BufferGLTest: public AbstractOpenGLTester { BufferGLTest::BufferGLTest() { addTests({&BufferGLTest::construct, + &BufferGLTest::label, &BufferGLTest::data, &BufferGLTest::map, #ifdef MAGNUM_TARGET_GLES2 @@ -72,12 +77,60 @@ 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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); + + Buffer 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 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(), ""); - CORRADE_COMPARE(buffer.targetHint(), Buffer::Target::Array); + buffer.setLabel("MyBuffer"); + CORRADE_COMPARE(buffer.label(), "MyBuffer"); - CORRADE_COMPARE(buffer.size(), 0); MAGNUM_VERIFY_NO_ERROR(); } @@ -275,10 +328,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(); diff --git a/src/Test/BufferImageGLTest.cpp b/src/Test/BufferImageGLTest.cpp new file mode 100644 index 000000000..ff01edf04 --- /dev/null +++ b/src/Test/BufferImageGLTest.cpp @@ -0,0 +1,130 @@ +/* + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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/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 855cd581b..43c63b64b 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -26,17 +26,40 @@ 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) +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) 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}) + 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(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/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 { diff --git a/src/Test/CubeMapTextureArrayGLTest.cpp b/src/Test/CubeMapTextureArrayGLTest.cpp new file mode 100644 index 000000000..455f24cfe --- /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::maxMaxAnisotropy()); + + 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..387f81018 --- /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::maxMaxAnisotropy()); + + 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/DebugGLTest.cpp b/src/Test/DebugGLTest.cpp new file mode 100644 index 000000000..ea21aef3e --- /dev/null +++ b/src/Test/DebugGLTest.cpp @@ -0,0 +1,122 @@ +/* + 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 + +#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() + #ifndef MAGNUM_TARGET_GLES + || Context::current()->isExtensionSupported() + #endif + ) + 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")); + + 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() { + if(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, + 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) 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) diff --git a/src/Test/FramebufferGLTest.cpp b/src/Test/FramebufferGLTest.cpp new file mode 100644 index 000000000..f02fcd538 --- /dev/null +++ b/src/Test/FramebufferGLTest.cpp @@ -0,0 +1,114 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +FramebufferGLTest::FramebufferGLTest() { + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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() { + /* 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/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 c176780ac..4da3ebfea 100644 --- a/src/Test/ImageTest.cpp +++ b/src/Test/ImageTest.cpp @@ -33,53 +33,90 @@ 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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 +132,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/Test/MeshGLTest.cpp b/src/Test/MeshGLTest.cpp new file mode 100644 index 000000000..2596a56db --- /dev/null +++ b/src/Test/MeshGLTest.cpp @@ -0,0 +1,134 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +MeshGLTest::MeshGLTest() { + addTests({&MeshGLTest::construct, + &MeshGLTest::constructCopy, + &MeshGLTest::constructMove, + + &MeshGLTest::label}); +} + +void MeshGLTest::construct() { + { + const Mesh mesh; + + MAGNUM_VERIFY_NO_ERROR(); + + #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(); +} + +void MeshGLTest::constructCopy() { + 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() { + Mesh a; + const Int id = a.id(); + + MAGNUM_VERIFY_NO_ERROR(); + + #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)); + + 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(); + + #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); +} + +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..58572a93b --- /dev/null +++ b/src/Test/RenderbufferGLTest.cpp @@ -0,0 +1,109 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +RenderbufferGLTest::RenderbufferGLTest() { + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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() { + /* 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..86d7fbeb0 --- /dev/null +++ b/src/Test/ShaderGLTest.cpp @@ -0,0 +1,143 @@ +/* + 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 construct(); + void constructCopy(); + void constructMove(); + + void label(); +}; + +ShaderGLTest::ShaderGLTest() { + 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif +} + +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() { + /* No-Op version is tested in AbstractObjectGLTest */ + if(!Context::current()->isExtensionSupported() && + !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"); + CORRADE_COMPARE(shader.label(), "MyShader"); + + MAGNUM_VERIFY_NO_ERROR(); +} + +}} + +CORRADE_TEST_MAIN(Magnum::Test::ShaderGLTest) 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) diff --git a/src/Test/TextureGLTest.cpp b/src/Test/TextureGLTest.cpp new file mode 100644 index 000000000..73edceb96 --- /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::maxMaxAnisotropy()); + + 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::maxMaxAnisotropy()); + + 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::maxMaxAnisotropy()); + + 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::maxMaxAnisotropy()); + + 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::maxMaxAnisotropy()); + + 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::maxMaxAnisotropy()); + + 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) 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(); diff --git a/src/Texture.h b/src/Texture.h index 6ed901b4d..b7aa34608 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(); @@ -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); @@ -133,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: @@ -350,7 +350,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 @@ -376,13 +377,19 @@ 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 /** * @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 @@ -405,6 +412,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 /** @@ -423,6 +435,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; 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 /** diff --git a/src/Trade/Test/ImageDataTest.cpp b/src/Trade/Test/ImageDataTest.cpp index 3be4a36e2..59c0548d4 100644 --- a/src/Trade/Test/ImageDataTest.cpp +++ b/src/Trade/Test/ImageDataTest.cpp @@ -33,49 +33,72 @@ 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{})); + /* GCC 4.6 doesn't have std::is_assignable */ + #ifndef CORRADE_GCC46_COMPATIBILITY + CORRADE_VERIFY(!(std::is_assignable{})); + #endif } -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 +118,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()); } }}}