Some gles20 progress; minor gl refactor and fixes
This commit is contained in:
parent
923f158ff3
commit
1365293334
36 changed files with 553 additions and 163 deletions
|
@ -57,3 +57,8 @@ void _r_backend_init(void) {
|
|||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void _r_backend_inherit(RendererBackend *dest, const RendererBackend *base) {
|
||||
static const uint num_funcs = sizeof(dest->funcs)/sizeof(dest->funcs.init);
|
||||
inherit_missing_pointers(num_funcs, (void**)&dest->funcs, (void**)&base->funcs);
|
||||
}
|
||||
|
|
|
@ -128,3 +128,4 @@ extern RendererBackend *_r_backends[];
|
|||
extern RendererBackend _r_backend;
|
||||
|
||||
void _r_backend_init(void);
|
||||
void _r_backend_inherit(RendererBackend *dest, const RendererBackend *base);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "common_buffer.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
|
||||
#define STREAM_CBUF(rw) ((CommonBuffer*)rw)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../glcommon/debug.h"
|
||||
|
||||
static GLuint r_attachment_to_gl_attachment[] = {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../api.h"
|
||||
#include "../common/matstack.h"
|
||||
#include "../common/backend.h"
|
||||
|
@ -119,15 +119,6 @@ static struct {
|
|||
#endif
|
||||
} R;
|
||||
|
||||
static GLenum prim_to_gl_prim[] = {
|
||||
[PRIM_POINTS] = GL_POINTS,
|
||||
[PRIM_LINE_STRIP] = GL_LINE_STRIP,
|
||||
[PRIM_LINE_LOOP] = GL_LINE_LOOP,
|
||||
[PRIM_LINES] = GL_LINES,
|
||||
[PRIM_TRIANGLE_STRIP] = GL_TRIANGLE_STRIP,
|
||||
[PRIM_TRIANGLES] = GL_TRIANGLES,
|
||||
};
|
||||
|
||||
/*
|
||||
* Internal functions
|
||||
*/
|
||||
|
@ -345,6 +336,20 @@ static void gl33_sync_state(void) {
|
|||
* Exported functions
|
||||
*/
|
||||
|
||||
GLenum gl33_prim_to_gl_prim(Primitive prim) {
|
||||
static GLenum map[] = {
|
||||
[PRIM_POINTS] = GL_POINTS,
|
||||
[PRIM_LINE_STRIP] = GL_LINE_STRIP,
|
||||
[PRIM_LINE_LOOP] = GL_LINE_LOOP,
|
||||
[PRIM_LINES] = GL_LINES,
|
||||
[PRIM_TRIANGLE_STRIP] = GL_TRIANGLE_STRIP,
|
||||
[PRIM_TRIANGLES] = GL_TRIANGLES,
|
||||
};
|
||||
|
||||
assert((uint)prim < sizeof(map)/sizeof(*map));
|
||||
return map[prim];
|
||||
}
|
||||
|
||||
void gl33_sync_capabilities(void) {
|
||||
if(R.capabilities.active == R.capabilities.pending) {
|
||||
return;
|
||||
|
@ -853,18 +858,31 @@ static const Color* gl33_color_current(void) {
|
|||
return &R.color;
|
||||
}
|
||||
|
||||
static void gl33_draw(VertexArray *varr, Primitive prim, uint firstvert, uint count, uint instances, uint base_instance) {
|
||||
assert(count > 0);
|
||||
assert((uint)prim < sizeof(prim_to_gl_prim)/sizeof(GLenum));
|
||||
GLuint gl_prim = prim_to_gl_prim[prim];
|
||||
|
||||
gl33_stats_post_draw();
|
||||
void gl33_begin_draw(VertexArray *varr, void **state) {
|
||||
gl33_stats_pre_draw();
|
||||
r_flush_sprites();
|
||||
GLuint prev_vao = gl33_vao_current();
|
||||
gl33_bind_vao(varr->gl_handle);
|
||||
gl33_sync_state();
|
||||
gl33_vertex_array_flush_buffers(varr);
|
||||
*state = (void*)(uintptr_t)prev_vao;
|
||||
}
|
||||
|
||||
void gl33_end_draw(void *state) {
|
||||
if(R.framebuffer.active) {
|
||||
gl33_framebuffer_taint(R.framebuffer.active);
|
||||
}
|
||||
|
||||
gl33_bind_vao((uintptr_t)state);
|
||||
gl33_stats_post_draw();
|
||||
}
|
||||
|
||||
static void gl33_draw(VertexArray *varr, Primitive prim, uint firstvert, uint count, uint instances, uint base_instance) {
|
||||
assert(count > 0);
|
||||
GLuint gl_prim = gl33_prim_to_gl_prim(prim);
|
||||
|
||||
void *state;
|
||||
gl33_begin_draw(varr, &state);
|
||||
|
||||
if(instances) {
|
||||
if(base_instance) {
|
||||
|
@ -876,27 +894,16 @@ static void gl33_draw(VertexArray *varr, Primitive prim, uint firstvert, uint co
|
|||
glDrawArrays(gl_prim, firstvert, count);
|
||||
}
|
||||
|
||||
if(R.framebuffer.active) {
|
||||
gl33_framebuffer_taint(R.framebuffer.active);
|
||||
}
|
||||
|
||||
gl33_bind_vao(prev_vao);
|
||||
gl33_stats_post_draw();
|
||||
gl33_end_draw(state);
|
||||
}
|
||||
|
||||
static void gl33_draw_indexed(VertexArray *varr, Primitive prim, uint firstidx, uint count, uint instances, uint base_instance) {
|
||||
assert(count > 0);
|
||||
assert((uint)prim < sizeof(prim_to_gl_prim)/sizeof(GLenum));
|
||||
assert(varr->index_attachment != NULL);
|
||||
GLuint gl_prim = prim_to_gl_prim[prim];
|
||||
GLuint gl_prim = gl33_prim_to_gl_prim(prim);
|
||||
|
||||
gl33_stats_post_draw();
|
||||
gl33_stats_pre_draw();
|
||||
r_flush_sprites();
|
||||
GLuint prev_vao = gl33_vao_current();
|
||||
gl33_bind_vao(varr->gl_handle);
|
||||
gl33_sync_state();
|
||||
gl33_vertex_array_flush_buffers(varr);
|
||||
void *state;
|
||||
gl33_begin_draw(varr, &state);
|
||||
|
||||
uintptr_t iofs = firstidx * sizeof(gl33_ibo_index_t);
|
||||
|
||||
|
@ -910,12 +917,7 @@ static void gl33_draw_indexed(VertexArray *varr, Primitive prim, uint firstidx,
|
|||
glDrawElements(gl_prim, count, GL33_IBO_GL_DATATYPE, (void*)iofs);
|
||||
}
|
||||
|
||||
if(R.framebuffer.active) {
|
||||
gl33_framebuffer_taint(R.framebuffer.active);
|
||||
}
|
||||
|
||||
gl33_bind_vao(prev_vao);
|
||||
gl33_stats_post_draw();
|
||||
gl33_end_draw(state);
|
||||
}
|
||||
|
||||
static void gl33_framebuffer(Framebuffer *fb) {
|
|
@ -27,6 +27,10 @@ typedef enum BufferBindingIndex {
|
|||
|
||||
// Internal helper functions
|
||||
|
||||
GLenum gl33_prim_to_gl_prim(Primitive prim);
|
||||
void gl33_begin_draw(VertexArray *varr, void **state);
|
||||
void gl33_end_draw(void *state);
|
||||
|
||||
uint gl33_bind_texture(Texture *texture, bool for_rendering);
|
||||
|
||||
void gl33_bind_vao(GLuint vao);
|
|
@ -9,7 +9,7 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "index_buffer.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../glcommon/debug.h"
|
||||
|
||||
IndexBuffer* gl33_index_buffer_create(size_t max_elements) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
r_gl33_src = files(
|
||||
'common_buffer.c',
|
||||
'core.c',
|
||||
'framebuffer.c',
|
||||
'gl33.c',
|
||||
'index_buffer.c',
|
||||
'shader_object.c',
|
||||
'shader_program.c',
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "util.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "shader_object.h"
|
||||
#include "../glcommon/debug.h"
|
||||
#include "../glcommon/shaders.h"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "shader_program.h"
|
||||
#include "shader_object.h"
|
||||
#include "../glcommon/debug.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "texture.h"
|
||||
#include "../api.h"
|
||||
#include "opengl.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../glcommon/debug.h"
|
||||
|
||||
static GLuint r_filter_to_gl_filter(TextureFilterMode mode) {
|
||||
|
@ -200,7 +200,10 @@ Texture* gl33_texture_create(const TextureParams *params) {
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, r_wrap_to_gl_wrap(p->wrap.t));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, r_filter_to_gl_filter(p->filter.min));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, r_filter_to_gl_filter(p->filter.mag));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, p->mipmaps - 1);
|
||||
|
||||
if(!glext.version.is_es || GLES_ATLEAST(3, 0)) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, p->mipmaps - 1);
|
||||
}
|
||||
|
||||
if(glext.texture_filter_anisotropic) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY, p->anisotropy);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../api.h"
|
||||
#include "resource/resource.h"
|
||||
#include "resource/texture.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "vertex_array.h"
|
||||
#include "vertex_buffer.h"
|
||||
#include "index_buffer.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../glcommon/debug.h"
|
||||
|
||||
static GLenum va_type_to_gl_type[] = {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "vertex_buffer.h"
|
||||
#include "core.h"
|
||||
#include "gl33.h"
|
||||
#include "../glcommon/debug.h"
|
||||
|
||||
VertexBuffer* gl33_vertex_buffer_create(size_t capacity, void *data) {
|
||||
|
|
|
@ -345,7 +345,7 @@ static void glcommon_ext_texture_norm16(void) {
|
|||
}
|
||||
|
||||
if((glext.texture_norm16 = glcommon_check_extension("GL_EXT_texture_norm16"))) {
|
||||
log_info("Using core GL_EXT_texture_norm16");
|
||||
log_info("Using GL_EXT_texture_norm16");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ static void glcommon_ext_texture_rg(void) {
|
|||
}
|
||||
|
||||
if((glext.texture_rg = glcommon_check_extension("GL_EXT_texture_rg"))) {
|
||||
log_info("Using core GL_EXT_texture_rg");
|
||||
log_info("Using GL_EXT_texture_rg");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ static void glcommon_ext_texture_float_linear(void) {
|
|||
}
|
||||
|
||||
if((glext.texture_float_linear = glcommon_check_extension("GL_OES_texture_float_linear"))) {
|
||||
log_info("Using core GL_OES_texture_float_linear");
|
||||
log_info("Using GL_OES_texture_float_linear");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ static void glcommon_ext_texture_half_float_linear(void) {
|
|||
}
|
||||
|
||||
if((glext.texture_half_float_linear = glcommon_check_extension("GL_OES_texture_half_float_linear"))) {
|
||||
log_info("Using core GL_OES_texture_half_float_linear");
|
||||
log_info("Using GL_OES_texture_half_float_linear");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ static void glcommon_ext_color_buffer_float(void) {
|
|||
}
|
||||
|
||||
if((glext.color_buffer_float = glcommon_check_extension("GL_EXT_color_buffer_float"))) {
|
||||
log_info("Using core GL_EXT_color_buffer_float");
|
||||
log_info("Using GL_EXT_color_buffer_float");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ static void glcommon_ext_float_blend(void) {
|
|||
}
|
||||
|
||||
if((glext.float_blend = glcommon_check_extension("GL_EXT_float_blend"))) {
|
||||
log_info("Using core GL_EXT_float_blend");
|
||||
log_info("Using GL_EXT_float_blend");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -433,6 +433,52 @@ static void glcommon_ext_float_blend(void) {
|
|||
log_warn("Extension not supported");
|
||||
}
|
||||
|
||||
static void glcommon_ext_vertex_array_object(void) {
|
||||
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.vertex_array_object = TSGL_EXTFLAG_NATIVE;
|
||||
log_info("Using core functionality");
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
) {
|
||||
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)
|
||||
) {
|
||||
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)
|
||||
) {
|
||||
log_info("Using GL_APPLE_vertex_array_object");
|
||||
return;
|
||||
}
|
||||
|
||||
glext.vertex_array_object = 0;
|
||||
log_warn("Extension not supported");
|
||||
}
|
||||
|
||||
static void shim_glClearDepth(GLdouble depthval) {
|
||||
glClearDepthf(depthval);
|
||||
}
|
||||
|
@ -500,6 +546,7 @@ void glcommon_check_extensions(void) {
|
|||
glcommon_ext_texture_half_float_linear();
|
||||
glcommon_ext_texture_norm16();
|
||||
glcommon_ext_texture_rg();
|
||||
glcommon_ext_vertex_array_object();
|
||||
|
||||
// GLES has only glClearDepthf
|
||||
// Core has only glClearDepth until GL 4.1
|
||||
|
|
|
@ -70,20 +70,21 @@ struct glext_s {
|
|||
bool is_ANGLE;
|
||||
} version;
|
||||
|
||||
ext_flag_t debug_output;
|
||||
ext_flag_t instanced_arrays;
|
||||
ext_flag_t base_instance;
|
||||
ext_flag_t pixel_buffer_object;
|
||||
ext_flag_t clear_texture;
|
||||
ext_flag_t color_buffer_float;
|
||||
ext_flag_t debug_output;
|
||||
ext_flag_t depth_texture;
|
||||
ext_flag_t draw_buffers;
|
||||
ext_flag_t float_blend;
|
||||
ext_flag_t instanced_arrays;
|
||||
ext_flag_t pixel_buffer_object;
|
||||
ext_flag_t texture_filter_anisotropic;
|
||||
ext_flag_t clear_texture;
|
||||
ext_flag_t texture_norm16;
|
||||
ext_flag_t texture_rg;
|
||||
ext_flag_t texture_float_linear;
|
||||
ext_flag_t texture_half_float_linear;
|
||||
ext_flag_t color_buffer_float;
|
||||
ext_flag_t float_blend;
|
||||
ext_flag_t texture_norm16;
|
||||
ext_flag_t texture_rg;
|
||||
ext_flag_t vertex_array_object;
|
||||
|
||||
//
|
||||
// debug_output
|
||||
|
@ -148,6 +149,26 @@ struct glext_s {
|
|||
#undef glClearTexSubImage
|
||||
#define glClearTexSubImage (glext.ClearTexSubImage)
|
||||
*/
|
||||
|
||||
//
|
||||
// vertex_array_object
|
||||
//
|
||||
|
||||
PFNGLBINDVERTEXARRAYPROC BindVertexArray;
|
||||
#undef glBindVertexArray
|
||||
#define glBindVertexArray (glext.BindVertexArray)
|
||||
|
||||
PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
|
||||
#undef glDeleteVertexArrays
|
||||
#define glDeleteVertexArrays (glext.DeleteVertexArrays)
|
||||
|
||||
PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
|
||||
#undef glGenVertexArrays
|
||||
#define glGenVertexArrays (glext.GenVertexArrays)
|
||||
|
||||
PFNGLISVERTEXARRAYPROC IsVertexArray;
|
||||
#undef glIsVertexArray
|
||||
#define glIsVertexArray (glext.IsVertexArray)
|
||||
};
|
||||
|
||||
#define GL_VERSION_INT(mjr, mnr) (((mjr) << 8) + (mnr))
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "texture.h"
|
||||
#include "../gl33/core.h"
|
||||
#include "../glcommon/debug.h"
|
||||
#include "../glcommon/vtable.h"
|
||||
|
||||
static void gles20_init_context(SDL_Window *w) {
|
||||
GLVT_OF(_r_backend_gl33).init_context(w);
|
||||
gles20_init_texformats_table();
|
||||
// glcommon_require_extension("GL_OES_depth_texture");
|
||||
}
|
||||
|
||||
static void gles_init(RendererBackend *gles_backend, int major, int minor) {
|
||||
// omg inheritance
|
||||
RendererFuncs original_funcs;
|
||||
memcpy(&original_funcs, &gles_backend->funcs, sizeof(original_funcs));
|
||||
memcpy(&gles_backend->funcs, &_r_backend_gl33.funcs, sizeof(gles_backend->funcs));
|
||||
gles_backend->funcs.init = original_funcs.init;
|
||||
gles_backend->funcs.screenshot = original_funcs.screenshot;
|
||||
|
||||
glcommon_setup_attributes(SDL_GL_CONTEXT_PROFILE_ES, major, minor, 0);
|
||||
glcommon_load_library();
|
||||
}
|
||||
|
||||
static void gles20_init(void) {
|
||||
gles_init(&_r_backend_gles20, 2, 0);
|
||||
}
|
||||
|
||||
static void gles30_init(void) {
|
||||
gles_init(&_r_backend_gles30, 3, 0);
|
||||
}
|
||||
|
||||
static bool gles20_screenshot(Pixmap *out) {
|
||||
IntRect vp;
|
||||
r_framebuffer_viewport_current(NULL, &vp);
|
||||
out->width = vp.w;
|
||||
out->height = vp.h;
|
||||
out->format = PIXMAP_FORMAT_RGBA8;
|
||||
out->origin = PIXMAP_ORIGIN_BOTTOMLEFT;
|
||||
out->data.untyped = pixmap_alloc_buffer_for_copy(out);
|
||||
glReadPixels(vp.x, vp.y, vp.w, vp.h, GL_RGBA, GL_UNSIGNED_BYTE, out->data.untyped);
|
||||
return true;
|
||||
}
|
||||
|
||||
RendererBackend _r_backend_gles20 = {
|
||||
.name = "gles20",
|
||||
.funcs = {
|
||||
.init = gles20_init,
|
||||
.screenshot = gles20_screenshot,
|
||||
},
|
||||
.custom = &(GLBackendData) {
|
||||
.vtable = {
|
||||
.texture_type_info = gles20_texture_type_info,
|
||||
.init_context = gles20_init_context,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
RendererBackend _r_backend_gles30 = {
|
||||
.name = "gles30",
|
||||
.funcs = {
|
||||
.init = gles30_init,
|
||||
.screenshot = gles20_screenshot,
|
||||
},
|
||||
.custom = &(GLBackendData) {
|
||||
.vtable = {
|
||||
.texture_type_info = gles20_texture_type_info,
|
||||
.init_context = gles20_init_context,
|
||||
}
|
||||
},
|
||||
};
|
80
src/renderer/gles20/gles20.c
Normal file
80
src/renderer/gles20/gles20.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "gles20.h"
|
||||
#include "../glescommon/gles.h"
|
||||
#include "../glescommon/texture.h"
|
||||
#include "../gl33/gl33.h"
|
||||
#include "../gl33/vertex_array.h"
|
||||
#include "index_buffer.h"
|
||||
|
||||
static void gles20_init(void) {
|
||||
gles_init(&_r_backend_gles20, 2, 0);
|
||||
}
|
||||
|
||||
static void gles20_init_context(SDL_Window *w) {
|
||||
gles_init_context(w);
|
||||
|
||||
if(!glext.vertex_array_object) {
|
||||
log_fatal("GL doesn't support VAOs; no fallback implemented yet, sorry.");
|
||||
}
|
||||
}
|
||||
|
||||
static void gles20_draw_indexed(VertexArray *varr, Primitive prim, uint firstidx, uint count, uint instances, uint base_instance) {
|
||||
assert(count > 0);
|
||||
assert(varr->index_attachment != NULL);
|
||||
GLuint gl_prim = gl33_prim_to_gl_prim(prim);
|
||||
|
||||
void *state;
|
||||
gl33_begin_draw(varr, &state);
|
||||
|
||||
if(instances) {
|
||||
if(base_instance) {
|
||||
glDrawElementsInstancedBaseInstance(gl_prim, count, GLES20_IBO_GL_DATATYPE, varr->index_attachment->elements, instances, base_instance);
|
||||
} else {
|
||||
glDrawElementsInstanced(gl_prim, count, GLES20_IBO_GL_DATATYPE, varr->index_attachment->elements, instances);
|
||||
}
|
||||
} else {
|
||||
glDrawElements(gl_prim, count, GLES20_IBO_GL_DATATYPE, varr->index_attachment->elements);
|
||||
}
|
||||
|
||||
gl33_end_draw(state);
|
||||
}
|
||||
|
||||
static void gles20_vertex_array_attach_index_buffer(VertexArray *varr, IndexBuffer *ibuf) {
|
||||
// We override this function to prevent setting the index buffer dirty bit.
|
||||
// Otherwise the GL33 VAO code would try to dereference index_attachment as
|
||||
// another kind of struct (the GL33 IBO implementation).
|
||||
varr->index_attachment = ibuf;
|
||||
}
|
||||
|
||||
RendererBackend _r_backend_gles20 = {
|
||||
.name = "gles20",
|
||||
.funcs = {
|
||||
.init = gles20_init,
|
||||
.screenshot = gles_screenshot,
|
||||
.index_buffer_create = gles20_index_buffer_create,
|
||||
.index_buffer_get_capacity = gles20_index_buffer_get_capacity,
|
||||
.index_buffer_get_debug_label = gles20_index_buffer_get_debug_label,
|
||||
.index_buffer_set_debug_label = gles20_index_buffer_set_debug_label,
|
||||
.index_buffer_set_offset = gles20_index_buffer_set_offset,
|
||||
.index_buffer_get_offset = gles20_index_buffer_get_offset,
|
||||
.index_buffer_add_indices = gles20_index_buffer_add_indices,
|
||||
.index_buffer_destroy = gles20_index_buffer_destroy,
|
||||
.draw_indexed = gles20_draw_indexed,
|
||||
.vertex_array_attach_index_buffer = gles20_vertex_array_attach_index_buffer,
|
||||
},
|
||||
.custom = &(GLBackendData) {
|
||||
.vtable = {
|
||||
.texture_type_info = gles_texture_type_info,
|
||||
.init_context = gles20_init_context,
|
||||
}
|
||||
},
|
||||
};
|
|
@ -6,9 +6,9 @@
|
|||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "../common/backend.h"
|
||||
|
||||
extern RendererBackend _r_backend_gles20;
|
||||
extern RendererBackend _r_backend_gles30;
|
61
src/renderer/gles20/index_buffer.c
Normal file
61
src/renderer/gles20/index_buffer.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "index_buffer.h"
|
||||
|
||||
IndexBuffer* gles20_index_buffer_create(size_t max_elements) {
|
||||
IndexBuffer *ibuf = calloc(1, sizeof(*ibuf) + max_elements * sizeof(gles20_ibo_index_t));
|
||||
snprintf(ibuf->debug_label, sizeof(ibuf->debug_label), "Fake IBO at %p", (void*)ibuf);
|
||||
ibuf->num_elements = max_elements;
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
size_t gles20_index_buffer_get_capacity(IndexBuffer *ibuf) {
|
||||
return ibuf->num_elements;
|
||||
}
|
||||
|
||||
const char* gles20_index_buffer_get_debug_label(IndexBuffer *ibuf) {
|
||||
return ibuf->debug_label;
|
||||
}
|
||||
|
||||
void gles20_index_buffer_set_debug_label(IndexBuffer *ibuf, const char *label) {
|
||||
if(label) {
|
||||
strlcpy(ibuf->debug_label, label, sizeof(ibuf->debug_label));
|
||||
} else {
|
||||
snprintf(ibuf->debug_label, sizeof(ibuf->debug_label), "Fake IBO at %p", (void*)ibuf);
|
||||
}
|
||||
}
|
||||
|
||||
void gles20_index_buffer_set_offset(IndexBuffer *ibuf, size_t offset) {
|
||||
ibuf->offset = offset;
|
||||
}
|
||||
|
||||
size_t gles20_index_buffer_get_offset(IndexBuffer *ibuf) {
|
||||
return ibuf->offset;
|
||||
}
|
||||
|
||||
void gles20_index_buffer_add_indices(IndexBuffer *ibuf, uint index_ofs, size_t num_indices, uint indices[num_indices]) {
|
||||
assert(ibuf->offset + num_indices - 1 < ibuf->num_elements);
|
||||
|
||||
for(size_t i = 0; i < num_indices; ++i) {
|
||||
uintmax_t idx = indices[i] + index_ofs;
|
||||
assert(idx <= GLES20_IBO_MAX_INDEX);
|
||||
ibuf->elements[ibuf->offset + i] = idx;
|
||||
}
|
||||
|
||||
ibuf->offset += num_indices;
|
||||
}
|
||||
|
||||
void gles20_index_buffer_destroy(IndexBuffer *ibuf) {
|
||||
free(ibuf);
|
||||
}
|
||||
|
||||
void gles20_index_buffer_flush(IndexBuffer *ibuf) {
|
||||
}
|
34
src/renderer/gles20/index_buffer.h
Normal file
34
src/renderer/gles20/index_buffer.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "../glcommon/opengl.h"
|
||||
#include "../api.h"
|
||||
|
||||
typedef GLushort gles20_ibo_index_t;
|
||||
#define GLES20_IBO_MAX_INDEX UINT16_MAX
|
||||
#define GLES20_IBO_GL_DATATYPE GL_UNSIGNED_SHORT
|
||||
|
||||
typedef struct IndexBuffer {
|
||||
size_t num_elements;
|
||||
size_t offset;
|
||||
char debug_label[R_DEBUG_LABEL_SIZE];
|
||||
gles20_ibo_index_t elements[];
|
||||
} IndexBuffer;
|
||||
|
||||
IndexBuffer* gles20_index_buffer_create(size_t max_elements);
|
||||
size_t gles20_index_buffer_get_capacity(IndexBuffer *ibuf);
|
||||
const char* gles20_index_buffer_get_debug_label(IndexBuffer *ibuf);
|
||||
void gles20_index_buffer_set_debug_label(IndexBuffer *ibuf, const char *label);
|
||||
void gles20_index_buffer_set_offset(IndexBuffer *ibuf, size_t offset);
|
||||
size_t gles20_index_buffer_get_offset(IndexBuffer *ibuf);
|
||||
void gles20_index_buffer_add_indices(IndexBuffer *ibuf, uint index_ofs, size_t num_indices, uint indices[num_indices]);
|
||||
void gles20_index_buffer_destroy(IndexBuffer *ibuf);
|
||||
void gles20_index_buffer_flush(IndexBuffer *ibuf);
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
r_gles20_src = files(
|
||||
'core.c',
|
||||
'texture.c',
|
||||
'gles20.c',
|
||||
'index_buffer.c',
|
||||
)
|
||||
|
||||
r_gles20_deps = ['gl33'] + r_gl33_deps
|
||||
r_gles20_libdeps = r_gl33_libdeps
|
||||
r_gles20_deps = ['glescommon'] + r_glescommon_deps
|
||||
r_gles20_libdeps = r_glescommon_libdeps
|
||||
|
|
31
src/renderer/gles30/gles30.c
Normal file
31
src/renderer/gles30/gles30.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "gles30.h"
|
||||
#include "../glescommon/gles.h"
|
||||
#include "../glescommon/texture.h"
|
||||
|
||||
static void gles30_init(void) {
|
||||
gles_init(&_r_backend_gles30, 3, 0);
|
||||
}
|
||||
|
||||
RendererBackend _r_backend_gles30 = {
|
||||
.name = "gles30",
|
||||
.funcs = {
|
||||
.init = gles30_init,
|
||||
.screenshot = gles_screenshot,
|
||||
},
|
||||
.custom = &(GLBackendData) {
|
||||
.vtable = {
|
||||
.texture_type_info = gles_texture_type_info,
|
||||
.init_context = gles_init_context,
|
||||
}
|
||||
},
|
||||
};
|
14
src/renderer/gles30/gles30.h
Normal file
14
src/renderer/gles30/gles30.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "../common/backend.h"
|
||||
|
||||
extern RendererBackend _r_backend_gles30;
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
r_gles30_src = files(
|
||||
'gles30.c',
|
||||
)
|
||||
|
||||
r_gles30_deps = ['gles20'] + r_gles20_deps
|
||||
r_gles30_libdeps = r_gles20_libdeps
|
||||
r_gles30_deps = ['glescommon'] + r_glescommon_deps
|
||||
r_gles30_libdeps = r_glescommon_libdeps
|
||||
|
|
37
src/renderer/glescommon/gles.c
Normal file
37
src/renderer/glescommon/gles.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "taisei.h"
|
||||
|
||||
#include "gles.h"
|
||||
#include "texture.h"
|
||||
#include "../common/backend.h"
|
||||
#include "../gl33/gl33.h"
|
||||
|
||||
void gles_init(RendererBackend *gles_backend, int major, int minor) {
|
||||
_r_backend_inherit(gles_backend, &_r_backend_gl33);
|
||||
glcommon_setup_attributes(SDL_GL_CONTEXT_PROFILE_ES, major, minor, 0);
|
||||
glcommon_load_library();
|
||||
}
|
||||
|
||||
void gles_init_context(SDL_Window *w) {
|
||||
GLVT_OF(_r_backend_gl33).init_context(w);
|
||||
gles_init_texformats_table();
|
||||
}
|
||||
|
||||
bool gles_screenshot(Pixmap *out) {
|
||||
IntRect vp;
|
||||
r_framebuffer_viewport_current(NULL, &vp);
|
||||
out->width = vp.w;
|
||||
out->height = vp.h;
|
||||
out->format = PIXMAP_FORMAT_RGBA8;
|
||||
out->origin = PIXMAP_ORIGIN_BOTTOMLEFT;
|
||||
out->data.untyped = pixmap_alloc_buffer_for_copy(out);
|
||||
glReadPixels(vp.x, vp.y, vp.w, vp.h, GL_RGBA, GL_UNSIGNED_BYTE, out->data.untyped);
|
||||
return true;
|
||||
}
|
16
src/renderer/glescommon/gles.h
Normal file
16
src/renderer/glescommon/gles.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
||||
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "taisei.h"
|
||||
|
||||
#include "../glcommon/vtable.h"
|
||||
|
||||
void gles_init(RendererBackend *gles_backend, int major, int minor);
|
||||
void gles_init_context(SDL_Window *w);
|
||||
bool gles_screenshot(Pixmap *out);
|
8
src/renderer/glescommon/meson.build
Normal file
8
src/renderer/glescommon/meson.build
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
r_glescommon_src = files(
|
||||
'gles.c',
|
||||
'texture.c',
|
||||
)
|
||||
|
||||
r_glescommon_deps = ['gl33'] + r_gl33_deps
|
||||
r_glescommon_libdeps = r_gl33_libdeps
|
|
@ -9,7 +9,6 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "texture.h"
|
||||
#include "core.h"
|
||||
#include "../glcommon/opengl.h"
|
||||
|
||||
#define FMT_R8 { GL_RED, GL_UNSIGNED_BYTE, PIXMAP_FORMAT_R8 }
|
||||
|
@ -62,7 +61,7 @@ static inline void set_format(TextureType t, GLenum internal, GLTextureFormatTup
|
|||
gles_texformats[t].external_formats[0] = external;
|
||||
}
|
||||
|
||||
void gles20_init_texformats_table(void) {
|
||||
void gles_init_texformats_table(void) {
|
||||
bool is_gles3 = GLES_ATLEAST(3, 0);
|
||||
bool have_rg = glext.texture_rg;
|
||||
bool have_16bit = glext.texture_norm16;
|
||||
|
@ -165,7 +164,7 @@ void gles20_init_texformats_table(void) {
|
|||
}
|
||||
}
|
||||
|
||||
GLTextureTypeInfo* gles20_texture_type_info(TextureType type) {
|
||||
GLTextureTypeInfo* gles_texture_type_info(TextureType type) {
|
||||
assert((uint)type < sizeof(gles_texformats)/sizeof(*gles_texformats));
|
||||
return gles_texformats + type;
|
||||
}
|
|
@ -11,6 +11,5 @@
|
|||
|
||||
#include "../glcommon/texture.h"
|
||||
|
||||
void gles20_init_texformats_table(void);
|
||||
GLTextureTypeInfo* gles20_texture_type_info(TextureType type);
|
||||
|
||||
void gles_init_texformats_table(void);
|
||||
GLTextureTypeInfo* gles_texture_type_info(TextureType type);
|
|
@ -1,12 +1,24 @@
|
|||
|
||||
default_backend = get_option('r_default')
|
||||
|
||||
if not get_option('r_@0@'.format(default_backend))
|
||||
error('Default renderer \'@0@\' is not enabled. Enable it with -Dr_@0@=true, or set r_default to something else.'.format(default_backend))
|
||||
endif
|
||||
|
||||
renderer_src = files(
|
||||
'api.c',
|
||||
)
|
||||
|
||||
renderer_deps = []
|
||||
|
||||
# NOTE: Order matters here.
|
||||
subdir('null')
|
||||
subdir('common')
|
||||
subdir('glcommon')
|
||||
subdir('gl33')
|
||||
subdir('glescommon')
|
||||
subdir('gles20')
|
||||
subdir('gles30')
|
||||
|
||||
modules = [
|
||||
'gl33',
|
||||
|
@ -28,7 +40,6 @@ else
|
|||
endif
|
||||
|
||||
foreach m : modules
|
||||
subdir(m)
|
||||
if get_option('r_@0@'.format(m))
|
||||
renderer_src += get_variable('r_@0@_src'.format(m))
|
||||
r_macro += ['R(@0@)'.format(m)]
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "taisei.h"
|
||||
|
||||
#include "crap.h"
|
||||
#include "assert.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -18,3 +19,13 @@ void* memdup(const void *src, size_t size) {
|
|||
memcpy(data, src, size);
|
||||
return data;
|
||||
}
|
||||
|
||||
static_assert(sizeof(void*) == sizeof(void (*)(void)), "Can't store function pointers in void* :(");
|
||||
|
||||
void inherit_missing_pointers(uint num, void *dest[num], void *const base[num]) {
|
||||
for(uint i = 0; i < num; ++i) {
|
||||
if(dest[i] == NULL) {
|
||||
dest[i] = base[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,3 +10,4 @@
|
|||
#include "taisei.h"
|
||||
|
||||
void* memdup(const void *src, size_t size);
|
||||
void inherit_missing_pointers(uint num, void *dest[num], void *const base[num]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.28 on Mon Oct 22 08:10:07 2018.
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.28 on Tue Oct 23 09:36:37 2018.
|
||||
|
||||
Language/Generator: C/C++
|
||||
Specification: gl
|
||||
|
@ -10,6 +10,7 @@
|
|||
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,
|
||||
|
@ -19,6 +20,7 @@
|
|||
GL_ARB_instanced_arrays,
|
||||
GL_ARB_pixel_buffer_object,
|
||||
GL_ARB_texture_filter_anisotropic,
|
||||
GL_ARB_vertex_array_object,
|
||||
GL_ATI_draw_buffers,
|
||||
GL_EXT_base_instance,
|
||||
GL_EXT_color_buffer_float,
|
||||
|
@ -37,6 +39,7 @@
|
|||
GL_OES_depth_texture,
|
||||
GL_OES_texture_float_linear,
|
||||
GL_OES_texture_half_float_linear,
|
||||
GL_OES_vertex_array_object,
|
||||
GL_SGIX_depth_texture
|
||||
Loader: False
|
||||
Local files: False
|
||||
|
@ -44,9 +47,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_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_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_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_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_SGIX_depth_texture"
|
||||
Online:
|
||||
http://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_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_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_SGIX_depth_texture
|
||||
http://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_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_SGIX_depth_texture
|
||||
*/
|
||||
|
||||
|
||||
|
@ -2330,6 +2333,7 @@ typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC)(GLenum target, GLenum inte
|
|||
GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;
|
||||
#define glGetInternalformativ glad_glGetInternalformativ
|
||||
#endif
|
||||
#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5
|
||||
#define GL_CLEAR_TEXTURE 0x9365
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
|
||||
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
|
||||
|
@ -2547,6 +2551,23 @@ GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;
|
|||
#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC
|
||||
#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED
|
||||
#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF
|
||||
#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
|
||||
#ifndef GL_APPLE_vertex_array_object
|
||||
#define GL_APPLE_vertex_array_object 1
|
||||
GLAPI int GLAD_GL_APPLE_vertex_array_object;
|
||||
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC)(GLuint array);
|
||||
GLAPI PFNGLBINDVERTEXARRAYAPPLEPROC glad_glBindVertexArrayAPPLE;
|
||||
#define glBindVertexArrayAPPLE glad_glBindVertexArrayAPPLE
|
||||
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC)(GLsizei n, const GLuint *arrays);
|
||||
GLAPI PFNGLDELETEVERTEXARRAYSAPPLEPROC glad_glDeleteVertexArraysAPPLE;
|
||||
#define glDeleteVertexArraysAPPLE glad_glDeleteVertexArraysAPPLE
|
||||
typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC)(GLsizei n, GLuint *arrays);
|
||||
GLAPI PFNGLGENVERTEXARRAYSAPPLEPROC glad_glGenVertexArraysAPPLE;
|
||||
#define glGenVertexArraysAPPLE glad_glGenVertexArraysAPPLE
|
||||
typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC)(GLuint array);
|
||||
GLAPI PFNGLISVERTEXARRAYAPPLEPROC glad_glIsVertexArrayAPPLE;
|
||||
#define glIsVertexArrayAPPLE glad_glIsVertexArrayAPPLE
|
||||
#endif
|
||||
#ifndef GL_ARB_base_instance
|
||||
#define GL_ARB_base_instance 1
|
||||
GLAPI int GLAD_GL_ARB_base_instance;
|
||||
|
@ -2622,6 +2643,10 @@ GLAPI int GLAD_GL_ARB_pixel_buffer_object;
|
|||
#define GL_ARB_texture_filter_anisotropic 1
|
||||
GLAPI int GLAD_GL_ARB_texture_filter_anisotropic;
|
||||
#endif
|
||||
#ifndef GL_ARB_vertex_array_object
|
||||
#define GL_ARB_vertex_array_object 1
|
||||
GLAPI int GLAD_GL_ARB_vertex_array_object;
|
||||
#endif
|
||||
#ifndef GL_ATI_draw_buffers
|
||||
#define GL_ATI_draw_buffers 1
|
||||
GLAPI int GLAD_GL_ATI_draw_buffers;
|
||||
|
@ -2833,6 +2858,22 @@ GLAPI int GLAD_GL_OES_texture_float_linear;
|
|||
#define GL_OES_texture_half_float_linear 1
|
||||
GLAPI int GLAD_GL_OES_texture_half_float_linear;
|
||||
#endif
|
||||
#ifndef GL_OES_vertex_array_object
|
||||
#define GL_OES_vertex_array_object 1
|
||||
GLAPI int GLAD_GL_OES_vertex_array_object;
|
||||
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYOESPROC)(GLuint array);
|
||||
GLAPI PFNGLBINDVERTEXARRAYOESPROC glad_glBindVertexArrayOES;
|
||||
#define glBindVertexArrayOES glad_glBindVertexArrayOES
|
||||
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC)(GLsizei n, const GLuint *arrays);
|
||||
GLAPI PFNGLDELETEVERTEXARRAYSOESPROC glad_glDeleteVertexArraysOES;
|
||||
#define glDeleteVertexArraysOES glad_glDeleteVertexArraysOES
|
||||
typedef void (APIENTRYP PFNGLGENVERTEXARRAYSOESPROC)(GLsizei n, GLuint *arrays);
|
||||
GLAPI PFNGLGENVERTEXARRAYSOESPROC glad_glGenVertexArraysOES;
|
||||
#define glGenVertexArraysOES glad_glGenVertexArraysOES
|
||||
typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYOESPROC)(GLuint array);
|
||||
GLAPI PFNGLISVERTEXARRAYOESPROC glad_glIsVertexArrayOES;
|
||||
#define glIsVertexArrayOES glad_glIsVertexArrayOES
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ glad_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',
|
||||
|
@ -15,6 +16,7 @@ glad_extensions = [
|
|||
'GL_ARB_instanced_arrays',
|
||||
'GL_ARB_pixel_buffer_object',
|
||||
'GL_ARB_texture_filter_anisotropic',
|
||||
'GL_ARB_vertex_array_object',
|
||||
'GL_ATI_draw_buffers',
|
||||
'GL_EXT_base_instance',
|
||||
'GL_EXT_color_buffer_float',
|
||||
|
@ -33,6 +35,7 @@ glad_extensions = [
|
|||
'GL_OES_depth_texture',
|
||||
'GL_OES_texture_float_linear',
|
||||
'GL_OES_texture_half_float_linear',
|
||||
'GL_OES_vertex_array_object',
|
||||
'GL_SGIX_depth_texture',
|
||||
]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.28 on Mon Oct 22 08:10:07 2018.
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.28 on Tue Oct 23 09:36:37 2018.
|
||||
|
||||
Language/Generator: C/C++
|
||||
Specification: gl
|
||||
|
@ -10,6 +10,7 @@
|
|||
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,
|
||||
|
@ -19,6 +20,7 @@
|
|||
GL_ARB_instanced_arrays,
|
||||
GL_ARB_pixel_buffer_object,
|
||||
GL_ARB_texture_filter_anisotropic,
|
||||
GL_ARB_vertex_array_object,
|
||||
GL_ATI_draw_buffers,
|
||||
GL_EXT_base_instance,
|
||||
GL_EXT_color_buffer_float,
|
||||
|
@ -37,6 +39,7 @@
|
|||
GL_OES_depth_texture,
|
||||
GL_OES_texture_float_linear,
|
||||
GL_OES_texture_half_float_linear,
|
||||
GL_OES_vertex_array_object,
|
||||
GL_SGIX_depth_texture
|
||||
Loader: False
|
||||
Local files: False
|
||||
|
@ -44,9 +47,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_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_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_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_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_SGIX_depth_texture"
|
||||
Online:
|
||||
http://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_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_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_SGIX_depth_texture
|
||||
http://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_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_SGIX_depth_texture
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -567,6 +570,7 @@ PFNGLWAITSYNCPROC glad_glWaitSync = NULL;
|
|||
int GLAD_GL_ANGLE_depth_texture = 0;
|
||||
int GLAD_GL_ANGLE_instanced_arrays = 0;
|
||||
int GLAD_GL_ANGLE_translated_shader_source = 0;
|
||||
int GLAD_GL_APPLE_vertex_array_object = 0;
|
||||
int GLAD_GL_ARB_base_instance = 0;
|
||||
int GLAD_GL_ARB_clear_texture = 0;
|
||||
int GLAD_GL_ARB_debug_output = 0;
|
||||
|
@ -576,6 +580,7 @@ int GLAD_GL_ARB_draw_instanced = 0;
|
|||
int GLAD_GL_ARB_instanced_arrays = 0;
|
||||
int GLAD_GL_ARB_pixel_buffer_object = 0;
|
||||
int GLAD_GL_ARB_texture_filter_anisotropic = 0;
|
||||
int GLAD_GL_ARB_vertex_array_object = 0;
|
||||
int GLAD_GL_ATI_draw_buffers = 0;
|
||||
int GLAD_GL_EXT_base_instance = 0;
|
||||
int GLAD_GL_EXT_color_buffer_float = 0;
|
||||
|
@ -594,7 +599,12 @@ int GLAD_GL_NV_pixel_buffer_object = 0;
|
|||
int GLAD_GL_OES_depth_texture = 0;
|
||||
int GLAD_GL_OES_texture_float_linear = 0;
|
||||
int GLAD_GL_OES_texture_half_float_linear = 0;
|
||||
int GLAD_GL_OES_vertex_array_object = 0;
|
||||
int GLAD_GL_SGIX_depth_texture = 0;
|
||||
PFNGLBINDVERTEXARRAYAPPLEPROC glad_glBindVertexArrayAPPLE = NULL;
|
||||
PFNGLDELETEVERTEXARRAYSAPPLEPROC glad_glDeleteVertexArraysAPPLE = NULL;
|
||||
PFNGLGENVERTEXARRAYSAPPLEPROC glad_glGenVertexArraysAPPLE = NULL;
|
||||
PFNGLISVERTEXARRAYAPPLEPROC glad_glIsVertexArrayAPPLE = NULL;
|
||||
PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glad_glDrawArraysInstancedBaseInstance = NULL;
|
||||
PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glad_glDrawElementsInstancedBaseInstance = NULL;
|
||||
PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance = NULL;
|
||||
|
@ -645,6 +655,10 @@ PFNGLVERTEXATTRIBDIVISOREXTPROC glad_glVertexAttribDivisorEXT = NULL;
|
|||
PFNGLDRAWARRAYSINSTANCEDNVPROC glad_glDrawArraysInstancedNV = NULL;
|
||||
PFNGLDRAWELEMENTSINSTANCEDNVPROC glad_glDrawElementsInstancedNV = NULL;
|
||||
PFNGLVERTEXATTRIBDIVISORNVPROC glad_glVertexAttribDivisorNV = NULL;
|
||||
PFNGLBINDVERTEXARRAYOESPROC glad_glBindVertexArrayOES = NULL;
|
||||
PFNGLDELETEVERTEXARRAYSOESPROC glad_glDeleteVertexArraysOES = NULL;
|
||||
PFNGLGENVERTEXARRAYSOESPROC glad_glGenVertexArraysOES = NULL;
|
||||
PFNGLISVERTEXARRAYOESPROC glad_glIsVertexArrayOES = NULL;
|
||||
static void load_GL_VERSION_1_0(GLADloadproc load) {
|
||||
if(!GLAD_GL_VERSION_1_0) return;
|
||||
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
|
||||
|
@ -1058,6 +1072,13 @@ static void load_GL_VERSION_3_3(GLADloadproc load) {
|
|||
glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui");
|
||||
glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv");
|
||||
}
|
||||
static void load_GL_APPLE_vertex_array_object(GLADloadproc load) {
|
||||
if(!GLAD_GL_APPLE_vertex_array_object) return;
|
||||
glad_glBindVertexArrayAPPLE = (PFNGLBINDVERTEXARRAYAPPLEPROC)load("glBindVertexArrayAPPLE");
|
||||
glad_glDeleteVertexArraysAPPLE = (PFNGLDELETEVERTEXARRAYSAPPLEPROC)load("glDeleteVertexArraysAPPLE");
|
||||
glad_glGenVertexArraysAPPLE = (PFNGLGENVERTEXARRAYSAPPLEPROC)load("glGenVertexArraysAPPLE");
|
||||
glad_glIsVertexArrayAPPLE = (PFNGLISVERTEXARRAYAPPLEPROC)load("glIsVertexArrayAPPLE");
|
||||
}
|
||||
static void load_GL_ARB_base_instance(GLADloadproc load) {
|
||||
if(!GLAD_GL_ARB_base_instance) return;
|
||||
glad_glDrawArraysInstancedBaseInstance = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)load("glDrawArraysInstancedBaseInstance");
|
||||
|
@ -1089,6 +1110,13 @@ static void load_GL_ARB_instanced_arrays(GLADloadproc load) {
|
|||
if(!GLAD_GL_ARB_instanced_arrays) return;
|
||||
glad_glVertexAttribDivisorARB = (PFNGLVERTEXATTRIBDIVISORARBPROC)load("glVertexAttribDivisorARB");
|
||||
}
|
||||
static void load_GL_ARB_vertex_array_object(GLADloadproc load) {
|
||||
if(!GLAD_GL_ARB_vertex_array_object) return;
|
||||
glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray");
|
||||
glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays");
|
||||
glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays");
|
||||
glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray");
|
||||
}
|
||||
static void load_GL_ATI_draw_buffers(GLADloadproc load) {
|
||||
if(!GLAD_GL_ATI_draw_buffers) return;
|
||||
glad_glDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC)load("glDrawBuffersATI");
|
||||
|
@ -1125,6 +1153,7 @@ static void load_GL_KHR_debug(GLADloadproc load) {
|
|||
}
|
||||
static int find_extensionsGL(void) {
|
||||
if (!get_exts()) return 0;
|
||||
GLAD_GL_APPLE_vertex_array_object = has_ext("GL_APPLE_vertex_array_object");
|
||||
GLAD_GL_ARB_base_instance = has_ext("GL_ARB_base_instance");
|
||||
GLAD_GL_ARB_clear_texture = has_ext("GL_ARB_clear_texture");
|
||||
GLAD_GL_ARB_debug_output = has_ext("GL_ARB_debug_output");
|
||||
|
@ -1134,6 +1163,7 @@ static int find_extensionsGL(void) {
|
|||
GLAD_GL_ARB_instanced_arrays = has_ext("GL_ARB_instanced_arrays");
|
||||
GLAD_GL_ARB_pixel_buffer_object = has_ext("GL_ARB_pixel_buffer_object");
|
||||
GLAD_GL_ARB_texture_filter_anisotropic = has_ext("GL_ARB_texture_filter_anisotropic");
|
||||
GLAD_GL_ARB_vertex_array_object = has_ext("GL_ARB_vertex_array_object");
|
||||
GLAD_GL_ATI_draw_buffers = has_ext("GL_ATI_draw_buffers");
|
||||
GLAD_GL_EXT_draw_instanced = has_ext("GL_EXT_draw_instanced");
|
||||
GLAD_GL_EXT_pixel_buffer_object = has_ext("GL_EXT_pixel_buffer_object");
|
||||
|
@ -1218,12 +1248,14 @@ int gladLoadGLLoader(GLADloadproc load) {
|
|||
load_GL_VERSION_3_3(load);
|
||||
|
||||
if (!find_extensionsGL()) return 0;
|
||||
load_GL_APPLE_vertex_array_object(load);
|
||||
load_GL_ARB_base_instance(load);
|
||||
load_GL_ARB_clear_texture(load);
|
||||
load_GL_ARB_debug_output(load);
|
||||
load_GL_ARB_draw_buffers(load);
|
||||
load_GL_ARB_draw_instanced(load);
|
||||
load_GL_ARB_instanced_arrays(load);
|
||||
load_GL_ARB_vertex_array_object(load);
|
||||
load_GL_ATI_draw_buffers(load);
|
||||
load_GL_EXT_draw_instanced(load);
|
||||
load_GL_KHR_debug(load);
|
||||
|
@ -1517,6 +1549,13 @@ static void load_GL_NV_instanced_arrays(GLADloadproc load) {
|
|||
if(!GLAD_GL_NV_instanced_arrays) return;
|
||||
glad_glVertexAttribDivisorNV = (PFNGLVERTEXATTRIBDIVISORNVPROC)load("glVertexAttribDivisorNV");
|
||||
}
|
||||
static void load_GL_OES_vertex_array_object(GLADloadproc load) {
|
||||
if(!GLAD_GL_OES_vertex_array_object) return;
|
||||
glad_glBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC)load("glBindVertexArrayOES");
|
||||
glad_glDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC)load("glDeleteVertexArraysOES");
|
||||
glad_glGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)load("glGenVertexArraysOES");
|
||||
glad_glIsVertexArrayOES = (PFNGLISVERTEXARRAYOESPROC)load("glIsVertexArrayOES");
|
||||
}
|
||||
static int find_extensionsGLES2(void) {
|
||||
if (!get_exts()) return 0;
|
||||
GLAD_GL_ANGLE_depth_texture = has_ext("GL_ANGLE_depth_texture");
|
||||
|
@ -1538,6 +1577,7 @@ static int find_extensionsGLES2(void) {
|
|||
GLAD_GL_OES_depth_texture = has_ext("GL_OES_depth_texture");
|
||||
GLAD_GL_OES_texture_float_linear = has_ext("GL_OES_texture_float_linear");
|
||||
GLAD_GL_OES_texture_half_float_linear = has_ext("GL_OES_texture_half_float_linear");
|
||||
GLAD_GL_OES_vertex_array_object = has_ext("GL_OES_vertex_array_object");
|
||||
free_exts();
|
||||
return 1;
|
||||
}
|
||||
|
@ -1605,6 +1645,7 @@ int gladLoadGLES2Loader(GLADloadproc load) {
|
|||
load_GL_KHR_debug(load);
|
||||
load_GL_NV_draw_instanced(load);
|
||||
load_GL_NV_instanced_arrays(load);
|
||||
load_GL_OES_vertex_array_object(load);
|
||||
return GLVersion.major != 0 || GLVersion.minor != 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue