From 7153ef92a0fac9828bec81258fd8603b1ea7bb90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 22 Feb 2023 20:17:49 +0100 Subject: [PATCH] GL: recognize {OES,EXT}_texture_view ES3.1+ extensions. To match ARB_texture_view from from GL 4.3. Not sure why there's two of them -- I was looking into the spec files, and the EXT variant seems to be based on the OES variant but doesn't seem to add any change (or, no change is listed), however the OES variant has number 218 while EXT has 185 so it's actually newer?! No idea what's happening there. --- doc/opengl-support.dox | 2 ++ src/Magnum/GL/Context.cpp | 4 +++ src/Magnum/GL/Extensions.h | 32 ++++++++++--------- .../OpenGL/GLES3/extensions.txt | 2 ++ src/MagnumExternal/OpenGL/GLES3/flextGL.h | 32 +++++++++++++++++++ .../OpenGL/GLES3/flextGLPlatform.cpp | 6 ++++ .../OpenGL/GLES3/flextGLPlatformIOS.cpp | 12 +++++++ .../GLES3/flextGLPlatformWindowsDesktop.cpp | 6 ++++ .../OpenGL/GLES3/flextGLWindowsDesktop.h | 32 +++++++++++++++++++ 9 files changed, 113 insertions(+), 15 deletions(-) diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 64485b459..cd308c6c5 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -475,6 +475,7 @@ Extension | Status @gl_extension{EXT,texture_compression_s3tc} | done @gl_extension{EXT,pvrtc_sRGB} | done @gl_extension{EXT,shader_integer_mix} | done (shading language only) +@gl_extension{EXT,texture_view} | | @gl_extension{EXT,draw_elements_base_vertex} | done @gl_extension{EXT,texture_norm16} | done @gl_extension{EXT,texture_sRGB_R8} | done @@ -504,6 +505,7 @@ Extension | Status @gl_extension{OES,stencil1} | done @gl_extension{OES,stencil4} | done @gl_extension{OES,texture_float_linear} | done +@gl_extension{OES,texture_view} | | @gl_extension{OES,draw_elements_base_vertex} | done @gl_extension{OVR,multiview} | | @gl_extension{OVR,multiview2} | | diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 49175e6cb..93a59094b 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -394,6 +394,9 @@ constexpr Extension ExtensionList[]{ Extensions::EXT::texture_sRGB_RG8{}, #endif Extensions::EXT::texture_sRGB_decode{}, + #ifndef MAGNUM_TARGET_GLES2 + Extensions::EXT::texture_view{}, + #endif Extensions::IMG::texture_compression_pvrtc{}, Extensions::KHR::blend_equation_advanced_coherent{}, Extensions::KHR::context_flush_control{}, @@ -424,6 +427,7 @@ constexpr Extension ExtensionList[]{ #endif Extensions::OES::texture_float_linear{}, #ifndef MAGNUM_TARGET_GLES2 + Extensions::OES::texture_view{}, Extensions::OVR::multiview{}, #endif #ifndef MAGNUM_TARGET_GLES2 diff --git a/src/Magnum/GL/Extensions.h b/src/Magnum/GL/Extensions.h index f0255e1f6..cf5b8f7f7 100644 --- a/src/Magnum/GL/Extensions.h +++ b/src/Magnum/GL/Extensions.h @@ -463,23 +463,24 @@ namespace ANDROID { #ifndef MAGNUM_TARGET_GLES2 _extension( 59,EXT,texture_buffer, GLES310, GLES320) // #183 _extension( 60,EXT,texture_cube_map_array, GLES310, GLES320) // #184 - _extension( 61,EXT,primitive_bounding_box, GLES310, GLES320) // #186 + _extension( 61,EXT,texture_view, GLES310, None) // #185 + _extension( 62,EXT,primitive_bounding_box, GLES310, GLES320) // #186 #endif - _extension( 62,EXT,draw_elements_base_vertex, GLES200, None) // #204 + _extension( 63,EXT,draw_elements_base_vertex, GLES200, None) // #204 #ifndef MAGNUM_TARGET_GLES2 - _extension( 63,EXT,texture_norm16, GLES310, None) // #207 - _extension( 64,EXT,texture_sRGB_R8, GLES300, None) // #221 - _extension( 65,EXT,texture_sRGB_RG8, GLES300, None) // #223 + _extension( 64,EXT,texture_norm16, GLES310, None) // #207 + _extension( 65,EXT,texture_sRGB_R8, GLES300, None) // #221 + _extension( 66,EXT,texture_sRGB_RG8, GLES300, None) // #223 #endif - _extension( 66,EXT,polygon_offset_clamp, GLES200, None) // #252 + _extension( 67,EXT,polygon_offset_clamp, GLES200, None) // #252 #ifndef MAGNUM_TARGET_GLES2 - _extension( 67,EXT,clip_cull_distance, GLES300, None) // #257 - _extension( 68,EXT,texture_compression_rgtc, GLES300, None) // #286 - _extension( 69,EXT,texture_compression_bptc, GLES300, None) // #287 + _extension( 68,EXT,clip_cull_distance, GLES300, None) // #257 + _extension( 69,EXT,texture_compression_rgtc, GLES300, None) // #286 + _extension( 70,EXT,texture_compression_bptc, GLES300, None) // #287 #endif - _extension( 70,EXT,texture_compression_s3tc_srgb, GLES200, None) // #289 + _extension( 71,EXT,texture_compression_s3tc_srgb, GLES200, None) // #289 } namespace IMG { - _extension( 71,IMG,texture_compression_pvrtc, GLES200, None) // #54 + _extension( 72,IMG,texture_compression_pvrtc, GLES200, None) // #54 } namespace KHR { _extension( 80,KHR,texture_compression_astc_ldr,GLES200, GLES320) // #117 _extension( 81,KHR,texture_compression_astc_hdr,GLES200, None) // #117 @@ -562,16 +563,17 @@ namespace ANDROID { _extension(146,OES,texture_stencil8, GLES200, GLES320) // #173 #ifndef MAGNUM_TARGET_GLES2 _extension(147,OES,texture_storage_multisample_2d_array, GLES310, GLES320) // #174 + _extension(148,OES,texture_view, GLES310, None) // #218 #endif - _extension(148,OES,draw_elements_base_vertex, GLES200, None) // #219 + _extension(149,OES,draw_elements_base_vertex, GLES200, None) // #219 } namespace OVR { #ifndef MAGNUM_TARGET_GLES2 - _extension(149,OVR,multiview, GLES300, None) // #241 - _extension(150,OVR,multiview2, GLES300, None) // #242 + _extension(150,OVR,multiview, GLES300, None) // #241 + _extension(151,OVR,multiview2, GLES300, None) // #242 #endif } namespace MAGNUM { #ifndef MAGNUM_TARGET_GLES2 - _extension(151,MAGNUM,shader_vertex_id, GLES300, GLES300) + _extension(152,MAGNUM,shader_vertex_id, GLES300, GLES300) #endif } #endif diff --git a/src/MagnumExternal/OpenGL/GLES3/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/extensions.txt index 32a066bd2..481f11786 100644 --- a/src/MagnumExternal/OpenGL/GLES3/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/extensions.txt @@ -18,6 +18,7 @@ extension EXT_tessellation_shader optional extension EXT_texture_border_clamp optional extension EXT_texture_buffer optional extension EXT_texture_cube_map_array optional +extension EXT_texture_view optional extension EXT_primitive_bounding_box optional # extension KHR_texture_compression_astc_ldr optional extension KHR_debug optional @@ -33,6 +34,7 @@ extension OES_shader_image_atomic optional extension OES_shader_multisample_interpolation optional extension OES_texture_stencil8 optional extension OES_texture_storage_multisample_2d_array optional +extension OES_texture_view optional extension ANDROID_extension_pack_es31a optional # extension ANGLE_texture_compression_dxt1 optional diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGL.h b/src/MagnumExternal/OpenGL/GLES3/flextGL.h index 2f121f808..e17bc5ed7 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGL.h @@ -1300,6 +1300,14 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F #define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +/* GL_EXT_texture_view */ + +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF + /* GL_EXT_primitive_bounding_box */ #define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE @@ -1452,6 +1460,14 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +/* GL_OES_texture_view */ + +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF + /* GL_APPLE_texture_format_BGRA8888 */ #define GL_BGRA_EXT 0x80E1 @@ -2225,6 +2241,10 @@ struct FlextGL { void(APIENTRY *TexBufferEXT)(GLenum, GLenum, GLuint); void(APIENTRY *TexBufferRangeEXT)(GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); + /* GL_EXT_texture_view */ + + void(APIENTRY *TextureViewEXT)(GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); + /* GL_KHR_blend_equation_advanced */ void(APIENTRY *BlendBarrierKHR)(void); @@ -2285,6 +2305,10 @@ struct FlextGL { void(APIENTRY *TexStorage3DMultisampleOES)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); + /* GL_OES_texture_view */ + + void(APIENTRY *TextureViewOES)(GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); + /* GL_OVR_multiview */ void(APIENTRY *FramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); @@ -2568,6 +2592,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glTexBufferEXT flextGL.TexBufferEXT #define glTexBufferRangeEXT flextGL.TexBufferRangeEXT +/* GL_EXT_texture_view */ + +#define glTextureViewEXT flextGL.TextureViewEXT + /* GL_KHR_blend_equation_advanced */ #define glBlendBarrierKHR flextGL.BlendBarrierKHR @@ -2628,6 +2656,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glTexStorage3DMultisampleOES flextGL.TexStorage3DMultisampleOES +/* GL_OES_texture_view */ + +#define glTextureViewOES flextGL.TextureViewOES + /* GL_OVR_multiview */ #define glFramebufferTextureMultiviewOVR flextGL.FramebufferTextureMultiviewOVR diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp index 8de260563..6fe1f5350 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp @@ -289,6 +289,9 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.TexBufferEXT = reinterpret_cast(loader.load("glTexBufferEXT")); flextGL.TexBufferRangeEXT = reinterpret_cast(loader.load("glTexBufferRangeEXT")); + /* GL_EXT_texture_view */ + flextGL.TextureViewEXT = reinterpret_cast(loader.load("glTextureViewEXT")); + /* GL_KHR_blend_equation_advanced */ flextGL.BlendBarrierKHR = reinterpret_cast(loader.load("glBlendBarrierKHR")); @@ -339,6 +342,9 @@ void flextGLInit(Magnum::GL::Context&) { /* GL_OES_texture_storage_multisample_2d_array */ flextGL.TexStorage3DMultisampleOES = reinterpret_cast(loader.load("glTexStorage3DMultisampleOES")); + /* GL_OES_texture_view */ + flextGL.TextureViewOES = reinterpret_cast(loader.load("glTextureViewOES")); + /* GL_OVR_multiview */ flextGL.FramebufferTextureMultiviewOVR = reinterpret_cast(loader.load("glFramebufferTextureMultiviewOVR")); } diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp index bf5910944..50a9fe424 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp @@ -129,6 +129,7 @@ #undef glTexParameterIuivEXT #undef glTexBufferEXT #undef glTexBufferRangeEXT +#undef glTextureViewEXT #undef glBlendBarrierKHR #undef glDebugMessageCallbackKHR #undef glDebugMessageControlKHR @@ -159,6 +160,7 @@ #undef glUnmapBufferOES #undef glMinSampleShadingOES #undef glTexStorage3DMultisampleOES +#undef glTextureViewOES #undef glFramebufferTextureMultiviewOVR #define GLES_SILENCE_DEPRECATION /* YES I KNOW, APPLE! FFS */ @@ -342,6 +344,11 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.TexBufferRangeEXT = reinterpret_cast(glTexBufferRangeEXT); #endif + /* GL_EXT_texture_view */ + #if GL_EXT_texture_view + flextGL.TextureViewEXT = reinterpret_cast(glTextureViewEXT); + #endif + /* GL_KHR_blend_equation_advanced */ #if GL_KHR_blend_equation_advanced flextGL.BlendBarrierKHR = reinterpret_cast(glBlendBarrierKHR); @@ -412,6 +419,11 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.TexStorage3DMultisampleOES = reinterpret_cast(glTexStorage3DMultisampleOES); #endif + /* GL_OES_texture_view */ + #if GL_OES_texture_view + flextGL.TextureViewOES = reinterpret_cast(glTextureViewOES); + #endif + /* GL_OVR_multiview */ #if GL_OVR_multiview flextGL.FramebufferTextureMultiviewOVR = reinterpret_cast(glFramebufferTextureMultiviewOVR); diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp index f91b7d117..cb38f9ff6 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp @@ -491,6 +491,9 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.TexBufferEXT = reinterpret_cast(loader.load("glTexBufferEXT")); flextGL.TexBufferRangeEXT = reinterpret_cast(loader.load("glTexBufferRangeEXT")); + /* GL_EXT_texture_view */ + flextGL.TextureViewEXT = reinterpret_cast(loader.load("glTextureViewEXT")); + /* GL_KHR_blend_equation_advanced */ flextGL.BlendBarrierKHR = reinterpret_cast(loader.load("glBlendBarrierKHR")); @@ -541,6 +544,9 @@ void flextGLInit(Magnum::GL::Context&) { /* GL_OES_texture_storage_multisample_2d_array */ flextGL.TexStorage3DMultisampleOES = reinterpret_cast(loader.load("glTexStorage3DMultisampleOES")); + /* GL_OES_texture_view */ + flextGL.TextureViewOES = reinterpret_cast(loader.load("glTextureViewOES")); + /* GL_OVR_multiview */ flextGL.FramebufferTextureMultiviewOVR = reinterpret_cast(loader.load("glFramebufferTextureMultiviewOVR")); } diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h index 533529239..1c18e3466 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h @@ -1293,6 +1293,14 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F #define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +/* GL_EXT_texture_view */ + +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF + /* GL_EXT_primitive_bounding_box */ #define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE @@ -1445,6 +1453,14 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C #define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +/* GL_OES_texture_view */ + +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF + /* GL_APPLE_texture_format_BGRA8888 */ #define GL_BGRA_EXT 0x80E1 @@ -2229,6 +2245,10 @@ struct FlextGL { void(APIENTRY *TexBufferEXT)(GLenum, GLenum, GLuint); void(APIENTRY *TexBufferRangeEXT)(GLenum, GLenum, GLuint, GLintptr, GLsizeiptr); + /* GL_EXT_texture_view */ + + void(APIENTRY *TextureViewEXT)(GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); + /* GL_KHR_blend_equation_advanced */ void(APIENTRY *BlendBarrierKHR)(void); @@ -2289,6 +2309,10 @@ struct FlextGL { void(APIENTRY *TexStorage3DMultisampleOES)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); + /* GL_OES_texture_view */ + + void(APIENTRY *TextureViewOES)(GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint); + /* GL_OVR_multiview */ void(APIENTRY *FramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); @@ -2776,6 +2800,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glTexBufferEXT flextGL.TexBufferEXT #define glTexBufferRangeEXT flextGL.TexBufferRangeEXT +/* GL_EXT_texture_view */ + +#define glTextureViewEXT flextGL.TextureViewEXT + /* GL_KHR_blend_equation_advanced */ #define glBlendBarrierKHR flextGL.BlendBarrierKHR @@ -2836,6 +2864,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glTexStorage3DMultisampleOES flextGL.TexStorage3DMultisampleOES +/* GL_OES_texture_view */ + +#define glTextureViewOES flextGL.TextureViewOES + /* GL_OVR_multiview */ #define glFramebufferTextureMultiviewOVR flextGL.FramebufferTextureMultiviewOVR