diff --git a/src/renderer/gl33/gl33.c b/src/renderer/gl33/gl33.c index 590cc1a7..5316f1e0 100644 --- a/src/renderer/gl33/gl33.c +++ b/src/renderer/gl33/gl33.c @@ -236,6 +236,7 @@ static void gl33_set_viewport(const FloatRect *vp) { glViewport(vp->x, vp->y, vp->w, vp->h); } +#ifndef STATIC_GLES3 static void gl41_get_viewport(FloatRect *vp) { glGetFloati_v(GL_VIEWPORT, 0, &vp->x); } @@ -243,6 +244,7 @@ static void gl41_get_viewport(FloatRect *vp) { static void gl41_set_viewport(const FloatRect *vp) { glViewportIndexedfv(0, &vp->x); } +#endif static void gl33_init_context(SDL_Window *window) { R.gl_context = SDL_GL_CreateContext(window); @@ -252,7 +254,7 @@ static void gl33_init_context(SDL_Window *window) { } glcommon_load_functions(); - glcommon_check_extensions(); + glcommon_check_capabilities(); if(glcommon_debug_requested()) { glcommon_debug_enable(); @@ -262,6 +264,10 @@ static void gl33_init_context(SDL_Window *window) { gl33_set_clear_depth(1); gl33_set_clear_color(RGBA(0, 0, 0, 0)); +#ifdef STATIC_GLES3 + GLVT.get_viewport = gl33_get_viewport; + GLVT.set_viewport = gl33_set_viewport; +#else if(glext.viewport_array) { GLVT.get_viewport = gl41_get_viewport; GLVT.set_viewport = gl41_set_viewport; @@ -269,6 +275,7 @@ static void gl33_init_context(SDL_Window *window) { GLVT.get_viewport = gl33_get_viewport; GLVT.set_viewport = gl33_set_viewport; } +#endif glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -941,7 +948,11 @@ static void gl33_draw(VertexArray *varr, Primitive prim, uint firstvert, uint co if(instances) { if(base_instance) { + #ifdef STATIC_GLES3 + log_fatal("base_instance is not supported"); + #else glDrawArraysInstancedBaseInstance(gl_prim, firstvert, count, instances, base_instance); + #endif } else { glDrawArraysInstanced(gl_prim, firstvert, count, instances); } @@ -964,7 +975,11 @@ static void gl33_draw_indexed(VertexArray *varr, Primitive prim, uint firstidx, if(instances) { if(base_instance) { + #ifdef STATIC_GLES3 + log_fatal("base_instance is not supported"); + #else glDrawElementsInstancedBaseInstance(gl_prim, count, GL33_IBO_GL_DATATYPE, (void*)iofs, instances, base_instance); + #endif } else { glDrawElementsInstanced(gl_prim, count, GL33_IBO_GL_DATATYPE, (void*)iofs, instances); } diff --git a/src/renderer/gl33/shader_object.c b/src/renderer/gl33/shader_object.c index 75990dd4..992e07de 100644 --- a/src/renderer/gl33/shader_object.c +++ b/src/renderer/gl33/shader_object.c @@ -79,7 +79,7 @@ ShaderObject* gl33_shader_object_compile(ShaderSource *source) { glCompileShader(gl_handle); -#ifdef DEBUG +#if defined DEBUG && !defined STATIC_GLES3 if(GLAD_GL_ANGLE_translated_shader_source) { GLint srclen; glGetShaderiv(gl_handle, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &srclen); diff --git a/src/renderer/gl33/texture.c b/src/renderer/gl33/texture.c index dd0f2209..5c06e1d7 100644 --- a/src/renderer/gl33/texture.c +++ b/src/renderer/gl33/texture.c @@ -363,9 +363,13 @@ void gl33_texture_fill_region(Texture *tex, uint mipmap, uint x, uint y, const P } void gl44_texture_clear(Texture *tex, const Color *clr) { +#ifdef STATIC_GLES3 + UNREACHABLE; +#else for(int i = 0; i < tex->params.mipmaps; ++i) { glClearTexImage(tex->gl_handle, i, GL_RGBA, GL_FLOAT, &clr->r); } +#endif } void gl33_texture_clear(Texture *tex, const Color *clr) { diff --git a/src/renderer/glcommon/debug.c b/src/renderer/glcommon/debug.c index 686d305c..186aa0a4 100644 --- a/src/renderer/glcommon/debug.c +++ b/src/renderer/glcommon/debug.c @@ -12,6 +12,8 @@ #include "util.h" #include "../api.h" +#ifndef STATIC_GLES3 + static void APIENTRY glcommon_debug( GLenum source, GLenum type, @@ -95,6 +97,16 @@ void glcommon_debug_object_label(GLenum identifier, GLuint name, const char *lab } } +#else + +void glcommon_debug_object_label(GLenum identifier, GLuint name, const char *label) { } + +void glcommon_debug_enable(void) { + log_error("OpenGL debugging is not supported on your system"); +} + +#endif + bool glcommon_debug_requested(void) { return env_get("TAISEI_GL_DEBUG", DEBUG_GL_DEFAULT); } diff --git a/src/renderer/glcommon/meson.build b/src/renderer/glcommon/meson.build index 70319eb3..2f6b5c05 100644 --- a/src/renderer/glcommon/meson.build +++ b/src/renderer/glcommon/meson.build @@ -6,4 +6,8 @@ r_glcommon_src = files( 'texture.c', ) -r_glcommon_libdeps = [dep_glad] +r_glcommon_libdeps = [] + +if not static_gles30 + r_glcommon_libdeps += dep_glad +endif diff --git a/src/renderer/glcommon/opengl.c b/src/renderer/glcommon/opengl.c index 9683e7a6..b2380e40 100644 --- a/src/renderer/glcommon/opengl.c +++ b/src/renderer/glcommon/opengl.c @@ -14,6 +14,25 @@ #include "debug.h" #include "shaders.h" +// undef extension abstraction macros +#undef glDebugMessageControl +#undef glDebugMessageCallback +#undef glObjectLabel +#undef glDrawArraysInstanced +#undef glDrawElementsInstanced +#undef glVertexAttribDivisor +#undef glDrawArraysInstancedBaseInstance +#undef glDrawElementsInstancedBaseInstance +#undef glDrawBuffers +#undef glClearTexImage +// #undef glClearTexSubImage +#undef glBindVertexArray +#undef glDeleteVertexArrays +#undef glGenVertexArrays +#undef glIsVertexArray +#undef glGetFloati_v +#undef glViewportIndexedfv + struct glext_s glext; typedef void (*glad_glproc_ptr)(void); @@ -95,11 +114,12 @@ ext_flag_t glcommon_require_extension(const char *ext) { } static void glcommon_ext_debug_output(void) { +#ifndef STATIC_GLES3 if( GL_ATLEAST(4, 3) - && (glext.DebugMessageCallback = glad_glDebugMessageCallback) - && (glext.DebugMessageControl = glad_glDebugMessageControl) - && (glext.ObjectLabel = glad_glObjectLabel) + && (glext.DebugMessageCallback = GL_FUNC(DebugMessageCallback)) + && (glext.DebugMessageControl = GL_FUNC(DebugMessageControl)) + && (glext.ObjectLabel = GL_FUNC(ObjectLabel)) ) { glext.debug_output = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); @@ -108,18 +128,18 @@ static void glcommon_ext_debug_output(void) { if(glext.version.is_es) { if((glext.debug_output = glcommon_check_extension("GL_KHR_debug")) - && (glext.DebugMessageCallback = glad_glDebugMessageCallbackKHR) - && (glext.DebugMessageControl = glad_glDebugMessageControlKHR) - && (glext.ObjectLabel = glad_glObjectLabelKHR) + && (glext.DebugMessageCallback = GL_FUNC(DebugMessageCallbackKHR)) + && (glext.DebugMessageControl = GL_FUNC(DebugMessageControlKHR)) + && (glext.ObjectLabel = GL_FUNC(ObjectLabelKHR)) ) { log_info("Using GL_KHR_debug"); return; } } else { if((glext.debug_output = glcommon_check_extension("GL_KHR_debug")) - && (glext.DebugMessageCallback = glad_glDebugMessageCallback) - && (glext.DebugMessageControl = glad_glDebugMessageControl) - && (glext.ObjectLabel = glad_glObjectLabel) + && (glext.DebugMessageCallback = GL_FUNC(DebugMessageCallback)) + && (glext.DebugMessageControl = GL_FUNC(DebugMessageControl)) + && (glext.ObjectLabel = GL_FUNC(ObjectLabel)) ) { log_info("Using GL_KHR_debug"); return; @@ -127,22 +147,24 @@ static void glcommon_ext_debug_output(void) { } if((glext.debug_output = glcommon_check_extension("GL_ARB_debug_output")) - && (glext.DebugMessageCallback = glad_glDebugMessageCallbackARB) - && (glext.DebugMessageControl = glad_glDebugMessageControlARB) + && (glext.DebugMessageCallback = GL_FUNC(DebugMessageCallbackARB)) + && (glext.DebugMessageControl = GL_FUNC(DebugMessageControlARB)) ) { log_info("Using GL_ARB_debug_output"); return; } +#endif glext.debug_output = 0; log_warn("Extension not supported"); } static void glcommon_ext_base_instance(void) { +#ifndef STATIC_GLES3 if( GL_ATLEAST(4, 2) - && (glext.DrawArraysInstancedBaseInstance = glad_glDrawArraysInstancedBaseInstance) - && (glext.DrawElementsInstancedBaseInstance = glad_glDrawElementsInstancedBaseInstance) + && (glext.DrawArraysInstancedBaseInstance = GL_FUNC(DrawArraysInstancedBaseInstance)) + && (glext.DrawElementsInstancedBaseInstance = GL_FUNC(DrawElementsInstancedBaseInstance)) ) { glext.base_instance = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); @@ -150,26 +172,32 @@ static void glcommon_ext_base_instance(void) { } if((glext.base_instance = glcommon_check_extension("GL_ARB_base_instance")) - && (glext.DrawArraysInstancedBaseInstance = glad_glDrawArraysInstancedBaseInstance) - && (glext.DrawElementsInstancedBaseInstance = glad_glDrawElementsInstancedBaseInstance) + && (glext.DrawArraysInstancedBaseInstance = GL_FUNC(DrawArraysInstancedBaseInstance)) + && (glext.DrawElementsInstancedBaseInstance = GL_FUNC(DrawElementsInstancedBaseInstance)) ) { log_info("Using GL_ARB_base_instance"); return; } if((glext.base_instance = glcommon_check_extension("GL_EXT_base_instance")) - && (glext.DrawArraysInstancedBaseInstance = glad_glDrawArraysInstancedBaseInstanceEXT) - && (glext.DrawElementsInstancedBaseInstance = glad_glDrawElementsInstancedBaseInstanceEXT) + && (glext.DrawArraysInstancedBaseInstance = GL_FUNC(DrawArraysInstancedBaseInstanceEXT)) + && (glext.DrawElementsInstancedBaseInstance = GL_FUNC(DrawElementsInstancedBaseInstanceEXT)) ) { log_info("Using GL_EXT_base_instance"); return; } +#endif glext.base_instance = 0; log_warn("Extension not supported"); } static void glcommon_ext_pixel_buffer_object(void) { +#ifdef STATIC_GLES3 + glext.pixel_buffer_object = TSGL_EXTFLAG_NATIVE; + log_info("Using core functionality"); + return; +#else // TODO: verify that these requirements are correct if(GL_ATLEAST(2, 0) || GLES_ATLEAST(3, 0)) { glext.pixel_buffer_object = TSGL_EXTFLAG_NATIVE; @@ -193,9 +221,15 @@ static void glcommon_ext_pixel_buffer_object(void) { glext.pixel_buffer_object = 0; log_warn("Extension not supported"); +#endif } static void glcommon_ext_depth_texture(void) { +#ifdef STATIC_GLES3 + glext.depth_texture = TSGL_EXTFLAG_NATIVE; + log_info("Using core functionality"); + return; +#else // TODO: detect this for core OpenGL properly if(!glext.version.is_es || GLES_ATLEAST(3, 0)) { glext.depth_texture = TSGL_EXTFLAG_NATIVE; @@ -218,14 +252,20 @@ static void glcommon_ext_depth_texture(void) { glext.depth_texture = 0; log_warn("Extension not supported"); +#endif } static void glcommon_ext_instanced_arrays(void) { +#ifdef STATIC_GLES3 + glext.instanced_arrays = TSGL_EXTFLAG_NATIVE; + log_info("Using core functionality"); + return; +#else if( (GL_ATLEAST(3, 3) || GLES_ATLEAST(3, 0)) - && (glext.DrawArraysInstanced = glad_glDrawArraysInstanced) - && (glext.DrawElementsInstanced = glad_glDrawElementsInstanced) - && (glext.VertexAttribDivisor = glad_glVertexAttribDivisor) + && (glext.DrawArraysInstanced = GL_FUNC(DrawArraysInstanced)) + && (glext.DrawElementsInstanced = GL_FUNC(DrawElementsInstanced)) + && (glext.VertexAttribDivisor = GL_FUNC(VertexAttribDivisor)) ) { glext.instanced_arrays = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); @@ -233,36 +273,36 @@ static void glcommon_ext_instanced_arrays(void) { } if((glext.instanced_arrays = glcommon_check_extension("GL_ARB_instanced_arrays")) - && (glext.DrawArraysInstanced = glad_glDrawArraysInstancedARB) - && (glext.DrawElementsInstanced = glad_glDrawElementsInstancedARB) - && (glext.VertexAttribDivisor = glad_glVertexAttribDivisorARB) + && (glext.DrawArraysInstanced = GL_FUNC(DrawArraysInstancedARB)) + && (glext.DrawElementsInstanced = GL_FUNC(DrawElementsInstancedARB)) + && (glext.VertexAttribDivisor = GL_FUNC(VertexAttribDivisorARB)) ) { log_info("Using GL_ARB_instanced_arrays (GL_ARB_draw_instanced assumed)"); return; } if((glext.instanced_arrays = glcommon_check_extension("GL_EXT_instanced_arrays")) - && (glext.DrawArraysInstanced = glad_glDrawArraysInstancedEXT) - && (glext.DrawElementsInstanced = glad_glDrawElementsInstancedEXT) - && (glext.VertexAttribDivisor = glad_glVertexAttribDivisorEXT) + && (glext.DrawArraysInstanced = GL_FUNC(DrawArraysInstancedEXT)) + && (glext.DrawElementsInstanced = GL_FUNC(DrawElementsInstancedEXT)) + && (glext.VertexAttribDivisor = GL_FUNC(VertexAttribDivisorEXT)) ) { log_info("Using GL_EXT_instanced_arrays"); return; } if((glext.instanced_arrays = glcommon_check_extension("GL_ANGLE_instanced_arrays")) - && (glext.DrawArraysInstanced = glad_glDrawArraysInstancedANGLE) - && (glext.DrawElementsInstanced = glad_glDrawElementsInstancedANGLE) - && (glext.VertexAttribDivisor = glad_glVertexAttribDivisorANGLE) + && (glext.DrawArraysInstanced = GL_FUNC(DrawArraysInstancedANGLE)) + && (glext.DrawElementsInstanced = GL_FUNC(DrawElementsInstancedANGLE)) + && (glext.VertexAttribDivisor = GL_FUNC(VertexAttribDivisorANGLE)) ) { log_info("Using GL_ANGLE_instanced_arrays"); return; } if((glext.instanced_arrays = glcommon_check_extension("GL_NV_instanced_arrays")) - && (glext.DrawArraysInstanced = glad_glDrawArraysInstancedNV) - && (glext.DrawElementsInstanced = glad_glDrawElementsInstancedNV) - && (glext.VertexAttribDivisor = glad_glVertexAttribDivisorNV) + && (glext.DrawArraysInstanced = GL_FUNC(DrawArraysInstancedNV)) + && (glext.DrawElementsInstanced = GL_FUNC(DrawElementsInstancedNV)) + && (glext.VertexAttribDivisor = GL_FUNC(VertexAttribDivisorNV)) ) { log_info("Using GL_NV_instanced_arrays (GL_NV_draw_instanced assumed)"); return; @@ -270,12 +310,18 @@ static void glcommon_ext_instanced_arrays(void) { glext.instanced_arrays = 0; log_warn("Extension not supported"); +#endif } static void glcommon_ext_draw_buffers(void) { +#ifdef STATIC_GLES3 + glext.draw_buffers = TSGL_EXTFLAG_NATIVE; + log_info("Using core functionality"); + return; +#else if( (GL_ATLEAST(2, 0) || GLES_ATLEAST(3, 0)) - && (glext.DrawBuffers = glad_glDrawBuffers) + && (glext.DrawBuffers = GL_FUNC(DrawBuffers)) ) { glext.draw_buffers = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); @@ -283,14 +329,14 @@ static void glcommon_ext_draw_buffers(void) { } if((glext.instanced_arrays = glcommon_check_extension("GL_ARB_draw_buffers")) - && (glext.DrawBuffers = glad_glDrawBuffersARB) + && (glext.DrawBuffers = GL_FUNC(DrawBuffersARB)) ) { log_info("Using GL_ARB_draw_buffers"); return; } if((glext.instanced_arrays = glcommon_check_extension("GL_EXT_draw_buffers")) - && (glext.DrawBuffers = glad_glDrawBuffersEXT) + && (glext.DrawBuffers = GL_FUNC(DrawBuffersEXT)) ) { log_info("Using GL_EXT_draw_buffers"); return; @@ -298,6 +344,7 @@ static void glcommon_ext_draw_buffers(void) { glext.draw_buffers = 0; log_warn("Extension not supported"); +#endif } static void glcommon_ext_texture_filter_anisotropic(void) { @@ -322,17 +369,36 @@ static void glcommon_ext_texture_filter_anisotropic(void) { } static void glcommon_ext_clear_texture(void) { - if(GL_ATLEAST(4, 4)) { +#ifdef STATIC_GLES3 + if((glext.clear_texture = glcommon_check_extension("GL_EXT_clear_texture"))) { + log_info("Using GL_EXT_clear_texture"); + return; + } +#else + if( + GL_ATLEAST(4, 4) + && (glext.ClearTexImage = GL_FUNC(ClearTexImage)) + ) { glext.clear_texture = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); return; } - if((glext.clear_texture = glcommon_check_extension("GL_ARB_clear_texture"))) { + if((glext.clear_texture = glcommon_check_extension("GL_ARB_clear_texture")) + && (glext.ClearTexImage = GL_FUNC(ClearTexImage)) + ) { log_info("Using GL_ARB_clear_texture"); return; } + if((glext.clear_texture = glcommon_check_extension("GL_EXT_clear_texture")) + && (glext.ClearTexImage = GL_FUNC(ClearTexImageEXT)) + ) { + log_info("Using GL_EXT_clear_texture"); + return; + } +#endif + glext.clear_texture = 0; log_warn("Extension not supported"); } @@ -434,11 +500,16 @@ static void glcommon_ext_float_blend(void) { } static void glcommon_ext_vertex_array_object(void) { +#ifdef STATIC_GLES3 + glext.vertex_array_object = TSGL_EXTFLAG_NATIVE; + log_info("Using core functionality"); + return; +#else if((GL_ATLEAST(3, 0) || GLES_ATLEAST(3, 0)) - && (glext.BindVertexArray = glad_glBindVertexArray) - && (glext.DeleteVertexArrays = glad_glDeleteVertexArrays) - && (glext.GenVertexArrays = glad_glGenVertexArrays) - && (glext.IsVertexArray = glad_glIsVertexArray) + && (glext.BindVertexArray = GL_FUNC(BindVertexArray)) + && (glext.DeleteVertexArrays = GL_FUNC(DeleteVertexArrays)) + && (glext.GenVertexArrays = GL_FUNC(GenVertexArrays)) + && (glext.IsVertexArray = GL_FUNC(IsVertexArray)) ) { glext.vertex_array_object = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); @@ -446,30 +517,30 @@ static void glcommon_ext_vertex_array_object(void) { } if((glext.vertex_array_object = glcommon_check_extension("GL_ARB_vertex_array_object")) - && (glext.BindVertexArray = glad_glBindVertexArray) - && (glext.DeleteVertexArrays = glad_glDeleteVertexArrays) - && (glext.GenVertexArrays = glad_glGenVertexArrays) - && (glext.IsVertexArray = glad_glIsVertexArray) + && (glext.BindVertexArray = GL_FUNC(BindVertexArray)) + && (glext.DeleteVertexArrays = GL_FUNC(DeleteVertexArrays)) + && (glext.GenVertexArrays = GL_FUNC(GenVertexArrays)) + && (glext.IsVertexArray = GL_FUNC(IsVertexArray)) ) { log_info("Using GL_ARB_vertex_array_object"); return; } if((glext.vertex_array_object = glcommon_check_extension("GL_OES_vertex_array_object")) - && (glext.BindVertexArray = glad_glBindVertexArrayOES) - && (glext.DeleteVertexArrays = glad_glDeleteVertexArraysOES) - && (glext.GenVertexArrays = glad_glGenVertexArraysOES) - && (glext.IsVertexArray = glad_glIsVertexArrayOES) + && (glext.BindVertexArray = GL_FUNC(BindVertexArrayOES)) + && (glext.DeleteVertexArrays = GL_FUNC(DeleteVertexArraysOES)) + && (glext.GenVertexArrays = GL_FUNC(GenVertexArraysOES)) + && (glext.IsVertexArray = GL_FUNC(IsVertexArrayOES)) ) { log_info("Using GL_OES_vertex_array_object"); return; } if((glext.vertex_array_object = glcommon_check_extension("GL_APPLE_vertex_array_object")) - && (glext.BindVertexArray = glad_glBindVertexArrayAPPLE) - && (glext.DeleteVertexArrays = glad_glDeleteVertexArraysAPPLE) - && (glext.GenVertexArrays = glad_glGenVertexArraysAPPLE) - && (glext.IsVertexArray = glad_glIsVertexArrayAPPLE) + && (glext.BindVertexArray = GL_FUNC(BindVertexArrayAPPLE)) + && (glext.DeleteVertexArrays = GL_FUNC(DeleteVertexArraysAPPLE)) + && (glext.GenVertexArrays = GL_FUNC(GenVertexArraysAPPLE)) + && (glext.IsVertexArray = GL_FUNC(IsVertexArrayAPPLE)) ) { log_info("Using GL_APPLE_vertex_array_object"); return; @@ -477,12 +548,14 @@ static void glcommon_ext_vertex_array_object(void) { glext.vertex_array_object = 0; log_warn("Extension not supported"); +#endif } static void glcommon_ext_viewport_array(void) { +#ifndef STATIC_GLES3 if((GL_ATLEAST(4, 1)) - && (glext.GetFloati_v = glad_glGetFloati_v) - && (glext.ViewportIndexedfv = glad_glViewportIndexedfv) + && (glext.GetFloati_v = GL_FUNC(GetFloati_v)) + && (glext.ViewportIndexedfv = GL_FUNC(ViewportIndexedfv)) ) { glext.viewport_array = TSGL_EXTFLAG_NATIVE; log_info("Using core functionality"); @@ -490,25 +563,27 @@ static void glcommon_ext_viewport_array(void) { } if((glext.viewport_array = glcommon_check_extension("GL_ARB_viewport_array")) - && (glext.GetFloati_v = glad_glGetFloati_v) - && (glext.ViewportIndexedfv = glad_glViewportIndexedfv) + && (glext.GetFloati_v = GL_FUNC(GetFloati_v)) + && (glext.ViewportIndexedfv = GL_FUNC(ViewportIndexedfv)) ) { log_info("Using GL_ARB_viewport_array"); return; } if((glext.viewport_array = glcommon_check_extension("GL_OES_viewport_array")) - && (glext.GetFloati_v = glad_glGetFloati_vOES) - && (glext.ViewportIndexedfv = glad_glViewportIndexedfvOES) + && (glext.GetFloati_v = GL_FUNC(GetFloati_vOES)) + && (glext.ViewportIndexedfv = GL_FUNC(ViewportIndexedfvOES)) ) { log_info("Using GL_OES_viewport_array"); return; } +#endif glext.viewport_array = 0; log_warn("Extension not supported"); } +#ifndef STATIC_GLES3 static APIENTRY GLvoid shim_glClearDepth(GLdouble depthval) { glClearDepthf(depthval); } @@ -516,21 +591,37 @@ static APIENTRY GLvoid shim_glClearDepth(GLdouble depthval) { static APIENTRY GLvoid shim_glClearDepthf(GLfloat depthval) { glClearDepth(depthval); } +#endif -void glcommon_check_extensions(void) { +void glcommon_check_capabilities(void) { memset(&glext, 0, sizeof(glext)); - glext.version.major = GLVersion.major; - glext.version.minor = GLVersion.minor; const char *glslv = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); const char *glv = (const char*)glGetString(GL_VERSION); +#ifdef STATIC_GLES3 + GLint major, minor; + glGetIntegerv(GL_MAJOR_VERSION, &major); + glGetIntegerv(GL_MINOR_VERSION, &minor); + glext.version.major = major; + glext.version.minor = minor; +#else + glext.version.major = GLVersion.major; + glext.version.minor = GLVersion.minor; +#endif + if(!glslv) { glslv = "None"; } glext.version.is_es = strstartswith(glv, "OpenGL ES"); +#ifdef STATIC_GLES3 + if(!GLES_ATLEAST(3, 0)) { + log_fatal("Compiled with STATIC_GLES3, but got a non-GLES3 context. Can't work with this"); + } +#endif + if(glext.version.is_es) { glext.version.is_ANGLE = strstr(glv, "(ANGLE "); glext.version.is_webgl = strstr(glv, "(WebGL "); @@ -582,6 +673,7 @@ void glcommon_check_extensions(void) { // GLES has only glClearDepthf // Core has only glClearDepth until GL 4.1 +#ifndef STATIC_GLES3 assert(glClearDepth || glClearDepthf); if(!glClearDepth) { @@ -591,11 +683,13 @@ void glcommon_check_extensions(void) { if(!glClearDepthf) { glClearDepthf = shim_glClearDepthf; } +#endif glcommon_build_shader_lang_table(); } void glcommon_load_library(void) { +#ifndef STATIC_GLES3 const char *lib = env_get("TAISEI_LIBGL", ""); if(!*lib) { @@ -605,14 +699,18 @@ void glcommon_load_library(void) { if(SDL_GL_LoadLibrary(lib) < 0) { log_fatal("SDL_GL_LoadLibrary() failed: %s", SDL_GetError()); } +#endif } void glcommon_unload_library(void) { +#ifndef STATIC_GLES3 SDL_GL_UnloadLibrary(); +#endif glcommon_free_shader_lang_table(); } void glcommon_load_functions(void) { +#ifndef STATIC_GLES3 int profile; if(SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile) < 0) { @@ -628,6 +726,7 @@ void glcommon_load_functions(void) { log_fatal("Failed to load OpenGL functions"); } } +#endif } void glcommon_setup_attributes(SDL_GLprofile profile, uint major, uint minor, SDL_GLcontextFlag ctxflags) { diff --git a/src/renderer/glcommon/opengl.h b/src/renderer/glcommon/opengl.h index a3ea9ca9..85560255 100644 --- a/src/renderer/glcommon/opengl.h +++ b/src/renderer/glcommon/opengl.h @@ -13,7 +13,47 @@ #include -#include "glad/glad.h" +#ifdef TAISEI_BUILDCONF_RENDERER_STATIC_GLES30 + #define STATIC_GLES3 +#endif + +#ifdef STATIC_GLES3 + #define GL_GLEXT_PROTOTYPES + #include + #include + + typedef PFNGLOBJECTLABELKHRPROC PFNGLOBJECTLABELPROC; + typedef PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC; + typedef PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC; + typedef PFNGLVIEWPORTINDEXEDFVOESPROC PFNGLVIEWPORTINDEXEDFVPROC; + typedef PFNGLGETFLOATI_VNVPROC PFNGLGETFLOATI_VPROC; + typedef PFNGLCLEARTEXIMAGEEXTPROC PFNGLCLEARTEXIMAGEPROC; + + #define GL_FUNC(func) (gl##func) + + #ifndef APIENTRY + #define APIENTRY GL_APIENTRY + #endif + + #define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES + #define GL_R16 GL_R16_EXT + #define GL_R16_SNORM GL_R16_SNORM_EXT + #define GL_RG16 GL_RG16_EXT + #define GL_RG16_SNORM GL_RG16_SNORM_EXT + #define GL_RGB10 GL_RGB10_EXT + #define GL_RGB16 GL_RGB16_EXT + #define GL_RGB16_SNORM GL_RGB16_SNORM_EXT + #define GL_RGBA16 GL_RGBA16_EXT + #define GL_RGBA16_SNORM GL_RGBA16_SNORM_EXT + #define GL_TEXTURE_MAX_ANISOTROPY GL_TEXTURE_MAX_ANISOTROPY_EXT + + #define glClearDepth glClearDepthf + #define glClearTexImage glClearTexImageEXT +#else + #include "glad/glad.h" + #define GL_FUNC(f) (glad_gl##f) +#endif + #include "assert.h" // NOTE: The ability to query supported GLSL versions was added in GL 4.3, @@ -53,7 +93,7 @@ extern struct glext_s glext; void glcommon_load_library(void); void glcommon_load_functions(void); -void glcommon_check_extensions(void); +void glcommon_check_capabilities(void); void glcommon_unload_library(void); ext_flag_t glcommon_check_extension(const char *ext); ext_flag_t glcommon_require_extension(const char *ext); @@ -95,6 +135,7 @@ struct glext_s { // debug_output // +#ifndef STATIC_GLES3 PFNGLDEBUGMESSAGECONTROLKHRPROC DebugMessageControl; #undef glDebugMessageControl #define glDebugMessageControl (glext.DebugMessageControl) @@ -106,9 +147,11 @@ struct glext_s { PFNGLOBJECTLABELPROC ObjectLabel; #undef glObjectLabel #define glObjectLabel (glext.ObjectLabel) +#endif // instanced_arrays +#ifndef STATIC_GLES3 PFNGLDRAWARRAYSINSTANCEDPROC DrawArraysInstanced; #undef glDrawArraysInstanced #define glDrawArraysInstanced (glext.DrawArraysInstanced) @@ -120,11 +163,13 @@ struct glext_s { PFNGLVERTEXATTRIBDIVISORPROC VertexAttribDivisor; #undef glVertexAttribDivisor #define glVertexAttribDivisor (glext.VertexAttribDivisor) +#endif // // base_instance // +#ifndef STATIC_GLES3 PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC DrawArraysInstancedBaseInstance; #undef glDrawArraysInstancedBaseInstance #define glDrawArraysInstancedBaseInstance (glext.DrawArraysInstancedBaseInstance) @@ -132,24 +177,29 @@ struct glext_s { PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC DrawElementsInstancedBaseInstance; #undef glDrawElementsInstancedBaseInstance #define glDrawElementsInstancedBaseInstance (glext.DrawElementsInstancedBaseInstance) +#endif // // draw_buffers // +#ifndef STATIC_GLES3 PFNGLDRAWBUFFERSPROC DrawBuffers; #undef glDrawBuffers #define glDrawBuffers (glext.DrawBuffers) +#endif // // clear_texture - // NOTE: no need for indirection here; the entrypoint names are the same. // - /* + +#ifndef STATIC_GLES3 PFNGLCLEARTEXIMAGEPROC ClearTexImage; #undef glClearTexImage #define glClearTexImage (glext.ClearTexImage) +#endif + /* PFNGLCLEARTEXSUBIMAGEPROC ClearTexSubImage; #undef glClearTexSubImage #define glClearTexSubImage (glext.ClearTexSubImage) @@ -159,6 +209,7 @@ struct glext_s { // vertex_array_object // +#ifndef STATIC_GLES3 PFNGLBINDVERTEXARRAYPROC BindVertexArray; #undef glBindVertexArray #define glBindVertexArray (glext.BindVertexArray) @@ -174,12 +225,14 @@ struct glext_s { PFNGLISVERTEXARRAYPROC IsVertexArray; #undef glIsVertexArray #define glIsVertexArray (glext.IsVertexArray) +#endif // // viewport_array // NOTE: only the subset we actually use is defined here // +#ifndef STATIC_GLES3 PFNGLGETFLOATI_VPROC GetFloati_v; #undef glGetFloati_v #define glGetFloati_v (glext.GetFloati_v) @@ -187,6 +240,7 @@ struct glext_s { PFNGLVIEWPORTINDEXEDFVPROC ViewportIndexedfv; #undef glViewportIndexedfv #define glViewportIndexedfv (glext.ViewportIndexedfv) +#endif }; #define GL_VERSION_INT(mjr, mnr) (((mjr) << 8) + (mnr)) diff --git a/src/renderer/glcommon/shaders.c b/src/renderer/glcommon/shaders.c index 329eb0d9..fba1e928 100644 --- a/src/renderer/glcommon/shaders.c +++ b/src/renderer/glcommon/shaders.c @@ -75,7 +75,10 @@ void glcommon_build_shader_lang_table(void) { // but it's not exposed by any extension. This is pretty silly. GLint num_versions = 0; - glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, &num_versions); + + if(!glext.version.is_webgl) { + glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, &num_versions); + } if(num_versions < 1) { glcommon_build_shader_lang_table_fallback(); diff --git a/src/renderer/glcommon/texture.c b/src/renderer/glcommon/texture.c index aced48ac..dd90b812 100644 --- a/src/renderer/glcommon/texture.c +++ b/src/renderer/glcommon/texture.c @@ -86,6 +86,7 @@ GLTextureFormatTuple* glcommon_find_best_pixformat(TextureType textype, PixmapFo GLenum glcommon_texture_base_format(GLenum internal_fmt) { switch(internal_fmt) { // NOTE: semi-generated code + #ifndef STATIC_GLES3 case GL_COMPRESSED_RED: return GL_RED; case GL_COMPRESSED_RED_RGTC1: return GL_RED; case GL_COMPRESSED_RG: return GL_RG; @@ -96,6 +97,14 @@ GLenum glcommon_texture_base_format(GLenum internal_fmt) { case GL_COMPRESSED_SIGNED_RG_RGTC2: return GL_RG; case GL_COMPRESSED_SRGB: return GL_RGB; case GL_COMPRESSED_SRGB_ALPHA: return GL_RGBA; + case GL_R3_G3_B2: return GL_RGB; + case GL_RGB12: return GL_RGB; + case GL_RGB4: return GL_RGB; + case GL_RGB5: return GL_RGB; + case GL_RGBA12: return GL_RGBA; + case GL_RGBA2: return GL_RGBA; + #endif + case GL_DEPTH24_STENCIL8: return GL_DEPTH_STENCIL; case GL_DEPTH32F_STENCIL8: return GL_DEPTH_STENCIL; case GL_DEPTH_COMPONENT16: return GL_DEPTH_COMPONENT; @@ -111,7 +120,6 @@ GLenum glcommon_texture_base_format(GLenum internal_fmt) { case GL_R32F: return GL_RED; case GL_R32I: return GL_RED; case GL_R32UI: return GL_RED; - case GL_R3_G3_B2: return GL_RGB; case GL_R8: return GL_RED; case GL_R8I: return GL_RED; case GL_R8UI: return GL_RED; @@ -131,7 +139,6 @@ GLenum glcommon_texture_base_format(GLenum internal_fmt) { case GL_RGB10: return GL_RGB; case GL_RGB10_A2: return GL_RGBA; case GL_RGB10_A2UI: return GL_RGBA; - case GL_RGB12: return GL_RGB; case GL_RGB16: return GL_RGB; case GL_RGB16F: return GL_RGB; case GL_RGB16I: return GL_RGB; @@ -140,21 +147,17 @@ GLenum glcommon_texture_base_format(GLenum internal_fmt) { case GL_RGB32F: return GL_RGB; case GL_RGB32I: return GL_RGB; case GL_RGB32UI: return GL_RGB; - case GL_RGB4: return GL_RGB; - case GL_RGB5: return GL_RGB; case GL_RGB5_A1: return GL_RGBA; case GL_RGB8: return GL_RGB; case GL_RGB8I: return GL_RGB; case GL_RGB8UI: return GL_RGB; case GL_RGB8_SNORM: return GL_RGB; case GL_RGB9_E5: return GL_RGB; - case GL_RGBA12: return GL_RGBA; case GL_RGBA16: return GL_RGBA; case GL_RGBA16F: return GL_RGBA; case GL_RGBA16I: return GL_RGBA; case GL_RGBA16UI: return GL_RGBA; case GL_RGBA16_SNORM: return GL_RGBA; - case GL_RGBA2: return GL_RGBA; case GL_RGBA32F: return GL_RGBA; case GL_RGBA32I: return GL_RGBA; case GL_RGBA32UI: return GL_RGBA; diff --git a/src/renderer/gles30/meson.build b/src/renderer/gles30/meson.build index 2f1ea323..11058cc3 100644 --- a/src/renderer/gles30/meson.build +++ b/src/renderer/gles30/meson.build @@ -5,3 +5,9 @@ r_gles30_src = files( r_gles30_deps = ['glescommon'] + r_glescommon_deps r_gles30_libdeps = r_glescommon_libdeps + +config.set('TAISEI_BUILDCONF_RENDERER_STATIC_GLES30', static_gles30) + +if static_gles30 + r_gles30_libdeps += [dependency('glesv2'), dependency('egl')] +endif diff --git a/src/renderer/meson.build b/src/renderer/meson.build index 4a5e284c..9b6555aa 100644 --- a/src/renderer/meson.build +++ b/src/renderer/meson.build @@ -5,17 +5,16 @@ modules = [ 'null', ] -if host_machine.system() == 'nx' - has_forced_renderer = true +if ['nx', 'emscripten'].contains(host_machine.system()) forced_renderer = 'gles30' else - has_forced_renderer = false forced_renderer = '' endif -default_renderer = has_forced_renderer ? forced_renderer : get_option('r_default') +default_renderer = (forced_renderer == '') ? get_option('r_default') : forced_renderer +static_gles30 = (host_machine.system() == 'emscripten') -if not has_forced_renderer and not get_option('r_@0@'.format(default_renderer)) +if forced_renderer == '' and not get_option('r_@0@'.format(default_renderer)) error('Default renderer \'@0@\' is not enabled. Enable it with -Dr_@0@=true, or set r_default to something else.'.format(default_renderer)) endif @@ -40,7 +39,7 @@ needed_deps = ['common'] r_macro = [] foreach m : modules - should_include = has_forced_renderer ? m == forced_renderer : get_option('r_@0@'.format(m)) + should_include = (forced_renderer == '') ? get_option('r_@0@'.format(m)) : (m == forced_renderer) if should_include renderer_src += get_variable('r_@0@_src'.format(m)) r_macro += ['R(@0@)'.format(m)] diff --git a/subprojects/glad/include/glad/glad.h b/subprojects/glad/include/glad/glad.h index d3bb6815..0beb4ba8 100644 --- a/subprojects/glad/include/glad/glad.h +++ b/subprojects/glad/include/glad/glad.h @@ -1,6 +1,6 @@ /* - OpenGL, OpenGL ES loader generated by glad 0.1.29 on Wed Apr 3 23:58:33 2019. + OpenGL, OpenGL ES loader generated by glad 0.1.29 on Sun Sep 8 09:42:56 2019. Language/Generator: C/C++ Specification: gl @@ -24,6 +24,7 @@ GL_ARB_viewport_array, GL_ATI_draw_buffers, GL_EXT_base_instance, + GL_EXT_clear_texture, GL_EXT_color_buffer_float, GL_EXT_draw_buffers, GL_EXT_draw_instanced, @@ -49,9 +50,9 @@ Reproducible: False Commandline: - --profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --no-loader --extensions="GL_ANGLE_depth_texture,GL_ANGLE_instanced_arrays,GL_ANGLE_translated_shader_source,GL_APPLE_vertex_array_object,GL_ARB_base_instance,GL_ARB_clear_texture,GL_ARB_debug_output,GL_ARB_depth_texture,GL_ARB_draw_buffers,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_pixel_buffer_object,GL_ARB_texture_filter_anisotropic,GL_ARB_vertex_array_object,GL_ARB_viewport_array,GL_ATI_draw_buffers,GL_EXT_base_instance,GL_EXT_color_buffer_float,GL_EXT_draw_buffers,GL_EXT_draw_instanced,GL_EXT_float_blend,GL_EXT_instanced_arrays,GL_EXT_pixel_buffer_object,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_norm16,GL_EXT_texture_rg,GL_KHR_debug,GL_NV_draw_instanced,GL_NV_instanced_arrays,GL_NV_pixel_buffer_object,GL_OES_depth_texture,GL_OES_texture_float_linear,GL_OES_texture_half_float_linear,GL_OES_vertex_array_object,GL_OES_viewport_array,GL_SGIX_depth_texture" + --profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --no-loader --extensions="GL_ANGLE_depth_texture,GL_ANGLE_instanced_arrays,GL_ANGLE_translated_shader_source,GL_APPLE_vertex_array_object,GL_ARB_base_instance,GL_ARB_clear_texture,GL_ARB_debug_output,GL_ARB_depth_texture,GL_ARB_draw_buffers,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_pixel_buffer_object,GL_ARB_texture_filter_anisotropic,GL_ARB_vertex_array_object,GL_ARB_viewport_array,GL_ATI_draw_buffers,GL_EXT_base_instance,GL_EXT_clear_texture,GL_EXT_color_buffer_float,GL_EXT_draw_buffers,GL_EXT_draw_instanced,GL_EXT_float_blend,GL_EXT_instanced_arrays,GL_EXT_pixel_buffer_object,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_norm16,GL_EXT_texture_rg,GL_KHR_debug,GL_NV_draw_instanced,GL_NV_instanced_arrays,GL_NV_pixel_buffer_object,GL_OES_depth_texture,GL_OES_texture_float_linear,GL_OES_texture_half_float_linear,GL_OES_vertex_array_object,GL_OES_viewport_array,GL_SGIX_depth_texture" Online: - https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_depth_texture&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_translated_shader_source&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_base_instance&extensions=GL_ARB_clear_texture&extensions=GL_ARB_debug_output&extensions=GL_ARB_depth_texture&extensions=GL_ARB_draw_buffers&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_pixel_buffer_object&extensions=GL_ARB_texture_filter_anisotropic&extensions=GL_ARB_vertex_array_object&extensions=GL_ARB_viewport_array&extensions=GL_ATI_draw_buffers&extensions=GL_EXT_base_instance&extensions=GL_EXT_color_buffer_float&extensions=GL_EXT_draw_buffers&extensions=GL_EXT_draw_instanced&extensions=GL_EXT_float_blend&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_pixel_buffer_object&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_norm16&extensions=GL_EXT_texture_rg&extensions=GL_KHR_debug&extensions=GL_NV_draw_instanced&extensions=GL_NV_instanced_arrays&extensions=GL_NV_pixel_buffer_object&extensions=GL_OES_depth_texture&extensions=GL_OES_texture_float_linear&extensions=GL_OES_texture_half_float_linear&extensions=GL_OES_vertex_array_object&extensions=GL_OES_viewport_array&extensions=GL_SGIX_depth_texture + https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_depth_texture&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_translated_shader_source&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_base_instance&extensions=GL_ARB_clear_texture&extensions=GL_ARB_debug_output&extensions=GL_ARB_depth_texture&extensions=GL_ARB_draw_buffers&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_pixel_buffer_object&extensions=GL_ARB_texture_filter_anisotropic&extensions=GL_ARB_vertex_array_object&extensions=GL_ARB_viewport_array&extensions=GL_ATI_draw_buffers&extensions=GL_EXT_base_instance&extensions=GL_EXT_clear_texture&extensions=GL_EXT_color_buffer_float&extensions=GL_EXT_draw_buffers&extensions=GL_EXT_draw_instanced&extensions=GL_EXT_float_blend&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_pixel_buffer_object&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_norm16&extensions=GL_EXT_texture_rg&extensions=GL_KHR_debug&extensions=GL_NV_draw_instanced&extensions=GL_NV_instanced_arrays&extensions=GL_NV_pixel_buffer_object&extensions=GL_OES_depth_texture&extensions=GL_OES_texture_float_linear&extensions=GL_OES_texture_half_float_linear&extensions=GL_OES_vertex_array_object&extensions=GL_OES_viewport_array&extensions=GL_SGIX_depth_texture */ @@ -2783,6 +2784,16 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC glad_glDrawElementsInstancedBaseVertexBaseInstanceEXT; #define glDrawElementsInstancedBaseVertexBaseInstanceEXT glad_glDrawElementsInstancedBaseVertexBaseInstanceEXT #endif +#ifndef GL_EXT_clear_texture +#define GL_EXT_clear_texture 1 +GLAPI int GLAD_GL_EXT_clear_texture; +typedef void (APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC)(GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARTEXIMAGEEXTPROC glad_glClearTexImageEXT; +#define glClearTexImageEXT glad_glClearTexImageEXT +typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARTEXSUBIMAGEEXTPROC glad_glClearTexSubImageEXT; +#define glClearTexSubImageEXT glad_glClearTexSubImageEXT +#endif #ifndef GL_EXT_color_buffer_float #define GL_EXT_color_buffer_float 1 GLAPI int GLAD_GL_EXT_color_buffer_float; diff --git a/subprojects/glad/meson.build b/subprojects/glad/meson.build index 202632a4..2c386505 100644 --- a/subprojects/glad/meson.build +++ b/subprojects/glad/meson.build @@ -20,6 +20,7 @@ glad_extensions = [ 'GL_ARB_viewport_array', 'GL_ATI_draw_buffers', 'GL_EXT_base_instance', + 'GL_EXT_clear_texture', 'GL_EXT_color_buffer_float', 'GL_EXT_draw_buffers', 'GL_EXT_draw_instanced', diff --git a/subprojects/glad/src/glad.c b/subprojects/glad/src/glad.c index 88da13a3..a8671e5e 100644 --- a/subprojects/glad/src/glad.c +++ b/subprojects/glad/src/glad.c @@ -1,6 +1,6 @@ /* - OpenGL, OpenGL ES loader generated by glad 0.1.29 on Wed Apr 3 23:58:33 2019. + OpenGL, OpenGL ES loader generated by glad 0.1.29 on Sun Sep 8 09:42:56 2019. Language/Generator: C/C++ Specification: gl @@ -24,6 +24,7 @@ GL_ARB_viewport_array, GL_ATI_draw_buffers, GL_EXT_base_instance, + GL_EXT_clear_texture, GL_EXT_color_buffer_float, GL_EXT_draw_buffers, GL_EXT_draw_instanced, @@ -49,9 +50,9 @@ Reproducible: False Commandline: - --profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --no-loader --extensions="GL_ANGLE_depth_texture,GL_ANGLE_instanced_arrays,GL_ANGLE_translated_shader_source,GL_APPLE_vertex_array_object,GL_ARB_base_instance,GL_ARB_clear_texture,GL_ARB_debug_output,GL_ARB_depth_texture,GL_ARB_draw_buffers,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_pixel_buffer_object,GL_ARB_texture_filter_anisotropic,GL_ARB_vertex_array_object,GL_ARB_viewport_array,GL_ATI_draw_buffers,GL_EXT_base_instance,GL_EXT_color_buffer_float,GL_EXT_draw_buffers,GL_EXT_draw_instanced,GL_EXT_float_blend,GL_EXT_instanced_arrays,GL_EXT_pixel_buffer_object,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_norm16,GL_EXT_texture_rg,GL_KHR_debug,GL_NV_draw_instanced,GL_NV_instanced_arrays,GL_NV_pixel_buffer_object,GL_OES_depth_texture,GL_OES_texture_float_linear,GL_OES_texture_half_float_linear,GL_OES_vertex_array_object,GL_OES_viewport_array,GL_SGIX_depth_texture" + --profile="core" --api="gl=3.3,gles2=3.0" --generator="c" --spec="gl" --no-loader --extensions="GL_ANGLE_depth_texture,GL_ANGLE_instanced_arrays,GL_ANGLE_translated_shader_source,GL_APPLE_vertex_array_object,GL_ARB_base_instance,GL_ARB_clear_texture,GL_ARB_debug_output,GL_ARB_depth_texture,GL_ARB_draw_buffers,GL_ARB_draw_instanced,GL_ARB_instanced_arrays,GL_ARB_pixel_buffer_object,GL_ARB_texture_filter_anisotropic,GL_ARB_vertex_array_object,GL_ARB_viewport_array,GL_ATI_draw_buffers,GL_EXT_base_instance,GL_EXT_clear_texture,GL_EXT_color_buffer_float,GL_EXT_draw_buffers,GL_EXT_draw_instanced,GL_EXT_float_blend,GL_EXT_instanced_arrays,GL_EXT_pixel_buffer_object,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_norm16,GL_EXT_texture_rg,GL_KHR_debug,GL_NV_draw_instanced,GL_NV_instanced_arrays,GL_NV_pixel_buffer_object,GL_OES_depth_texture,GL_OES_texture_float_linear,GL_OES_texture_half_float_linear,GL_OES_vertex_array_object,GL_OES_viewport_array,GL_SGIX_depth_texture" Online: - https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_depth_texture&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_translated_shader_source&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_base_instance&extensions=GL_ARB_clear_texture&extensions=GL_ARB_debug_output&extensions=GL_ARB_depth_texture&extensions=GL_ARB_draw_buffers&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_pixel_buffer_object&extensions=GL_ARB_texture_filter_anisotropic&extensions=GL_ARB_vertex_array_object&extensions=GL_ARB_viewport_array&extensions=GL_ATI_draw_buffers&extensions=GL_EXT_base_instance&extensions=GL_EXT_color_buffer_float&extensions=GL_EXT_draw_buffers&extensions=GL_EXT_draw_instanced&extensions=GL_EXT_float_blend&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_pixel_buffer_object&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_norm16&extensions=GL_EXT_texture_rg&extensions=GL_KHR_debug&extensions=GL_NV_draw_instanced&extensions=GL_NV_instanced_arrays&extensions=GL_NV_pixel_buffer_object&extensions=GL_OES_depth_texture&extensions=GL_OES_texture_float_linear&extensions=GL_OES_texture_half_float_linear&extensions=GL_OES_vertex_array_object&extensions=GL_OES_viewport_array&extensions=GL_SGIX_depth_texture + https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D3.3&api=gles2%3D3.0&extensions=GL_ANGLE_depth_texture&extensions=GL_ANGLE_instanced_arrays&extensions=GL_ANGLE_translated_shader_source&extensions=GL_APPLE_vertex_array_object&extensions=GL_ARB_base_instance&extensions=GL_ARB_clear_texture&extensions=GL_ARB_debug_output&extensions=GL_ARB_depth_texture&extensions=GL_ARB_draw_buffers&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_pixel_buffer_object&extensions=GL_ARB_texture_filter_anisotropic&extensions=GL_ARB_vertex_array_object&extensions=GL_ARB_viewport_array&extensions=GL_ATI_draw_buffers&extensions=GL_EXT_base_instance&extensions=GL_EXT_clear_texture&extensions=GL_EXT_color_buffer_float&extensions=GL_EXT_draw_buffers&extensions=GL_EXT_draw_instanced&extensions=GL_EXT_float_blend&extensions=GL_EXT_instanced_arrays&extensions=GL_EXT_pixel_buffer_object&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_EXT_texture_norm16&extensions=GL_EXT_texture_rg&extensions=GL_KHR_debug&extensions=GL_NV_draw_instanced&extensions=GL_NV_instanced_arrays&extensions=GL_NV_pixel_buffer_object&extensions=GL_OES_depth_texture&extensions=GL_OES_texture_float_linear&extensions=GL_OES_texture_half_float_linear&extensions=GL_OES_vertex_array_object&extensions=GL_OES_viewport_array&extensions=GL_SGIX_depth_texture */ #include @@ -582,6 +583,7 @@ int GLAD_GL_ARB_vertex_array_object = 0; int GLAD_GL_ARB_viewport_array = 0; int GLAD_GL_ATI_draw_buffers = 0; int GLAD_GL_EXT_base_instance = 0; +int GLAD_GL_EXT_clear_texture = 0; int GLAD_GL_EXT_color_buffer_float = 0; int GLAD_GL_EXT_draw_buffers = 0; int GLAD_GL_EXT_draw_instanced = 0; @@ -660,6 +662,8 @@ PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC glad_glGetTranslatedShaderSourceANGLE = PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC glad_glDrawArraysInstancedBaseInstanceEXT = NULL; PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC glad_glDrawElementsInstancedBaseInstanceEXT = NULL; PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC glad_glDrawElementsInstancedBaseVertexBaseInstanceEXT = NULL; +PFNGLCLEARTEXIMAGEEXTPROC glad_glClearTexImageEXT = NULL; +PFNGLCLEARTEXSUBIMAGEEXTPROC glad_glClearTexSubImageEXT = NULL; PFNGLDRAWBUFFERSEXTPROC glad_glDrawBuffersEXT = NULL; PFNGLVERTEXATTRIBDIVISOREXTPROC glad_glVertexAttribDivisorEXT = NULL; PFNGLDRAWARRAYSINSTANCEDNVPROC glad_glDrawArraysInstancedNV = NULL; @@ -1567,6 +1571,11 @@ static void load_GL_EXT_base_instance(GLADloadproc load) { glad_glDrawElementsInstancedBaseInstanceEXT = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC)load("glDrawElementsInstancedBaseInstanceEXT"); glad_glDrawElementsInstancedBaseVertexBaseInstanceEXT = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC)load("glDrawElementsInstancedBaseVertexBaseInstanceEXT"); } +static void load_GL_EXT_clear_texture(GLADloadproc load) { + if(!GLAD_GL_EXT_clear_texture) return; + glad_glClearTexImageEXT = (PFNGLCLEARTEXIMAGEEXTPROC)load("glClearTexImageEXT"); + glad_glClearTexSubImageEXT = (PFNGLCLEARTEXSUBIMAGEEXTPROC)load("glClearTexSubImageEXT"); +} static void load_GL_EXT_draw_buffers(GLADloadproc load) { if(!GLAD_GL_EXT_draw_buffers) return; glad_glDrawBuffersEXT = (PFNGLDRAWBUFFERSEXTPROC)load("glDrawBuffersEXT"); @@ -1614,6 +1623,7 @@ static int find_extensionsGLES2(void) { GLAD_GL_ANGLE_instanced_arrays = has_ext("GL_ANGLE_instanced_arrays"); GLAD_GL_ANGLE_translated_shader_source = has_ext("GL_ANGLE_translated_shader_source"); GLAD_GL_EXT_base_instance = has_ext("GL_EXT_base_instance"); + GLAD_GL_EXT_clear_texture = has_ext("GL_EXT_clear_texture"); GLAD_GL_EXT_color_buffer_float = has_ext("GL_EXT_color_buffer_float"); GLAD_GL_EXT_draw_buffers = has_ext("GL_EXT_draw_buffers"); GLAD_GL_EXT_draw_instanced = has_ext("GL_EXT_draw_instanced"); @@ -1692,6 +1702,7 @@ int gladLoadGLES2Loader(GLADloadproc load) { load_GL_ANGLE_instanced_arrays(load); load_GL_ANGLE_translated_shader_source(load); load_GL_EXT_base_instance(load); + load_GL_EXT_clear_texture(load); load_GL_EXT_draw_buffers(load); load_GL_EXT_draw_instanced(load); load_GL_EXT_instanced_arrays(load);