From e967cf551e83765a12f982ab191907a19d5b23d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 2 Oct 2024 21:02:53 +0200 Subject: [PATCH] external: entrypoints for WebGL exts implemented in Emscripten 3.1.66. This is also the first time they just stopped bothering and introduced a name that is neither in the official gl.xml nor in the google-private ANGLE-specific gl.xml. So yeah, gotta make my own gl.xml. I wonder how other people do this. Do they just type out the headers themselves? Or what's the process for this fucking trash fire these days?? --- doc/opengl-support.dox | 6 +-- .../OpenGL/GLES2/Emscripten/extensions.txt | 14 +++---- .../OpenGL/GLES2/Emscripten/webgl.xml | 42 +++++++++++++++++++ .../OpenGL/GLES2/flextGLEmscripten.h | 32 ++++++++++++++ .../OpenGL/GLES3/Emscripten/extensions.txt | 13 +++--- .../OpenGL/GLES3/Emscripten/webgl.xml | 34 ++++++++++++++- .../OpenGL/GLES3/flextGLEmscripten.h | 32 ++++++++++++++ 7 files changed, 154 insertions(+), 19 deletions(-) create mode 100644 src/MagnumExternal/OpenGL/GLES2/Emscripten/webgl.xml diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 90f52c02e..82941abaa 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -575,8 +575,8 @@ Extension | Status @webgl_extension{EXT,texture_compression_rgtc} | done @webgl_extension{EXT,texture_compression_bptc} | done @webgl_extension{EXT,texture_norm16} | done -@webgl_extension{EXT,polygon_offset_clamp} | missing support in Emscripten -@webgl_extension{EXT,clip_control} | missing support in Emscripten +@webgl_extension{EXT,polygon_offset_clamp} | | +@webgl_extension{EXT,clip_control} | | @webgl_extension{EXT,depth_clamp} | done @webgl_extension{EXT,texture_mirror_clamp_to_edge} | done @webgl_extension{KHR,parallel_shader_compile} | done @@ -598,7 +598,7 @@ Extension | Status @webgl_extension{WEBGL,draw_instanced_base_vertex_base_instance} | done @webgl_extension{WEBGL,multi_draw_instanced_base_vertex_base_instance} | done @webgl_extension{WEBGL,provoking_vertex} | missing support in Emscripten -@webgl_extension{WEBGL,polygon_mode} | missing support in Emscripten +@webgl_extension{WEBGL,polygon_mode} | | @webgl_extension{WEBGL,blend_func_extended} | done @webgl_extension{WEBGL,stencil_texturing} | done diff --git a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt index 11a5e605d..9164146b1 100644 --- a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt @@ -5,6 +5,7 @@ version 2.0 es extraspec https://raw.githubusercontent.com/google/angle/master/scripts/gl_angle_ext.xml +extraspec webgl.xml # WebGL 1 only extensions extension ANGLE_instanced_arrays optional @@ -33,9 +34,8 @@ extension EXT_texture_compression_bptc optional extension EXT_color_buffer_float optional extension EXT_texture_compression_s3tc optional extension EXT_texture_compression_s3tc_srgb optional -# Entrypoints for these two not in Emscripten yet. Last checked on 2024-02-14. -# extension EXT_polygon_offset_clamp optional -# extension EXT_clip_control optional +extension EXT_polygon_offset_clamp optional +extension EXT_clip_control optional extension EXT_depth_clamp optional extension EXT_texture_mirror_clamp_to_edge optional # These three are used as a base for WEBGL_* extensions @@ -60,11 +60,11 @@ extension ANGLE_base_vertex_base_instance optional # GOOGLE!!! # extension ANGLE_compressed_texture_etc optional -# These are based off ANGLE_ extensions, gl_angle_ext.xml has them but -# Emscripten not yet, and for Emscripten they'd need to get renamed from an -# ANGLE suffix to WEBGL. Last checked on 2024-02-14. +# These are based off ANGLE_ extensions, for Emscripten they need to get +# renamed from an ANGLE suffix to WEBGL so they come from webgl.xml above. The +# first one doesn't have Emscripten support yet, last checked w/ 3.1.67. # extension WEBGL_provoking_vertex optional -# extension WEGBL_polygon_mode optional +extension WEBGL_polygon_mode optional begin functions blacklist # Not present in WebGL variant of EXT_blend_func_extended diff --git a/src/MagnumExternal/OpenGL/GLES2/Emscripten/webgl.xml b/src/MagnumExternal/OpenGL/GLES2/Emscripten/webgl.xml new file mode 100644 index 000000000..a8f47bee3 --- /dev/null +++ b/src/MagnumExternal/OpenGL/GLES2/Emscripten/webgl.xml @@ -0,0 +1,42 @@ + + + + This contains signatures of functions that are in WebGL 1 but not in ES + and (of course) gl.xml doesn't bother adding any WebGL-specific special + case. + + + + + + + void glPolygonModeWEBGL + GLenum face + GLenum mode + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h index d8caa7e6d..66fc3744b 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h @@ -520,6 +520,19 @@ typedef khronos_uint64_t GLuint64; #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_EXT_polygon_offset_clamp */ + +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B + +/* GL_EXT_clip_control */ + +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D + /* GL_EXT_depth_clamp */ #define GL_DEPTH_CLAMP_EXT 0x864F @@ -599,6 +612,13 @@ typedef khronos_uint64_t GLuint64; #define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 #define GL_COMPLETION_STATUS_KHR 0x91B1 +/* GL_WEBGL_polygon_mode */ + +#define GL_POLYGON_MODE_WEBGL 0x0B40 +#define GL_LINE_WEBGL 0x1B01 +#define GL_FILL_WEBGL 0x1B02 +#define GL_POLYGON_OFFSET_LINE_WEBGL 0x2A02 + /* Function prototypes */ /* GL_ANGLE_base_vertex_base_instance */ @@ -766,6 +786,10 @@ GLAPI void glVertexAttrib4fv(GLuint, const GLfloat *); GLAPI void glVertexAttribPointer(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *); GLAPI void glViewport(GLint, GLint, GLsizei, GLsizei); +/* GL_EXT_clip_control */ + +GLAPI void glClipControlEXT(GLenum, GLenum); + /* GL_EXT_disjoint_timer_query */ GLAPI void glBeginQueryEXT(GLenum, GLuint); @@ -785,6 +809,10 @@ GLAPI void glQueryCounterEXT(GLuint, GLenum); GLAPI void glDrawBuffersEXT(GLsizei, const GLenum *); +/* GL_EXT_polygon_offset_clamp */ + +GLAPI void glPolygonOffsetClampEXT(GLfloat, GLfloat, GLfloat); + /* GL_OES_vertex_array_object */ GLAPI void glBindVertexArrayOES(GLuint); @@ -792,6 +820,10 @@ GLAPI void glDeleteVertexArraysOES(GLsizei, const GLuint *); GLAPI void glGenVertexArraysOES(GLsizei, GLuint *); GLAPI GLboolean glIsVertexArrayOES(GLuint); +/* GL_WEBGL_polygon_mode */ + +GLAPI void glPolygonModeWEBGL(GLenum, GLenum); + #ifdef __cplusplus } #endif diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt index 0f645cb42..17640b33f 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt @@ -22,9 +22,8 @@ extension OVR_multiview2 optional # These two are used as a base for WEBGL_* extensions extension EXT_texture_compression_s3tc optional extension EXT_texture_compression_s3tc_srgb optional -# Entrypoints for these two not in Emscripten yet. Last checked on 2024-02-14. -# extension EXT_polygon_offset_clamp optional -# extension EXT_clip_control optional +extension EXT_polygon_offset_clamp optional +extension EXT_clip_control optional extension EXT_depth_clamp optional extension EXT_texture_mirror_clamp_to_edge optional # These three are used as a base for WEBGL_* extensions @@ -53,11 +52,11 @@ extension ANGLE_stencil_texturing optional extension MAGNUM_what_webgl_has_but_es_not optional -# These are based off ANGLE_ extensions, gl_angle_ext.xml has them but -# Emscripten not yet, and for Emscripten they'd need to get renamed from an -# ANGLE suffix to WEBGL. Last checked on 2024-02-14. +# These are based off ANGLE_ extensions, for Emscripten they need to get +# renamed from an ANGLE suffix to WEBGL so they come from webgl.xml above. The +# first one doesn't have Emscripten support yet, last checked w/ 3.1.67. # extension WEBGL_provoking_vertex optional -# extension WEGBL_polygon_mode optional +extension WEBGL_polygon_mode optional begin functions blacklist # Not present in WebGL variant of EXT_blend_func_extended diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/webgl.xml b/src/MagnumExternal/OpenGL/GLES3/Emscripten/webgl.xml index b7769ab11..49e556645 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/webgl.xml +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/webgl.xml @@ -7,18 +7,48 @@ - + + + + + void glPolygonModeWEBGL + GLenum face + GLenum mode + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h index 611ba934d..72dd431d9 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h @@ -823,6 +823,19 @@ typedef struct __GLsync *GLsync; #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +/* GL_EXT_polygon_offset_clamp */ + +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B + +/* GL_EXT_clip_control */ + +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D + /* GL_EXT_depth_clamp */ #define GL_DEPTH_CLAMP_EXT 0x864F @@ -907,6 +920,13 @@ typedef struct __GLsync *GLsync; #define GL_DEPTH_STENCIL_TEXTURE_MODE_ANGLE 0x90EA #define GL_STENCIL_INDEX_ANGLE 0x1901 +/* GL_WEBGL_polygon_mode */ + +#define GL_POLYGON_MODE_WEBGL 0x0B40 +#define GL_LINE_WEBGL 0x1B01 +#define GL_FILL_WEBGL 0x1B02 +#define GL_POLYGON_OFFSET_LINE_WEBGL 0x2A02 + /* Function prototypes */ /* GL_ANGLE_base_vertex_base_instance */ @@ -1175,6 +1195,10 @@ GLAPI void glVertexAttribI4uiv(GLuint, const GLuint *); GLAPI void glVertexAttribIPointer(GLuint, GLint, GLenum, GLsizei, const void *); GLAPI void glWaitSync(GLsync, GLbitfield, GLuint64); +/* GL_EXT_clip_control */ + +GLAPI void glClipControlEXT(GLenum, GLenum); + /* GL_EXT_disjoint_timer_query */ GLAPI void glBeginQueryEXT(GLenum, GLuint); @@ -1201,6 +1225,10 @@ GLAPI void glDisableiEXT(GLenum, GLuint); GLAPI void glEnableiEXT(GLenum, GLuint); GLAPI GLboolean glIsEnablediEXT(GLenum, GLuint); +/* GL_EXT_polygon_offset_clamp */ + +GLAPI void glPolygonOffsetClampEXT(GLfloat, GLfloat, GLfloat); + /* GL_MAGNUM_what_webgl_has_but_es_not */ GLAPI void glGetBufferSubData(GLenum, GLintptr, GLsizeiptr, void *); @@ -1210,6 +1238,10 @@ GLAPI void glGetBufferSubData(GLenum, GLintptr, GLsizeiptr, void *); GLAPI void glFramebufferTextureMultiviewOVR(GLenum, GLenum, GLuint, GLint, GLint, GLsizei); GLAPI void glNamedFramebufferTextureMultiviewOVR(GLuint, GLenum, GLuint, GLint, GLint, GLsizei); +/* GL_WEBGL_polygon_mode */ + +GLAPI void glPolygonModeWEBGL(GLenum, GLenum); + #ifdef __cplusplus } #endif