From a0fa21c9fb0081aa198819ea0ba0799c5cfeeed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 6 Nov 2019 12:33:08 +0100 Subject: [PATCH] external: expose the OVR_multiview, OVR_multiview2 extension entrypoints. --- doc/changelog.dox | 8 ++++++++ doc/opengl-support.dox | 5 +++++ src/Magnum/GL/Context.cpp | 11 +++++++++-- src/Magnum/GL/Extensions.h | 12 ++++++++++++ src/MagnumExternal/OpenGL/GL/extensions.txt | 2 ++ src/MagnumExternal/OpenGL/GL/flextGL.cpp | 3 +++ src/MagnumExternal/OpenGL/GL/flextGL.h | 12 ++++++++++++ src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp | 3 +++ .../OpenGL/GLES3/Emscripten/extensions.txt | 3 +++ src/MagnumExternal/OpenGL/GLES3/extensions.txt | 2 ++ src/MagnumExternal/OpenGL/GLES3/flextGL.cpp | 3 +++ src/MagnumExternal/OpenGL/GLES3/flextGL.h | 12 ++++++++++++ src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h | 11 +++++++++++ src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp | 3 +++ .../OpenGL/GLES3/flextGLPlatformIOS.cpp | 6 ++++++ .../OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp | 3 +++ .../OpenGL/GLES3/flextGLWindowsDesktop.cpp | 3 +++ .../OpenGL/GLES3/flextGLWindowsDesktop.h | 12 ++++++++++++ 18 files changed, 112 insertions(+), 2 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 900c22be6..ebf061501 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -40,6 +40,14 @@ See also: @subsection changelog-latest-new New features +@subsubsection changelog-latest-new-gl GL library + +- Exposed entry points from the desktop / ES @gl_extension{OVR,multiview} and + @gl_extension{OVR,multiview2} extensions and the WebGL + @webgl_extension{OVR,multiview2} extension. Note that no wrapper API in the + @ref GL namespace is provided for these at the moment. See also + [mosra/magnum#385](https://github.com/mosra/magnum/issues/385). + @subsubsection changelog-latest-new-platform Platform libraries - Cursor management using @ref Platform::Sdl2Application::setCursor(), diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 6885a6eb9..346c7869e 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -321,6 +321,8 @@ Extension | Status @gl_extension{EXT,debug_marker} | done @gl_extension{EXT,sRGB_R8} | done @gl_extension{GREMEDY,string_marker} | done +@gl_extension{OVR,multiview} | | +@gl_extension{OVR,multiview2} | | @subsection opengl-support-es20 OpenGL ES 2.0 @@ -486,6 +488,8 @@ Extension | Status @gl_extension{OES,stencil1} | done @gl_extension{OES,stencil4} | done @gl_extension{OES,texture_float_linear} | done +@gl_extension{OVR,multiview} | | +@gl_extension{OVR,multiview2} | | @subsection opengl-support-webgl10 WebGL 1.0 @@ -540,6 +544,7 @@ Extension | Status @webgl_extension{EXT,texture_compression_rgtc} | done @webgl_extension{EXT,texture_compression_bptc} | done @webgl_extension{OES,texture_float_linear} | done +@webgl_extension{OVR,multiview2} | | @webgl_extension{WEBGL,compressed_texture_s3tc} | done @webgl_extension{WEBGL,compressed_texture_pvrtc} | done @webgl_extension{WEBGL,compressed_texture_astc} | done diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 58209a75f..7c086e9f5 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -105,7 +105,9 @@ constexpr Extension ExtensionList[]{ _extension(KHR,texture_compression_astc_hdr), _extension(KHR,blend_equation_advanced), _extension(KHR,blend_equation_advanced_coherent), - _extension(KHR,texture_compression_astc_sliced_3d)}; + _extension(KHR,texture_compression_astc_sliced_3d), + _extension(OVR,multiview), + _extension(OVR,multiview2)}; constexpr Extension ExtensionList300[]{ _extension(ARB,map_buffer_range), _extension(ARB,color_buffer_float), @@ -261,6 +263,9 @@ constexpr Extension ExtensionList[]{ _extension(EXT,texture_compression_rgtc), _extension(EXT,texture_compression_bptc), _extension(OES,texture_float_linear), + #ifndef MAGNUM_TARGET_GLES2 + _extension(OVR,multiview2), + #endif _extension(WEBGL,compressed_texture_s3tc), _extension(WEBGL,compressed_texture_pvrtc), _extension(WEBGL,compressed_texture_astc), @@ -344,7 +349,9 @@ constexpr Extension ExtensionList[]{ _extension(OES,stencil4), _extension(OES,texture_float_linear), #ifndef MAGNUM_TARGET_GLES2 - _extension(OES,texture_compression_astc) + _extension(OES,texture_compression_astc), + _extension(OVR,multiview), + _extension(OVR,multiview2) #endif }; constexpr Extension ExtensionListES300[]{ diff --git a/src/Magnum/GL/Extensions.h b/src/Magnum/GL/Extensions.h index 64d59d54d..4a2a5b670 100644 --- a/src/Magnum/GL/Extensions.h +++ b/src/Magnum/GL/Extensions.h @@ -257,6 +257,9 @@ namespace AMD { _extension(176,NV,depth_buffer_float, GL210, GL300) // #334 _extension(177,NV,conditional_render, GL210, GL300) // #346 /* NV_draw_texture not supported */ // #430 +} namespace OVR { + _extension(178,OVR,multiview, GL300, None) // #478 + _extension(179,OVR,multiview2, GL300, None) // #479 } namespace MAGNUM { _extension(180,MAGNUM,shader_vertex_id, GL300, GL300) } @@ -302,6 +305,10 @@ namespace ANGLE { _extension(21,OES,texture_half_float_linear, GLES200, GLES300) // #21 _extension(22,OES,fbo_render_mipmap, GLES200, GLES300) // #28 #endif +} namespace OVR { + #ifndef MAGNUM_TARGET_GLES2 + _extension(23,OVR,multiview2, GLES300, None) // #36 + #endif } namespace WEBGL { _extension(25,WEBGL,compressed_texture_s3tc, GLES200, None) // #8 #ifdef MAGNUM_TARGET_GLES2 @@ -508,6 +515,11 @@ namespace ANDROID { #ifndef MAGNUM_TARGET_GLES2 _extension(127,OES,texture_storage_multisample_2d_array, GLES310, GLES320) // #174 #endif +} namespace OVR { + #ifndef MAGNUM_TARGET_GLES2 + _extension(128,OVR,multiview, GLES300, None) // #241 + _extension(129,OVR,multiview2, GLES300, None) // #242 + #endif } namespace MAGNUM { #ifndef MAGNUM_TARGET_GLES2 _extension(130,MAGNUM,shader_vertex_id, GLES300, GLES300) diff --git a/src/MagnumExternal/OpenGL/GL/extensions.txt b/src/MagnumExternal/OpenGL/GL/extensions.txt index 9390200e8..c2bfbdd4c 100644 --- a/src/MagnumExternal/OpenGL/GL/extensions.txt +++ b/src/MagnumExternal/OpenGL/GL/extensions.txt @@ -37,5 +37,7 @@ extension KHR_texture_compression_astc_ldr optional extension KHR_blend_equation_advanced optional extension KHR_blend_equation_advanced_coherent optional # extension KHR_texture_compression_astc_sliced_3d optional +extension OVR_multiview optional +extension OVR_multiview2 optional # kate: hl python diff --git a/src/MagnumExternal/OpenGL/GL/flextGL.cpp b/src/MagnumExternal/OpenGL/GL/flextGL.cpp index 1833cc745..ebd21204c 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGL.cpp +++ b/src/MagnumExternal/OpenGL/GL/flextGL.cpp @@ -86,6 +86,9 @@ FLEXTGL_EXPORT void(APIENTRY *flextglStringMarkerGREMEDY)(GLsizei, const void *) /* GL_KHR_blend_equation_advanced */ FLEXTGL_EXPORT void(APIENTRY *flextglBlendBarrierKHR)(void) = nullptr; +/* GL_OVR_multiview */ +FLEXTGL_EXPORT void(APIENTRY *flextglFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei) = nullptr; + /* GL_VERSION_1_0 */ #undef glBlendFunc #undef glClear diff --git a/src/MagnumExternal/OpenGL/GL/flextGL.h b/src/MagnumExternal/OpenGL/GL/flextGL.h index d01dc6c91..02712d611 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGL.h +++ b/src/MagnumExternal/OpenGL/GL/flextGL.h @@ -1758,6 +1758,13 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum #define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +/* GL_OVR_multiview */ + +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 + /* Function prototypes */ /* GL_ARB_ES3_2_compatibility */ @@ -1864,6 +1871,11 @@ GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglStringMarkerGREMEDY)(GLsizei, const v GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglBlendBarrierKHR)(void); #define glBlendBarrierKHR flextglBlendBarrierKHR +/* GL_OVR_multiview */ + +GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); +#define glFramebufferTextureMultiviewOVR flextglFramebufferTextureMultiviewOVR + /* GL_VERSION_1_0 */ GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglBlendFunc)(GLenum, GLenum); diff --git a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp index 8a2cfc0a8..2c8b13d97 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp @@ -175,6 +175,9 @@ void flextGLInit(Magnum::GL::Context& context) { /* GL_KHR_blend_equation_advanced */ flextglBlendBarrierKHR = reinterpret_cast(loader.load("glBlendBarrierKHR")); + /* GL_OVR_multiview */ + flextglFramebufferTextureMultiviewOVR = reinterpret_cast(loader.load("glFramebufferTextureMultiviewOVR")); + /* GL_VERSION_1_2 */ flextglCopyTexSubImage3D = reinterpret_cast(loader.load("glCopyTexSubImage3D")); flextglDrawRangeElements = reinterpret_cast(loader.load("glDrawRangeElements")); diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt index d5bbec529..f6f35a822 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt @@ -10,6 +10,9 @@ extension EXT_disjoint_timer_query optional extension EXT_color_buffer_float optional extension EXT_texture_compression_rgtc optional extension EXT_texture_compression_bptc optional +# WebGL has only OVR_multiview2, but we need the definitions from OVR_multiview +extension OVR_multiview optional +extension OVR_multiview2 optional # These are used as a base for WEBGL_* extensions extension EXT_texture_compression_s3tc optional extension EXT_texture_compression_s3tc_srgb optional diff --git a/src/MagnumExternal/OpenGL/GLES3/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/extensions.txt index a43b7fd19..4ba30130d 100644 --- a/src/MagnumExternal/OpenGL/GLES3/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/extensions.txt @@ -79,5 +79,7 @@ extension OES_depth32 optional extension OES_mapbuffer optional extension OES_stencil1 optional extension OES_stencil4 optional +extension OVR_multiview optional +extension OVR_multiview2 optional # kate: hl python diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGL.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGL.cpp index fd7b0955d..abd62c7c0 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGL.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGL.cpp @@ -303,6 +303,9 @@ FLEXTGL_EXPORT void(APIENTRY *flextglMinSampleShadingOES)(GLfloat) = nullptr; /* GL_OES_texture_storage_multisample_2d_array */ FLEXTGL_EXPORT void(APIENTRY *flextglTexStorage3DMultisampleOES)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean) = nullptr; +/* GL_OVR_multiview */ +FLEXTGL_EXPORT void(APIENTRY *flextglFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei) = nullptr; + #ifdef __cplusplus } #endif diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGL.h b/src/MagnumExternal/OpenGL/GLES3/flextGL.h index c15a5c66b..2f513f78c 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGL.h @@ -1642,6 +1642,13 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_STENCIL_INDEX4_OES 0x8D47 +/* GL_OVR_multiview */ + +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 + /* Function prototypes */ /* GL_ES_VERSION_2_0 */ @@ -2420,6 +2427,11 @@ GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglMinSampleShadingOES)(GLfloat); GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglTexStorage3DMultisampleOES)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); #define glTexStorage3DMultisampleOES flextglTexStorage3DMultisampleOES +/* GL_OVR_multiview */ + +GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); +#define glFramebufferTextureMultiviewOVR flextglFramebufferTextureMultiviewOVR + #ifdef __cplusplus } #endif diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h index fab556de2..a1c21fec9 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h @@ -745,6 +745,13 @@ typedef struct __GLsync *GLsync; #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F +/* GL_OVR_multiview */ + +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 + /* GL_EXT_texture_compression_s3tc */ #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 @@ -1065,6 +1072,10 @@ GLAPI void glGetQueryivEXT(GLenum, GLenum, GLint *); GLAPI GLboolean glIsQueryEXT(GLuint); GLAPI void glQueryCounterEXT(GLuint, GLenum); +/* GL_OVR_multiview */ + +GLAPI void glFramebufferTextureMultiviewOVR(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); + #ifdef __cplusplus } #endif diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp index c052713a5..bbb8a9fb6 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp @@ -306,4 +306,7 @@ void flextGLInit(Magnum::GL::Context&) { /* GL_OES_texture_storage_multisample_2d_array */ flextglTexStorage3DMultisampleOES = reinterpret_cast(loader.load("glTexStorage3DMultisampleOES")); + + /* GL_OVR_multiview */ + flextglFramebufferTextureMultiviewOVR = reinterpret_cast(loader.load("glFramebufferTextureMultiviewOVR")); } diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp index 7d3ffd8ca..9bc2873c4 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp @@ -139,6 +139,7 @@ #undef glUnmapBufferOES #undef glMinSampleShadingOES #undef glTexStorage3DMultisampleOES +#undef glFramebufferTextureMultiviewOVR #include @@ -345,4 +346,9 @@ void flextGLInit(Magnum::GL::Context&) { #if GL_OES_texture_storage_multisample_2d_array flextglTexStorage3DMultisampleOES = reinterpret_cast(glTexStorage3DMultisampleOES); #endif + + /* GL_OVR_multiview */ + #if GL_OVR_multiview + flextglFramebufferTextureMultiviewOVR = reinterpret_cast(glFramebufferTextureMultiviewOVR); + #endif } diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp index 2378be507..e29c46d6e 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp @@ -508,4 +508,7 @@ void flextGLInit(Magnum::GL::Context&) { /* GL_OES_texture_storage_multisample_2d_array */ flextglTexStorage3DMultisampleOES = reinterpret_cast(loader.load("glTexStorage3DMultisampleOES")); + + /* GL_OVR_multiview */ + flextglFramebufferTextureMultiviewOVR = reinterpret_cast(loader.load("glFramebufferTextureMultiviewOVR")); } diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.cpp index 225140591..b0340d047 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.cpp @@ -505,6 +505,9 @@ FLEXTGL_EXPORT void(APIENTRY *flextglMinSampleShadingOES)(GLfloat) = nullptr; /* GL_OES_texture_storage_multisample_2d_array */ FLEXTGL_EXPORT void(APIENTRY *flextglTexStorage3DMultisampleOES)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean) = nullptr; +/* GL_OVR_multiview */ +FLEXTGL_EXPORT void(APIENTRY *flextglFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei) = nullptr; + #ifdef __cplusplus } #endif diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h index 0fcc783c7..5801b9dde 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h @@ -1634,6 +1634,13 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_STENCIL_INDEX4_OES 0x8D47 +/* GL_OVR_multiview */ + +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 + /* Function prototypes */ /* GL_ES_VERSION_2_0 */ @@ -2610,6 +2617,11 @@ GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglMinSampleShadingOES)(GLfloat); GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglTexStorage3DMultisampleOES)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean); #define glTexStorage3DMultisampleOES flextglTexStorage3DMultisampleOES +/* GL_OVR_multiview */ + +GLAPI FLEXTGL_EXPORT void(APIENTRY *flextglFramebufferTextureMultiviewOVR)(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); +#define glFramebufferTextureMultiviewOVR flextglFramebufferTextureMultiviewOVR + #ifdef __cplusplus } #endif