mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
Use glsym symbol loader instead of ugly poking.
This commit is contained in:
parent
b33af9d6b6
commit
e44249b73f
8
Makefile
8
Makefile
@ -196,7 +196,8 @@ ifeq ($(HAVE_OPENGL), 1)
|
||||
gfx/fonts/gl_font.o \
|
||||
gfx/fonts/gl_raster_font.o \
|
||||
gfx/math/matrix.o \
|
||||
gfx/state_tracker.o
|
||||
gfx/state_tracker.o \
|
||||
gfx/glsym/rglgen.o
|
||||
|
||||
ifeq ($(HAVE_KMS), 1)
|
||||
OBJ += gfx/context/drm_egl_ctx.o
|
||||
@ -223,12 +224,14 @@ ifeq ($(HAVE_OPENGL), 1)
|
||||
ifeq ($(HAVE_GLES), 1)
|
||||
LIBS += -lGLESv2
|
||||
DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2
|
||||
OBJ += gfx/glsym/glsym_es2.o
|
||||
else
|
||||
DEFINES += -DHAVE_GL_SYNC
|
||||
OBJ += gfx/glsym/glsym_gl.o
|
||||
ifeq ($(OSX), 1)
|
||||
LIBS += -framework OpenGL
|
||||
else
|
||||
LIBS += -lGL
|
||||
DEFINES += -DHAVE_GL_SYNC
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -424,6 +427,7 @@ clean:
|
||||
rm -f audio/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/glsym/*.o
|
||||
rm -f gfx/rpng/*.o
|
||||
rm -f gfx/fonts/*.o
|
||||
rm -f gfx/math/*.o
|
||||
|
@ -114,7 +114,7 @@ ifeq ($(HAVE_THREADS), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/wgl_ctx.o gfx/shader_glsl.o
|
||||
OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/wgl_ctx.o gfx/shader_glsl.o gfx/glsym/rglgen.o gfx/glsym/glsym.o
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_GLSL -DHAVE_GL_SYNC
|
||||
LIBS += -lopengl32 -lgdi32 -lcomdlg32
|
||||
endif
|
||||
@ -287,6 +287,7 @@ clean:
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/scaler/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/glsym/*.o
|
||||
rm -f gfx/d3d9/*.o
|
||||
rm -f gfx/context/*.o
|
||||
rm -f gfx/math/*.o
|
||||
|
294
gfx/gl.c
294
gfx/gl.c
@ -138,174 +138,64 @@ static inline void set_texture_coords(GLfloat *coords, GLfloat xamt, GLfloat yam
|
||||
coords[7] = yamt;
|
||||
}
|
||||
|
||||
#undef LOAD_GL_SYM
|
||||
#define LOAD_GL_SYM(SYM) if (!pgl##SYM) { \
|
||||
gfx_ctx_proc_t sym = gl->ctx_driver->get_proc_address("gl" #SYM); \
|
||||
memcpy(&(pgl##SYM), &sym, sizeof(sym)); \
|
||||
}
|
||||
|
||||
#if defined(HAVE_EGL) && defined(HAVE_OPENGLES2)
|
||||
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC pglEGLImageTargetTexture2DOES;
|
||||
|
||||
static bool load_eglimage_proc(gl_t *gl)
|
||||
static bool check_eglimage_proc(void)
|
||||
{
|
||||
LOAD_GL_SYM(EGLImageTargetTexture2DOES);
|
||||
return pglEGLImageTargetTexture2DOES;
|
||||
return glEGLImageTargetTexture2DOES != NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GL_SYNC
|
||||
static PFNGLFENCESYNCPROC pglFenceSync;
|
||||
static PFNGLDELETESYNCPROC pglDeleteSync;
|
||||
static PFNGLCLIENTWAITSYNCPROC pglClientWaitSync;
|
||||
|
||||
static bool load_sync_proc(gl_t *gl)
|
||||
static bool check_sync_proc(void)
|
||||
{
|
||||
if (!gl_query_extension(gl, "ARB_sync"))
|
||||
return false;
|
||||
|
||||
LOAD_GL_SYM(FenceSync);
|
||||
LOAD_GL_SYM(DeleteSync);
|
||||
LOAD_GL_SYM(ClientWaitSync);
|
||||
|
||||
return pglFenceSync && pglDeleteSync && pglClientWaitSync;
|
||||
return glFenceSync && glDeleteSync && glClientWaitSync;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_OPENGLES
|
||||
static PFNGLGENVERTEXARRAYSPROC pglGenVertexArrays;
|
||||
static PFNGLBINDVERTEXARRAYPROC pglBindVertexArray;
|
||||
static PFNGLDELETEVERTEXARRAYSPROC pglDeleteVertexArrays;
|
||||
|
||||
static bool load_vao_proc(gl_t *gl)
|
||||
static bool init_vao(gl_t *gl)
|
||||
{
|
||||
LOAD_GL_SYM(GenVertexArrays);
|
||||
LOAD_GL_SYM(BindVertexArray);
|
||||
LOAD_GL_SYM(DeleteVertexArrays);
|
||||
|
||||
bool present = pglGenVertexArrays && pglBindVertexArray && pglDeleteVertexArrays;
|
||||
bool present = glGenVertexArrays && glBindVertexArray && glDeleteVertexArrays;
|
||||
if (!present)
|
||||
return false;
|
||||
|
||||
pglGenVertexArrays(1, &gl->vao);
|
||||
glGenVertexArrays(1, &gl->vao);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
#if defined(_WIN32) && !defined(RARCH_CONSOLE)
|
||||
static PFNGLGENFRAMEBUFFERSPROC pglGenFramebuffers;
|
||||
static PFNGLBINDFRAMEBUFFERPROC pglBindFramebuffer;
|
||||
static PFNGLFRAMEBUFFERTEXTURE2DPROC pglFramebufferTexture2D;
|
||||
static PFNGLCHECKFRAMEBUFFERSTATUSPROC pglCheckFramebufferStatus;
|
||||
static PFNGLDELETEFRAMEBUFFERSPROC pglDeleteFramebuffers;
|
||||
static PFNGLGENRENDERBUFFERSPROC pglGenRenderbuffers;
|
||||
static PFNGLBINDRENDERBUFFERPROC pglBindRenderbuffer;
|
||||
static PFNGLFRAMEBUFFERRENDERBUFFERPROC pglFramebufferRenderbuffer;
|
||||
static PFNGLRENDERBUFFERSTORAGEPROC pglRenderbufferStorage;
|
||||
static PFNGLDELETERENDERBUFFERSPROC pglDeleteRenderbuffers;
|
||||
|
||||
static bool load_fbo_proc(gl_t *gl)
|
||||
{
|
||||
LOAD_GL_SYM(GenFramebuffers);
|
||||
LOAD_GL_SYM(BindFramebuffer);
|
||||
LOAD_GL_SYM(FramebufferTexture2D);
|
||||
LOAD_GL_SYM(CheckFramebufferStatus);
|
||||
LOAD_GL_SYM(DeleteFramebuffers);
|
||||
LOAD_GL_SYM(GenRenderbuffers);
|
||||
LOAD_GL_SYM(BindRenderbuffer);
|
||||
LOAD_GL_SYM(FramebufferRenderbuffer);
|
||||
LOAD_GL_SYM(RenderbufferStorage);
|
||||
LOAD_GL_SYM(DeleteRenderbuffers);
|
||||
|
||||
return pglGenFramebuffers && pglBindFramebuffer && pglFramebufferTexture2D &&
|
||||
pglCheckFramebufferStatus && pglDeleteFramebuffers &&
|
||||
pglGenRenderbuffers && pglBindRenderbuffer &&
|
||||
pglFramebufferRenderbuffer && pglRenderbufferStorage &&
|
||||
pglDeleteRenderbuffers;
|
||||
}
|
||||
#elif defined(HAVE_OPENGLES2)
|
||||
#define pglGenFramebuffers glGenFramebuffers
|
||||
#define pglBindFramebuffer glBindFramebuffer
|
||||
#define pglFramebufferTexture2D glFramebufferTexture2D
|
||||
#define pglCheckFramebufferStatus glCheckFramebufferStatus
|
||||
#define pglDeleteFramebuffers glDeleteFramebuffers
|
||||
#define pglGenRenderbuffers glGenRenderbuffers
|
||||
#define pglBindRenderbuffer glBindRenderbuffer
|
||||
#define pglFramebufferRenderbuffer glFramebufferRenderbuffer
|
||||
#define pglRenderbufferStorage glRenderbufferStorage
|
||||
#define pglDeleteRenderbuffers glDeleteRenderbuffers
|
||||
#define load_fbo_proc(gl) (true)
|
||||
#elif defined(HAVE_OPENGLES)
|
||||
#define pglGenFramebuffers glGenFramebuffersOES
|
||||
#define pglBindFramebuffer glBindFramebufferOES
|
||||
#define pglFramebufferTexture2D glFramebufferTexture2DOES
|
||||
#define pglCheckFramebufferStatus glCheckFramebufferStatusOES
|
||||
#define pglDeleteFramebuffers glDeleteFramebuffersOES
|
||||
#define pglGenRenderbuffers glGenRenderbuffersOES
|
||||
#define pglBindRenderbuffer glBindRenderbufferOES
|
||||
#define pglFramebufferRenderbuffer glFramebufferRenderbufferOES
|
||||
#define pglRenderbufferStorage glRenderbufferStorageOES
|
||||
#define pglDeleteRenderbuffers glDeleteRenderbuffersOES
|
||||
#if defined(HAVE_PSGL)
|
||||
#define glGenFramebuffers glGenFramebuffersOES
|
||||
#define glBindFramebuffer glBindFramebufferOES
|
||||
#define glFramebufferTexture2D glFramebufferTexture2DOES
|
||||
#define glCheckFramebufferStatus glCheckFramebufferStatusOES
|
||||
#define glDeleteFramebuffers glDeleteFramebuffersOES
|
||||
#define glGenRenderbuffers glGenRenderbuffersOES
|
||||
#define glBindRenderbuffer glBindRenderbufferOES
|
||||
#define glFramebufferRenderbuffer glFramebufferRenderbufferOES
|
||||
#define glRenderbufferStorage glRenderbufferStorageOES
|
||||
#define glDeleteRenderbuffers glDeleteRenderbuffersOES
|
||||
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
|
||||
#define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
|
||||
#define load_fbo_proc(gl) (true)
|
||||
#else
|
||||
#define pglGenFramebuffers glGenFramebuffers
|
||||
#define pglBindFramebuffer glBindFramebuffer
|
||||
#define pglFramebufferTexture2D glFramebufferTexture2D
|
||||
#define pglCheckFramebufferStatus glCheckFramebufferStatus
|
||||
#define pglDeleteFramebuffers glDeleteFramebuffers
|
||||
#define pglGenRenderbuffers glGenRenderbuffers
|
||||
#define pglBindRenderbuffer glBindRenderbuffer
|
||||
#define pglFramebufferRenderbuffer glFramebufferRenderbuffer
|
||||
#define pglRenderbufferStorage glRenderbufferStorage
|
||||
#define pglDeleteRenderbuffers glDeleteRenderbuffers
|
||||
#define load_fbo_proc(gl) (true)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture;
|
||||
PFNGLACTIVETEXTUREPROC pglActiveTexture;
|
||||
static PFNGLGENBUFFERSPROC pglGenBuffers;
|
||||
static PFNGLGENBUFFERSPROC pglDeleteBuffers;
|
||||
static PFNGLBINDBUFFERPROC pglBindBuffer;
|
||||
static PFNGLBUFFERSUBDATAPROC pglBufferSubData;
|
||||
static PFNGLBUFFERDATAPROC pglBufferData;
|
||||
static PFNGLMAPBUFFERPROC pglMapBuffer;
|
||||
static PFNGLUNMAPBUFFERPROC pglUnmapBuffer;
|
||||
static inline bool load_gl_proc_win32(gl_t *gl)
|
||||
#define check_fbo_proc() (true)
|
||||
#elif !defined(HAVE_OPENGLES2)
|
||||
static bool check_fbo_proc(void)
|
||||
{
|
||||
LOAD_GL_SYM(ClientActiveTexture);
|
||||
LOAD_GL_SYM(ActiveTexture);
|
||||
LOAD_GL_SYM(GenBuffers);
|
||||
LOAD_GL_SYM(DeleteBuffers);
|
||||
LOAD_GL_SYM(BindBuffer);
|
||||
LOAD_GL_SYM(BufferSubData);
|
||||
LOAD_GL_SYM(BufferData);
|
||||
LOAD_GL_SYM(MapBuffer);
|
||||
LOAD_GL_SYM(UnmapBuffer);
|
||||
|
||||
return pglClientActiveTexture && pglActiveTexture &&
|
||||
pglGenBuffers && pglDeleteBuffers &&
|
||||
pglBindBuffer && pglBufferSubData && pglBufferData &&
|
||||
pglMapBuffer && pglUnmapBuffer;
|
||||
return glGenFramebuffers && glBindFramebuffer && glFramebufferTexture2D &&
|
||||
glCheckFramebufferStatus && glDeleteFramebuffers &&
|
||||
glGenRenderbuffers && glBindRenderbuffer &&
|
||||
glFramebufferRenderbuffer && glRenderbufferStorage &&
|
||||
glDeleteRenderbuffers;
|
||||
}
|
||||
#else
|
||||
#define pglGenBuffers glGenBuffers
|
||||
#define pglDeleteBuffers glDeleteBuffers
|
||||
#define pglBindBuffer glBindBuffer
|
||||
#define pglBufferSubData glBufferSubData
|
||||
#define pglBufferData glBufferData
|
||||
#define pglMapBuffer glMapBuffer
|
||||
#define pglUnmapBuffer glUnmapBuffer
|
||||
#define check_fbo_proc() (true)
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(HAVE_PSGL)
|
||||
#define GL_RGBA32F GL_RGBA32F_ARB
|
||||
#endif
|
||||
#endif
|
||||
|
||||
////////////////// Shaders
|
||||
|
||||
@ -382,11 +272,11 @@ static inline void gl_shader_deinit(void *data)
|
||||
#ifndef NO_GL_FF_VERTEX
|
||||
static void gl_set_coords(const struct gl_coords *coords)
|
||||
{
|
||||
pglClientActiveTexture(GL_TEXTURE1);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
pglClientActiveTexture(GL_TEXTURE0);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
@ -402,9 +292,9 @@ static void gl_disable_client_arrays(gl_t *gl)
|
||||
if (gl->core_context)
|
||||
return;
|
||||
|
||||
pglClientActiveTexture(GL_TEXTURE1);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
pglClientActiveTexture(GL_TEXTURE0);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
@ -457,7 +347,7 @@ void gl_shader_set_coords(void *data, const struct gl_coords *coords, const math
|
||||
void apple_bind_game_view_fbo(void);
|
||||
#define gl_bind_backbuffer() apple_bind_game_view_fbo()
|
||||
#else
|
||||
#define gl_bind_backbuffer() pglBindFramebuffer(GL_FRAMEBUFFER, 0)
|
||||
#define gl_bind_backbuffer() glBindFramebuffer(GL_FRAMEBUFFER, 0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
@ -630,13 +520,13 @@ static bool gl_create_fbo_targets(void *data)
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
pglGenFramebuffers(gl->fbo_pass, gl->fbo);
|
||||
glGenFramebuffers(gl->fbo_pass, gl->fbo);
|
||||
for (int i = 0; i < gl->fbo_pass; i++)
|
||||
{
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[i]);
|
||||
pglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->fbo_texture[i], 0);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[i]);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->fbo_texture[i], 0);
|
||||
|
||||
GLenum status = pglCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
goto error;
|
||||
}
|
||||
@ -644,7 +534,7 @@ static bool gl_create_fbo_targets(void *data)
|
||||
return true;
|
||||
|
||||
error:
|
||||
pglDeleteFramebuffers(gl->fbo_pass, gl->fbo);
|
||||
glDeleteFramebuffers(gl->fbo_pass, gl->fbo);
|
||||
RARCH_ERR("Failed to set up frame buffer objects. Multi-pass shading will not work.\n");
|
||||
return false;
|
||||
}
|
||||
@ -656,7 +546,7 @@ void gl_deinit_fbo(void *data)
|
||||
if (gl->fbo_inited)
|
||||
{
|
||||
glDeleteTextures(gl->fbo_pass, gl->fbo_texture);
|
||||
pglDeleteFramebuffers(gl->fbo_pass, gl->fbo);
|
||||
glDeleteFramebuffers(gl->fbo_pass, gl->fbo);
|
||||
memset(gl->fbo_texture, 0, sizeof(gl->fbo_texture));
|
||||
memset(gl->fbo, 0, sizeof(gl->fbo));
|
||||
gl->fbo_inited = false;
|
||||
@ -679,7 +569,7 @@ void gl_init_fbo(void *data, unsigned width, unsigned height)
|
||||
if (gl_shader_num(gl) == 1 && !scale.valid)
|
||||
return;
|
||||
|
||||
if (!load_fbo_proc(gl))
|
||||
if (!check_fbo_proc())
|
||||
{
|
||||
RARCH_ERR("Failed to locate FBO functions. Won't be able to use render-to-texture.\n");
|
||||
return;
|
||||
@ -742,11 +632,11 @@ bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
|
||||
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size);
|
||||
RARCH_LOG("[GL]: Max texture size: %d px, renderbuffer size: %u px.\n", max_fbo_size, max_renderbuffer_size);
|
||||
|
||||
if (!load_fbo_proc(gl))
|
||||
if (!check_fbo_proc())
|
||||
return false;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
pglGenFramebuffers(TEXTURES, gl->hw_render_fbo);
|
||||
glGenFramebuffers(TEXTURES, gl->hw_render_fbo);
|
||||
|
||||
bool depth = g_extern.system.hw_render_callback.depth;
|
||||
bool stencil = g_extern.system.hw_render_callback.stencil;
|
||||
@ -758,14 +648,14 @@ bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
|
||||
|
||||
if (depth)
|
||||
{
|
||||
pglGenRenderbuffers(TEXTURES, gl->hw_render_depth);
|
||||
glGenRenderbuffers(TEXTURES, gl->hw_render_depth);
|
||||
gl->hw_render_depth_init = true;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < TEXTURES; i++)
|
||||
{
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, gl->hw_render_fbo[i]);
|
||||
pglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->texture[i], 0);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, gl->hw_render_fbo[i]);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->texture[i], 0);
|
||||
|
||||
if (depth)
|
||||
{
|
||||
@ -775,38 +665,38 @@ bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
|
||||
{
|
||||
#ifdef HAVE_OPENGLES2
|
||||
// GLES2 is a bit weird, as always. :P
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES,
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES,
|
||||
width, height);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
// There's no GL_DEPTH_STENCIL_ATTACHMENT like in desktop GL.
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
#else
|
||||
// We use ARB FBO extensions, no need to check.
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
|
||||
width, height);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
pglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
|
||||
width, height);
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
GL_RENDERBUFFER, gl->hw_render_depth[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GLenum status = pglCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
RARCH_ERR("[GL]: Failed to create HW render FBO #%u, error: 0x%u.\n", i, (unsigned)status);
|
||||
@ -943,7 +833,7 @@ static inline void gl_start_frame_fbo(void *data)
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[0]);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[0]);
|
||||
gl_set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true, false);
|
||||
|
||||
// Need to preserve the "flipped" state when in FBO as well to have
|
||||
@ -969,7 +859,7 @@ static void gl_check_fbo_dimensions(void *data)
|
||||
unsigned pow2_size = next_pow2(max);
|
||||
gl->fbo_rect[i].width = gl->fbo_rect[i].height = pow2_size;
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[i]);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[i]);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[i]);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
@ -977,9 +867,9 @@ static void gl_check_fbo_dimensions(void *data)
|
||||
0, RARCH_GL_TEXTURE_TYPE32,
|
||||
RARCH_GL_FORMAT32, NULL);
|
||||
|
||||
pglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->fbo_texture[i], 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->fbo_texture[i], 0);
|
||||
|
||||
GLenum status = pglCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
RARCH_WARN("Failed to reinit FBO texture.\n");
|
||||
|
||||
@ -1023,7 +913,7 @@ static void gl_frame_fbo(void *data, const struct gl_tex_info *tex_info)
|
||||
fbo_info->tex_size[1] = prev_rect->height;
|
||||
memcpy(fbo_info->coord, fbo_tex_coords, sizeof(fbo_tex_coords));
|
||||
|
||||
pglBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[i]);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, gl->fbo[i]);
|
||||
|
||||
if (gl->shader)
|
||||
gl->shader->use(i + 1);
|
||||
@ -1206,7 +1096,7 @@ static void gl_init_textures(void *data, const video_info_t *video)
|
||||
gl_t *gl = (gl_t*)data;
|
||||
#if defined(HAVE_EGL) && defined(HAVE_OPENGLES2)
|
||||
// Use regular textures if we use HW render.
|
||||
gl->egl_images = !gl->hw_render_use && load_eglimage_proc(gl) && context_init_egl_image_buffer_func(video);
|
||||
gl->egl_images = !gl->hw_render_use && check_eglimage_proc() && context_init_egl_image_buffer_func(video);
|
||||
#else
|
||||
(void)video;
|
||||
#endif
|
||||
@ -1294,7 +1184,7 @@ static inline void gl_copy_frame(void *data, const void *frame, unsigned width,
|
||||
}
|
||||
|
||||
if (new_egl)
|
||||
pglEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)img);
|
||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)img);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -1387,7 +1277,7 @@ static inline void gl_set_shader_viewport(void *data, unsigned shader)
|
||||
static void gl_pbo_async_readback(void *data)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
pglBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index++]);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index++]);
|
||||
gl->pbo_readback_index &= 3;
|
||||
|
||||
// If set, we 3 rendered frames already buffered up.
|
||||
@ -1405,7 +1295,7 @@ static void gl_pbo_async_readback(void *data)
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
|
||||
RARCH_PERFORMANCE_STOP(async_readback);
|
||||
|
||||
pglBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1461,7 +1351,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||
|
||||
#ifndef HAVE_OPENGLES
|
||||
if (gl->core_context)
|
||||
pglBindVertexArray(gl->vao);
|
||||
glBindVertexArray(gl->vao);
|
||||
#endif
|
||||
|
||||
if (gl->shader)
|
||||
@ -1610,12 +1500,12 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||
RARCH_PERFORMANCE_INIT(gl_fence);
|
||||
RARCH_PERFORMANCE_START(gl_fence);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->fences[gl->fence_count++] = pglFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
gl->fences[gl->fence_count++] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
while (gl->fence_count > g_settings.video.hard_sync_frames)
|
||||
{
|
||||
pglClientWaitSync(gl->fences[0], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
|
||||
pglDeleteSync(gl->fences[0]);
|
||||
glClientWaitSync(gl->fences[0], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
|
||||
glDeleteSync(gl->fences[0]);
|
||||
|
||||
gl->fence_count--;
|
||||
memmove(gl->fences, gl->fences + 1, gl->fence_count * sizeof(GLsync));
|
||||
@ -1627,7 +1517,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
||||
|
||||
#ifndef HAVE_OPENGLES
|
||||
if (gl->core_context)
|
||||
pglBindVertexArray(0);
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -1647,8 +1537,8 @@ static void gl_free(void *data)
|
||||
{
|
||||
for (unsigned i = 0; i < gl->fence_count; i++)
|
||||
{
|
||||
pglClientWaitSync(gl->fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
|
||||
pglDeleteSync(gl->fences[i]);
|
||||
glClientWaitSync(gl->fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000);
|
||||
glDeleteSync(gl->fences[i]);
|
||||
}
|
||||
gl->fence_count = 0;
|
||||
}
|
||||
@ -1684,7 +1574,7 @@ static void gl_free(void *data)
|
||||
#if !defined(HAVE_OPENGLES) && defined(HAVE_FFMPEG)
|
||||
if (gl->pbo_readback_enable)
|
||||
{
|
||||
pglDeleteBuffers(4, gl->pbo_readback);
|
||||
glDeleteBuffers(4, gl->pbo_readback);
|
||||
scaler_ctx_gen_reset(&gl->pbo_readback_scaler);
|
||||
}
|
||||
#endif
|
||||
@ -1694,9 +1584,9 @@ static void gl_free(void *data)
|
||||
|
||||
#ifndef HAVE_RGL
|
||||
if (gl->hw_render_fbo_init)
|
||||
pglDeleteFramebuffers(TEXTURES, gl->hw_render_fbo);
|
||||
glDeleteFramebuffers(TEXTURES, gl->hw_render_fbo);
|
||||
if (gl->hw_render_depth_init)
|
||||
pglDeleteRenderbuffers(TEXTURES, gl->hw_render_depth);
|
||||
glDeleteRenderbuffers(TEXTURES, gl->hw_render_depth);
|
||||
gl->hw_render_fbo_init = false;
|
||||
#endif
|
||||
#endif
|
||||
@ -1704,8 +1594,8 @@ static void gl_free(void *data)
|
||||
#ifndef HAVE_OPENGLES
|
||||
if (gl->core_context)
|
||||
{
|
||||
pglBindVertexArray(0);
|
||||
pglDeleteVertexArrays(1, &gl->vao);
|
||||
glBindVertexArray(0);
|
||||
glDeleteVertexArrays(1, &gl->vao);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1738,7 +1628,7 @@ static bool resolve_extensions(gl_t *gl)
|
||||
gl->core_context = g_extern.system.hw_render_callback.context_type == RETRO_HW_CONTEXT_OPENGL_CORE;
|
||||
RARCH_LOG("[GL]: Using Core GL context.\n");
|
||||
if (gl->core_context &&
|
||||
!load_vao_proc(gl))
|
||||
!init_vao(gl))
|
||||
{
|
||||
RARCH_ERR("[GL]: Failed to init VAOs.\n");
|
||||
return false;
|
||||
@ -1746,7 +1636,7 @@ static bool resolve_extensions(gl_t *gl)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GL_SYNC
|
||||
gl->have_sync = load_sync_proc(gl);
|
||||
gl->have_sync = check_sync_proc();
|
||||
if (gl->have_sync && g_settings.video.hard_sync)
|
||||
RARCH_LOG("[GL]: Using ARB_sync to reduce latency.\n");
|
||||
#endif
|
||||
@ -1853,14 +1743,14 @@ static void gl_init_pbo_readback(void *data)
|
||||
|
||||
RARCH_LOG("Async PBO readback enabled.\n");
|
||||
|
||||
pglGenBuffers(4, gl->pbo_readback);
|
||||
glGenBuffers(4, gl->pbo_readback);
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
{
|
||||
pglBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[i]);
|
||||
pglBufferData(GL_PIXEL_PACK_BUFFER, gl->vp.width * gl->vp.height * sizeof(uint32_t),
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[i]);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, gl->vp.width * gl->vp.height * sizeof(uint32_t),
|
||||
NULL, GL_STREAM_COPY);
|
||||
}
|
||||
pglBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
|
||||
struct scaler_ctx *scaler = &gl->pbo_readback_scaler;
|
||||
scaler->in_width = gl->vp.width;
|
||||
@ -1877,7 +1767,7 @@ static void gl_init_pbo_readback(void *data)
|
||||
{
|
||||
gl->pbo_readback_enable = false;
|
||||
RARCH_ERR("Failed to init pixel conversion for PBO.\n");
|
||||
pglDeleteBuffers(4, gl->pbo_readback);
|
||||
glDeleteBuffers(4, gl->pbo_readback);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1950,6 +1840,8 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rglgen_resolve_symbols(gl->ctx_driver->get_proc_address);
|
||||
|
||||
RARCH_LOG("Found GL context: %s\n", gl->ctx_driver->ident);
|
||||
|
||||
context_get_video_size_func(&gl->full_x, &gl->full_y);
|
||||
@ -2265,8 +2157,8 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
if (!gl->pbo_readback_valid) // We haven't buffered up enough frames yet, come back later.
|
||||
return false;
|
||||
|
||||
pglBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index]);
|
||||
const void *ptr = pglMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index]);
|
||||
const void *ptr = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
|
||||
if (!ptr)
|
||||
{
|
||||
RARCH_ERR("Failed to map pixel unpack buffer.\n");
|
||||
@ -2274,8 +2166,8 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
|
||||
}
|
||||
|
||||
scaler_ctx_scale(&gl->pbo_readback_scaler, buffer, ptr);
|
||||
pglUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
pglBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
else // Use slow synchronous readbacks. Use this with plain screenshots as we don't really care about performance in this case.
|
||||
#endif
|
||||
|
@ -35,31 +35,11 @@
|
||||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
#if defined(IOS)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#elif defined(HAVE_PSGL)
|
||||
#include <PSGL/psgl.h>
|
||||
#include <PSGL/psglu.h>
|
||||
#include <GLES/glext.h>
|
||||
#elif defined(HAVE_OPENGL_MODERN)
|
||||
#include <GL3/gl3.h>
|
||||
#include <GL3/gl3ext.h>
|
||||
#elif defined(HAVE_OPENGLES2)
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#elif defined(HAVE_OPENGLES1)
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#include "glsym/glsym.h"
|
||||
|
||||
#if defined(ANDROID) && defined(HAVE_GRIFFIN)
|
||||
#include "../griffin/hook_context.h"
|
||||
#else
|
||||
#define context_get_video_size_func(win, height) gl->ctx_driver->get_video_size(win, height)
|
||||
#define context_update_window_title_func() gl->ctx_driver->update_window_title()
|
||||
#define context_destroy_func() gl->ctx_driver->destroy()
|
||||
@ -281,15 +261,6 @@ typedef struct gl
|
||||
GLuint vao;
|
||||
} gl_t;
|
||||
|
||||
// Windows ... <_<
|
||||
#ifdef _WIN32
|
||||
extern PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture;
|
||||
extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
|
||||
#else
|
||||
#define pglClientActiveTexture glClientActiveTexture
|
||||
#define pglActiveTexture glActiveTexture
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PSGL)
|
||||
#define RARCH_GL_INTERNAL_FORMAT32 GL_ARGB_SCE
|
||||
#define RARCH_GL_INTERNAL_FORMAT16 GL_RGB5
|
||||
|
73
gfx/glsym/glgen.py
Executable file
73
gfx/glsym/glgen.py
Executable file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
banned_ext = [ 'AMD', 'APPLE', 'EXT', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ]
|
||||
|
||||
def noext(sym):
|
||||
for ext in banned_ext:
|
||||
if sym.endswith(ext):
|
||||
return False
|
||||
return True
|
||||
|
||||
def find_gl_symbols(lines):
|
||||
typedefs = []
|
||||
syms = []
|
||||
for line in lines:
|
||||
m = re.search(r'^typedef.+PFN(\S+)PROC.+$', line)
|
||||
g = re.search(r'^.+(gl\S+)\W*\(.+\).*$', line)
|
||||
if m and noext(m.group(1)):
|
||||
typedefs.append(m.group(0).replace('PFN', 'RGLSYM'))
|
||||
if g and noext(g.group(1)):
|
||||
syms.append(g.group(1))
|
||||
return (typedefs, syms)
|
||||
|
||||
def generate_defines(gl_syms):
|
||||
res = []
|
||||
for line in gl_syms:
|
||||
res.append('#define {} __rglgen_{}'.format(line, line))
|
||||
return res
|
||||
|
||||
def generate_declarations(gl_syms):
|
||||
return ['RGLSYM' + x.upper() + 'PROC ' + '__rglgen_' + x + ';' for x in gl_syms]
|
||||
|
||||
def generate_macros(gl_syms):
|
||||
return [' SYM(' + x.replace('gl', '') + '),' for x in gl_syms]
|
||||
|
||||
def dump(f, lines):
|
||||
f.write('\n'.join(lines))
|
||||
f.write('\n\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
lines = f.readlines()
|
||||
typedefs, syms = find_gl_symbols(lines)
|
||||
|
||||
overrides = generate_defines(syms)
|
||||
declarations = generate_declarations(syms)
|
||||
externs = ['extern ' + x for x in declarations]
|
||||
|
||||
macros = generate_macros(syms)
|
||||
|
||||
with open(sys.argv[2], 'w') as f:
|
||||
f.write('#ifndef RGLGEN_DECL_H__\n')
|
||||
f.write('#define RGLGEN_DECL_H__\n')
|
||||
dump(f, typedefs)
|
||||
dump(f, overrides)
|
||||
dump(f, externs)
|
||||
f.write('struct rglgen_sym_map { const char *sym; void *ptr; };\n')
|
||||
f.write('extern const struct rglgen_sym_map rglgen_symbol_map[];\n')
|
||||
f.write('#endif\n')
|
||||
|
||||
with open(sys.argv[3], 'w') as f:
|
||||
f.write('#include "glsym.h"\n')
|
||||
f.write('#include <stddef.h>\n')
|
||||
f.write('#define SYM(x) { "gl" #x, &(gl##x) }\n')
|
||||
f.write('const struct rglgen_sym_map rglgen_symbol_map[] = {\n')
|
||||
dump(f, macros)
|
||||
f.write(' { NULL, NULL },\n')
|
||||
f.write('};\n')
|
||||
dump(f, declarations)
|
||||
|
13
gfx/glsym/glsym.h
Normal file
13
gfx/glsym/glsym.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef GLSYM_H__
|
||||
#define GLSYM_H__
|
||||
|
||||
#include "rglgen.h"
|
||||
|
||||
#ifdef HAVE_OPENGLES2
|
||||
#include "glsym_es2.h"
|
||||
#else
|
||||
#include "glsym_gl.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
64
gfx/glsym/glsym_es2.c
Normal file
64
gfx/glsym/glsym_es2.c
Normal file
@ -0,0 +1,64 @@
|
||||
#include "glsym.h"
|
||||
#include <stddef.h>
|
||||
#define SYM(x) { "gl" #x, &(gl##x) }
|
||||
const struct rglgen_sym_map rglgen_symbol_map_rarch[] = {
|
||||
SYM(EGLImageTargetTexture2DOES),
|
||||
SYM(EGLImageTargetRenderbufferStorageOES),
|
||||
SYM(GetProgramBinaryOES),
|
||||
SYM(ProgramBinaryOES),
|
||||
SYM(MapBufferOES),
|
||||
SYM(UnmapBufferOES),
|
||||
SYM(GetBufferPointervOES),
|
||||
SYM(TexImage3DOES),
|
||||
SYM(TexSubImage3DOES),
|
||||
SYM(CopyTexSubImage3DOES),
|
||||
SYM(CompressedTexImage3DOES),
|
||||
SYM(CompressedTexSubImage3DOES),
|
||||
SYM(FramebufferTexture3DOES),
|
||||
SYM(BindVertexArrayOES),
|
||||
SYM(DeleteVertexArraysOES),
|
||||
SYM(GenVertexArraysOES),
|
||||
SYM(IsVertexArrayOES),
|
||||
SYM(DebugMessageControl),
|
||||
SYM(DebugMessageInsert),
|
||||
SYM(DebugMessageCallback),
|
||||
SYM(GetDebugMessageLog),
|
||||
SYM(PushDebugGroup),
|
||||
SYM(PopDebugGroup),
|
||||
SYM(ObjectLabel),
|
||||
SYM(GetObjectLabel),
|
||||
SYM(ObjectPtrLabel),
|
||||
SYM(GetObjectPtrLabel),
|
||||
SYM(GetPointerv),
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES;
|
||||
RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES;
|
||||
RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES;
|
||||
RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES;
|
||||
RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES;
|
||||
RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES;
|
||||
RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES;
|
||||
RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES;
|
||||
RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES;
|
||||
RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES;
|
||||
RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES;
|
||||
RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES;
|
||||
RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES;
|
||||
RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES;
|
||||
RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES;
|
||||
RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES;
|
||||
RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES;
|
||||
RGLSYMGLDEBUGMESSAGECONTROLPROC __rglgen_glDebugMessageControl;
|
||||
RGLSYMGLDEBUGMESSAGEINSERTPROC __rglgen_glDebugMessageInsert;
|
||||
RGLSYMGLDEBUGMESSAGECALLBACKPROC __rglgen_glDebugMessageCallback;
|
||||
RGLSYMGLGETDEBUGMESSAGELOGPROC __rglgen_glGetDebugMessageLog;
|
||||
RGLSYMGLPUSHDEBUGGROUPPROC __rglgen_glPushDebugGroup;
|
||||
RGLSYMGLPOPDEBUGGROUPPROC __rglgen_glPopDebugGroup;
|
||||
RGLSYMGLOBJECTLABELPROC __rglgen_glObjectLabel;
|
||||
RGLSYMGLGETOBJECTLABELPROC __rglgen_glGetObjectLabel;
|
||||
RGLSYMGLOBJECTPTRLABELPROC __rglgen_glObjectPtrLabel;
|
||||
RGLSYMGLGETOBJECTPTRLABELPROC __rglgen_glGetObjectPtrLabel;
|
||||
RGLSYMGLGETPOINTERVPROC __rglgen_glGetPointerv;
|
||||
|
92
gfx/glsym/glsym_es2.h
Normal file
92
gfx/glsym/glsym_es2.h
Normal file
@ -0,0 +1,92 @@
|
||||
#ifndef RGLGEN_DECL_H__
|
||||
#define RGLGEN_DECL_H__
|
||||
typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
|
||||
typedef void* (GL_APIENTRYP RGLSYMGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (GL_APIENTRYP RGLSYMGLUNMAPBUFFEROESPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLBINDVERTEXARRAYOESPROC) (GLuint array);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
|
||||
typedef GLboolean (GL_APIENTRYP RGLSYMGLISVERTEXARRAYOESPROC) (GLuint array);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
|
||||
typedef GLuint (GL_APIENTRYP RGLSYMGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLPOPDEBUGGROUPPROC) (void);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
|
||||
typedef void (GL_APIENTRYP RGLSYMGLGETPOINTERVPROC) (GLenum pname, void **params);
|
||||
|
||||
#define glEGLImageTargetTexture2DOES __rglgen_glEGLImageTargetTexture2DOES
|
||||
#define glEGLImageTargetRenderbufferStorageOES __rglgen_glEGLImageTargetRenderbufferStorageOES
|
||||
#define glGetProgramBinaryOES __rglgen_glGetProgramBinaryOES
|
||||
#define glProgramBinaryOES __rglgen_glProgramBinaryOES
|
||||
#define glMapBufferOES __rglgen_glMapBufferOES
|
||||
#define glUnmapBufferOES __rglgen_glUnmapBufferOES
|
||||
#define glGetBufferPointervOES __rglgen_glGetBufferPointervOES
|
||||
#define glTexImage3DOES __rglgen_glTexImage3DOES
|
||||
#define glTexSubImage3DOES __rglgen_glTexSubImage3DOES
|
||||
#define glCopyTexSubImage3DOES __rglgen_glCopyTexSubImage3DOES
|
||||
#define glCompressedTexImage3DOES __rglgen_glCompressedTexImage3DOES
|
||||
#define glCompressedTexSubImage3DOES __rglgen_glCompressedTexSubImage3DOES
|
||||
#define glFramebufferTexture3DOES __rglgen_glFramebufferTexture3DOES
|
||||
#define glBindVertexArrayOES __rglgen_glBindVertexArrayOES
|
||||
#define glDeleteVertexArraysOES __rglgen_glDeleteVertexArraysOES
|
||||
#define glGenVertexArraysOES __rglgen_glGenVertexArraysOES
|
||||
#define glIsVertexArrayOES __rglgen_glIsVertexArrayOES
|
||||
#define glDebugMessageControl __rglgen_glDebugMessageControl
|
||||
#define glDebugMessageInsert __rglgen_glDebugMessageInsert
|
||||
#define glDebugMessageCallback __rglgen_glDebugMessageCallback
|
||||
#define glGetDebugMessageLog __rglgen_glGetDebugMessageLog
|
||||
#define glPushDebugGroup __rglgen_glPushDebugGroup
|
||||
#define glPopDebugGroup __rglgen_glPopDebugGroup
|
||||
#define glObjectLabel __rglgen_glObjectLabel
|
||||
#define glGetObjectLabel __rglgen_glGetObjectLabel
|
||||
#define glObjectPtrLabel __rglgen_glObjectPtrLabel
|
||||
#define glGetObjectPtrLabel __rglgen_glGetObjectPtrLabel
|
||||
#define glGetPointerv __rglgen_glGetPointerv
|
||||
|
||||
extern RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES;
|
||||
extern RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES;
|
||||
extern RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES;
|
||||
extern RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES;
|
||||
extern RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES;
|
||||
extern RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES;
|
||||
extern RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES;
|
||||
extern RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES;
|
||||
extern RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES;
|
||||
extern RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES;
|
||||
extern RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES;
|
||||
extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES;
|
||||
extern RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES;
|
||||
extern RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES;
|
||||
extern RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES;
|
||||
extern RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES;
|
||||
extern RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES;
|
||||
extern RGLSYMGLDEBUGMESSAGECONTROLPROC __rglgen_glDebugMessageControl;
|
||||
extern RGLSYMGLDEBUGMESSAGEINSERTPROC __rglgen_glDebugMessageInsert;
|
||||
extern RGLSYMGLDEBUGMESSAGECALLBACKPROC __rglgen_glDebugMessageCallback;
|
||||
extern RGLSYMGLGETDEBUGMESSAGELOGPROC __rglgen_glGetDebugMessageLog;
|
||||
extern RGLSYMGLPUSHDEBUGGROUPPROC __rglgen_glPushDebugGroup;
|
||||
extern RGLSYMGLPOPDEBUGGROUPPROC __rglgen_glPopDebugGroup;
|
||||
extern RGLSYMGLOBJECTLABELPROC __rglgen_glObjectLabel;
|
||||
extern RGLSYMGLGETOBJECTLABELPROC __rglgen_glGetObjectLabel;
|
||||
extern RGLSYMGLOBJECTPTRLABELPROC __rglgen_glObjectPtrLabel;
|
||||
extern RGLSYMGLGETOBJECTPTRLABELPROC __rglgen_glGetObjectPtrLabel;
|
||||
extern RGLSYMGLGETPOINTERVPROC __rglgen_glGetPointerv;
|
||||
|
||||
struct rglgen_sym_map { const char *sym; void *ptr; };
|
||||
extern const struct rglgen_sym_map rglgen_symbol_map_rarch[]; // Avoid possible collisions with libretro GL.
|
||||
#endif
|
1739
gfx/glsym/glsym_gl.c
Normal file
1739
gfx/glsym/glsym_gl.c
Normal file
File diff suppressed because it is too large
Load Diff
2597
gfx/glsym/glsym_gl.h
Normal file
2597
gfx/glsym/glsym_gl.h
Normal file
File diff suppressed because it is too large
Load Diff
19
gfx/glsym/rglgen.c
Normal file
19
gfx/glsym/rglgen.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "rglgen.h"
|
||||
#include "glsym.h"
|
||||
#include <string.h>
|
||||
|
||||
void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc,
|
||||
const struct rglgen_sym_map *map)
|
||||
{
|
||||
for (; map->sym; map++)
|
||||
{
|
||||
rglgen_func_t func = proc(map->sym);
|
||||
memcpy(map->ptr, &func, sizeof(func));
|
||||
}
|
||||
}
|
||||
|
||||
void rglgen_resolve_symbols(rglgen_proc_address_t proc)
|
||||
{
|
||||
rglgen_resolve_symbols_custom(proc, rglgen_symbol_map_rarch);
|
||||
}
|
||||
|
47
gfx/glsym/rglgen.h
Normal file
47
gfx/glsym/rglgen.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef RGLGEN_H__
|
||||
#define RGLGEN_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
#if defined(IOS)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#elif defined(HAVE_PSGL)
|
||||
#include <PSGL/psgl.h>
|
||||
#include <PSGL/psglu.h>
|
||||
#include <GLES/glext.h>
|
||||
#elif defined(HAVE_OPENGL_MODERN)
|
||||
#include <GL3/gl3.h>
|
||||
#include <GL3/gl3ext.h>
|
||||
#elif defined(HAVE_OPENGLES2)
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#elif defined(HAVE_OPENGLES1)
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
struct rglgen_sym_map;
|
||||
|
||||
typedef void (*rglgen_func_t)(void);
|
||||
typedef rglgen_func_t (*rglgen_proc_address_t)(const char*);
|
||||
void rglgen_resolve_symbols(rglgen_proc_address_t proc);
|
||||
void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc,
|
||||
const struct rglgen_sym_map *map);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -58,68 +58,6 @@
|
||||
#include "gl_common.h"
|
||||
#include "image.h"
|
||||
|
||||
#if defined(HAVE_OPENGLES2) || defined(HAVE_OPENGL_MODERN) || defined(__APPLE__)
|
||||
#define pglCreateProgram glCreateProgram
|
||||
#define pglUseProgram glUseProgram
|
||||
#define pglCreateShader glCreateShader
|
||||
#define pglDeleteShader glDeleteShader
|
||||
#define pglShaderSource glShaderSource
|
||||
#define pglCompileShader glCompileShader
|
||||
#define pglAttachShader glAttachShader
|
||||
#define pglDetachShader glDetachShader
|
||||
#define pglLinkProgram glLinkProgram
|
||||
#define pglGetUniformLocation glGetUniformLocation
|
||||
#define pglUniform1i glUniform1i
|
||||
#define pglUniform1f glUniform1f
|
||||
#define pglUniform2fv glUniform2fv
|
||||
#define pglUniform4fv glUniform4fv
|
||||
#define pglUniformMatrix4fv glUniformMatrix4fv
|
||||
#define pglGetShaderiv glGetShaderiv
|
||||
#define pglGetShaderInfoLog glGetShaderInfoLog
|
||||
#define pglGetProgramiv glGetProgramiv
|
||||
#define pglGetProgramInfoLog glGetProgramInfoLog
|
||||
#define pglDeleteProgram glDeleteProgram
|
||||
#define pglGetAttachedShaders glGetAttachedShaders
|
||||
#define pglGetAttribLocation glGetAttribLocation
|
||||
#define pglEnableVertexAttribArray glEnableVertexAttribArray
|
||||
#define pglDisableVertexAttribArray glDisableVertexAttribArray
|
||||
#define pglVertexAttribPointer glVertexAttribPointer
|
||||
#define pglGenBuffers glGenBuffers
|
||||
#define pglBufferData glBufferData
|
||||
#define pglDeleteBuffers glDeleteBuffers
|
||||
#define pglBindBuffer glBindBuffer
|
||||
#else
|
||||
static PFNGLCREATEPROGRAMPROC pglCreateProgram;
|
||||
static PFNGLUSEPROGRAMPROC pglUseProgram;
|
||||
static PFNGLCREATESHADERPROC pglCreateShader;
|
||||
static PFNGLDELETESHADERPROC pglDeleteShader;
|
||||
static PFNGLSHADERSOURCEPROC pglShaderSource;
|
||||
static PFNGLCOMPILESHADERPROC pglCompileShader;
|
||||
static PFNGLATTACHSHADERPROC pglAttachShader;
|
||||
static PFNGLDETACHSHADERPROC pglDetachShader;
|
||||
static PFNGLLINKPROGRAMPROC pglLinkProgram;
|
||||
static PFNGLGETUNIFORMLOCATIONPROC pglGetUniformLocation;
|
||||
static PFNGLUNIFORM1IPROC pglUniform1i;
|
||||
static PFNGLUNIFORM1FPROC pglUniform1f;
|
||||
static PFNGLUNIFORM2FVPROC pglUniform2fv;
|
||||
static PFNGLUNIFORM4FVPROC pglUniform4fv;
|
||||
static PFNGLUNIFORMMATRIX4FVPROC pglUniformMatrix4fv;
|
||||
static PFNGLGETSHADERIVPROC pglGetShaderiv;
|
||||
static PFNGLGETSHADERINFOLOGPROC pglGetShaderInfoLog;
|
||||
static PFNGLGETPROGRAMIVPROC pglGetProgramiv;
|
||||
static PFNGLGETPROGRAMINFOLOGPROC pglGetProgramInfoLog;
|
||||
static PFNGLDELETEPROGRAMPROC pglDeleteProgram;
|
||||
static PFNGLGETATTACHEDSHADERSPROC pglGetAttachedShaders;
|
||||
static PFNGLGETATTRIBLOCATIONPROC pglGetAttribLocation;
|
||||
static PFNGLENABLEVERTEXATTRIBARRAYPROC pglEnableVertexAttribArray;
|
||||
static PFNGLDISABLEVERTEXATTRIBARRAYPROC pglDisableVertexAttribArray;
|
||||
static PFNGLVERTEXATTRIBPOINTERPROC pglVertexAttribPointer;
|
||||
static PFNGLGENBUFFERSPROC pglGenBuffers;
|
||||
static PFNGLBUFFERDATAPROC pglBufferData;
|
||||
static PFNGLDELETEBUFFERSPROC pglDeleteBuffers;
|
||||
static PFNGLBINDBUFFERPROC pglBindBuffer;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGLES2
|
||||
#define BORDER_FUNC GL_CLAMP_TO_EDGE
|
||||
#else
|
||||
@ -312,14 +250,14 @@ static GLint get_uniform(GLuint prog, const char *base)
|
||||
char buf[64];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s%s", glsl_shader->prefix, base);
|
||||
GLint loc = pglGetUniformLocation(prog, buf);
|
||||
GLint loc = glGetUniformLocation(prog, buf);
|
||||
if (loc >= 0)
|
||||
return loc;
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s%s", glsl_prefixes[i], base);
|
||||
GLint loc = pglGetUniformLocation(prog, buf);
|
||||
GLint loc = glGetUniformLocation(prog, buf);
|
||||
if (loc >= 0)
|
||||
return loc;
|
||||
}
|
||||
@ -331,14 +269,14 @@ static GLint get_attrib(GLuint prog, const char *base)
|
||||
{
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%s%s", glsl_shader->prefix, base);
|
||||
GLint loc = pglGetUniformLocation(prog, buf);
|
||||
GLint loc = glGetUniformLocation(prog, buf);
|
||||
if (loc >= 0)
|
||||
return loc;
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(glsl_prefixes); i++)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s%s", glsl_prefixes[i], base);
|
||||
GLint loc = pglGetAttribLocation(prog, buf);
|
||||
GLint loc = glGetAttribLocation(prog, buf);
|
||||
if (loc >= 0)
|
||||
return loc;
|
||||
}
|
||||
@ -394,7 +332,7 @@ static void print_shader_log(GLuint obj)
|
||||
GLint info_len = 0;
|
||||
GLint max_len;
|
||||
|
||||
pglGetShaderiv(obj, GL_INFO_LOG_LENGTH, &max_len);
|
||||
glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &max_len);
|
||||
|
||||
if (max_len == 0)
|
||||
return;
|
||||
@ -403,7 +341,7 @@ static void print_shader_log(GLuint obj)
|
||||
if (!info_log)
|
||||
return;
|
||||
|
||||
pglGetShaderInfoLog(obj, max_len, &info_len, info_log);
|
||||
glGetShaderInfoLog(obj, max_len, &info_len, info_log);
|
||||
|
||||
if (info_len > 0)
|
||||
RARCH_LOG("Shader log: %s\n", info_log);
|
||||
@ -416,7 +354,7 @@ static void print_linker_log(GLuint obj)
|
||||
GLint info_len = 0;
|
||||
GLint max_len;
|
||||
|
||||
pglGetProgramiv(obj, GL_INFO_LOG_LENGTH, &max_len);
|
||||
glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &max_len);
|
||||
|
||||
if (max_len == 0)
|
||||
return;
|
||||
@ -425,7 +363,7 @@ static void print_linker_log(GLuint obj)
|
||||
if (!info_log)
|
||||
return;
|
||||
|
||||
pglGetProgramInfoLog(obj, max_len, &info_len, info_log);
|
||||
glGetProgramInfoLog(obj, max_len, &info_len, info_log);
|
||||
|
||||
if (info_len > 0)
|
||||
RARCH_LOG("Linker log: %s\n", info_log);
|
||||
@ -453,11 +391,11 @@ static bool compile_shader(GLuint shader, const char *define, const char *progra
|
||||
}
|
||||
|
||||
const char *source[] = { version, define, program };
|
||||
pglShaderSource(shader, ARRAY_SIZE(source), source, NULL);
|
||||
pglCompileShader(shader);
|
||||
glShaderSource(shader, ARRAY_SIZE(source), source, NULL);
|
||||
glCompileShader(shader);
|
||||
|
||||
GLint status;
|
||||
pglGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||
print_shader_log(shader);
|
||||
|
||||
return status == GL_TRUE;
|
||||
@ -465,15 +403,15 @@ static bool compile_shader(GLuint shader, const char *define, const char *progra
|
||||
|
||||
static bool link_program(GLuint prog)
|
||||
{
|
||||
pglLinkProgram(prog);
|
||||
glLinkProgram(prog);
|
||||
|
||||
GLint status;
|
||||
pglGetProgramiv(prog, GL_LINK_STATUS, &status);
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &status);
|
||||
print_linker_log(prog);
|
||||
|
||||
if (status == GL_TRUE)
|
||||
{
|
||||
pglUseProgram(prog);
|
||||
glUseProgram(prog);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -482,34 +420,34 @@ static bool link_program(GLuint prog)
|
||||
|
||||
static GLuint compile_program(const char *vertex, const char *fragment, unsigned i)
|
||||
{
|
||||
GLuint prog = pglCreateProgram();
|
||||
GLuint prog = glCreateProgram();
|
||||
if (!prog)
|
||||
return 0;
|
||||
|
||||
if (vertex)
|
||||
{
|
||||
RARCH_LOG("Found GLSL vertex shader.\n");
|
||||
GLuint shader = pglCreateShader(GL_VERTEX_SHADER);
|
||||
GLuint shader = glCreateShader(GL_VERTEX_SHADER);
|
||||
if (!compile_shader(shader, "#define VERTEX\n", vertex))
|
||||
{
|
||||
RARCH_ERR("Failed to compile vertex shader #%u\n", i);
|
||||
return false;
|
||||
}
|
||||
|
||||
pglAttachShader(prog, shader);
|
||||
glAttachShader(prog, shader);
|
||||
}
|
||||
|
||||
if (fragment)
|
||||
{
|
||||
RARCH_LOG("Found GLSL fragment shader.\n");
|
||||
GLuint shader = pglCreateShader(GL_FRAGMENT_SHADER);
|
||||
GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
if (!compile_shader(shader, "#define FRAGMENT\n", fragment))
|
||||
{
|
||||
RARCH_ERR("Failed to compile fragment shader #%u\n", i);
|
||||
return false;
|
||||
}
|
||||
|
||||
pglAttachShader(prog, shader);
|
||||
glAttachShader(prog, shader);
|
||||
}
|
||||
|
||||
if (vertex || fragment)
|
||||
@ -521,10 +459,10 @@ static GLuint compile_program(const char *vertex, const char *fragment, unsigned
|
||||
return 0;
|
||||
}
|
||||
|
||||
pglUseProgram(prog);
|
||||
glUseProgram(prog);
|
||||
GLint location = get_uniform(prog, "Texture");
|
||||
pglUniform1i(location, 0);
|
||||
pglUseProgram(0);
|
||||
glUniform1i(location, 0);
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
return prog;
|
||||
@ -573,7 +511,7 @@ static bool compile_programs(GLuint *gl_prog)
|
||||
static void gl_glsl_reset_attrib(void)
|
||||
{
|
||||
for (unsigned i = 0; i < gl_attrib_index; i++)
|
||||
pglDisableVertexAttribArray(gl_attribs[i]);
|
||||
glDisableVertexAttribArray(gl_attribs[i]);
|
||||
gl_attrib_index = 0;
|
||||
}
|
||||
|
||||
@ -583,7 +521,7 @@ static void gl_glsl_set_vbo(GLfloat *buffer, size_t *buffer_elems, const GLfloat
|
||||
{
|
||||
//RARCH_LOG("[GL]: VBO updated with %u elems.\n", (unsigned)elems);
|
||||
memcpy(buffer, data, elems * sizeof(GLfloat));
|
||||
pglBufferData(GL_ARRAY_BUFFER, elems * sizeof(GLfloat), data, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, elems * sizeof(GLfloat), data, GL_STATIC_DRAW);
|
||||
*buffer_elems = elems;
|
||||
}
|
||||
}
|
||||
@ -591,21 +529,21 @@ static void gl_glsl_set_vbo(GLfloat *buffer, size_t *buffer_elems, const GLfloat
|
||||
static void gl_glsl_set_attribs(GLuint vbo, GLfloat *buffer, size_t *buffer_elems,
|
||||
const GLfloat *data, size_t elems, const struct glsl_attrib *attrs, size_t num_attrs)
|
||||
{
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
|
||||
gl_glsl_set_vbo(buffer, buffer_elems, data, elems);
|
||||
|
||||
for (size_t i = 0; i < num_attrs; i++)
|
||||
{
|
||||
GLint loc = attrs[i].loc;
|
||||
pglEnableVertexAttribArray(loc);
|
||||
glEnableVertexAttribArray(loc);
|
||||
gl_attribs[gl_attrib_index++] = loc;
|
||||
|
||||
pglVertexAttribPointer(loc, attrs[i].size, GL_FLOAT, GL_FALSE, 0,
|
||||
glVertexAttribPointer(loc, attrs[i].size, GL_FLOAT, GL_FALSE, 0,
|
||||
(const GLvoid*)(uintptr_t)attrs[i].offset);
|
||||
}
|
||||
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void find_uniforms_frame(GLuint prog, struct shader_uniforms_frame *frame, const char *base)
|
||||
@ -628,7 +566,7 @@ static void find_uniforms_frame(GLuint prog, struct shader_uniforms_frame *frame
|
||||
|
||||
static void find_uniforms(GLuint prog, struct shader_uniforms *uni)
|
||||
{
|
||||
pglUseProgram(prog);
|
||||
glUseProgram(prog);
|
||||
|
||||
uni->mvp = get_uniform(prog, "MVPMatrix");
|
||||
uni->tex_coord = get_attrib(prog, "TexCoord");
|
||||
@ -644,7 +582,7 @@ static void find_uniforms(GLuint prog, struct shader_uniforms *uni)
|
||||
uni->frame_direction = get_uniform(prog, "FrameDirection");
|
||||
|
||||
for (unsigned i = 0; i < glsl_shader->luts; i++)
|
||||
uni->lut_texture[i] = pglGetUniformLocation(prog, glsl_shader->lut[i].id);
|
||||
uni->lut_texture[i] = glGetUniformLocation(prog, glsl_shader->lut[i].id);
|
||||
|
||||
find_uniforms_frame(prog, &uni->orig, "Orig");
|
||||
|
||||
@ -662,7 +600,7 @@ static void find_uniforms(GLuint prog, struct shader_uniforms *uni)
|
||||
find_uniforms_frame(prog, &uni->prev[i], frame_base);
|
||||
}
|
||||
|
||||
pglUseProgram(0);
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
static void gl_glsl_delete_shader(GLuint prog)
|
||||
@ -670,22 +608,14 @@ static void gl_glsl_delete_shader(GLuint prog)
|
||||
GLsizei count;
|
||||
GLuint shaders[2] = {0};
|
||||
|
||||
pglGetAttachedShaders(prog, 2, &count, shaders);
|
||||
glGetAttachedShaders(prog, 2, &count, shaders);
|
||||
for (GLsizei i = 0; i < count; i++)
|
||||
{
|
||||
pglDetachShader(prog, shaders[i]);
|
||||
pglDeleteShader(shaders[i]);
|
||||
glDetachShader(prog, shaders[i]);
|
||||
glDeleteShader(shaders[i]);
|
||||
}
|
||||
|
||||
pglDeleteProgram(prog);
|
||||
}
|
||||
|
||||
// Platforms with broken get_proc_address.
|
||||
// Assume functions are available without proc_address.
|
||||
#undef LOAD_GL_SYM
|
||||
#define LOAD_GL_SYM(SYM) if (!pgl##SYM) { \
|
||||
gfx_ctx_proc_t sym = glsl_get_proc_address("gl" #SYM); \
|
||||
memcpy(&(pgl##SYM), &sym, sizeof(sym)); \
|
||||
glDeleteProgram(prog);
|
||||
}
|
||||
|
||||
static void gl_glsl_free_shader(void)
|
||||
@ -706,7 +636,7 @@ static void gl_glsl_free_shader(void)
|
||||
|
||||
static void gl_glsl_deinit(void)
|
||||
{
|
||||
pglUseProgram(0);
|
||||
glUseProgram(0);
|
||||
for (unsigned i = 0; i < GFX_MAX_SHADERS; i++)
|
||||
{
|
||||
if (gl_program[i] == 0 || (i && gl_program[i] == gl_program[0]))
|
||||
@ -733,57 +663,26 @@ static void gl_glsl_deinit(void)
|
||||
for (unsigned i = 0; i < GFX_MAX_SHADERS; i++)
|
||||
{
|
||||
if (glsl_vbo[i].vbo_primary)
|
||||
pglDeleteBuffers(1, &glsl_vbo[i].vbo_primary);
|
||||
glDeleteBuffers(1, &glsl_vbo[i].vbo_primary);
|
||||
if (glsl_vbo[i].vbo_secondary)
|
||||
pglDeleteBuffers(1, &glsl_vbo[i].vbo_secondary);
|
||||
glDeleteBuffers(1, &glsl_vbo[i].vbo_secondary);
|
||||
}
|
||||
memset(&glsl_vbo, 0, sizeof(glsl_vbo));
|
||||
}
|
||||
|
||||
static bool gl_glsl_init(const char *path)
|
||||
{
|
||||
#if !defined(HAVE_OPENGLES2) && !defined(HAVE_OPENGL_MODERN) && !defined(__APPLE__)
|
||||
// Load shader functions.
|
||||
LOAD_GL_SYM(CreateProgram);
|
||||
LOAD_GL_SYM(UseProgram);
|
||||
LOAD_GL_SYM(CreateShader);
|
||||
LOAD_GL_SYM(DeleteShader);
|
||||
LOAD_GL_SYM(ShaderSource);
|
||||
LOAD_GL_SYM(CompileShader);
|
||||
LOAD_GL_SYM(AttachShader);
|
||||
LOAD_GL_SYM(DetachShader);
|
||||
LOAD_GL_SYM(LinkProgram);
|
||||
LOAD_GL_SYM(GetUniformLocation);
|
||||
LOAD_GL_SYM(Uniform1i);
|
||||
LOAD_GL_SYM(Uniform1f);
|
||||
LOAD_GL_SYM(Uniform2fv);
|
||||
LOAD_GL_SYM(Uniform4fv);
|
||||
LOAD_GL_SYM(UniformMatrix4fv);
|
||||
LOAD_GL_SYM(GetShaderiv);
|
||||
LOAD_GL_SYM(GetShaderInfoLog);
|
||||
LOAD_GL_SYM(GetProgramiv);
|
||||
LOAD_GL_SYM(GetProgramInfoLog);
|
||||
LOAD_GL_SYM(DeleteProgram);
|
||||
LOAD_GL_SYM(GetAttachedShaders);
|
||||
LOAD_GL_SYM(GetAttribLocation);
|
||||
LOAD_GL_SYM(EnableVertexAttribArray);
|
||||
LOAD_GL_SYM(DisableVertexAttribArray);
|
||||
LOAD_GL_SYM(VertexAttribPointer);
|
||||
LOAD_GL_SYM(GenBuffers);
|
||||
LOAD_GL_SYM(BufferData);
|
||||
LOAD_GL_SYM(DeleteBuffers);
|
||||
LOAD_GL_SYM(BindBuffer);
|
||||
|
||||
#ifndef HAVE_OPENGLES2
|
||||
RARCH_LOG("Checking GLSL shader support ...\n");
|
||||
bool shader_support = pglCreateProgram && pglUseProgram && pglCreateShader
|
||||
&& pglDeleteShader && pglShaderSource && pglCompileShader && pglAttachShader
|
||||
&& pglDetachShader && pglLinkProgram && pglGetUniformLocation
|
||||
&& pglUniform1i && pglUniform1f && pglUniform2fv && pglUniform4fv && pglUniformMatrix4fv
|
||||
&& pglGetShaderiv && pglGetShaderInfoLog && pglGetProgramiv && pglGetProgramInfoLog
|
||||
&& pglDeleteProgram && pglGetAttachedShaders
|
||||
&& pglGetAttribLocation && pglEnableVertexAttribArray && pglDisableVertexAttribArray
|
||||
&& pglVertexAttribPointer
|
||||
&& pglGenBuffers && pglBufferData && pglDeleteBuffers && pglBindBuffer;
|
||||
bool shader_support = glCreateProgram && glUseProgram && glCreateShader
|
||||
&& glDeleteShader && glShaderSource && glCompileShader && glAttachShader
|
||||
&& glDetachShader && glLinkProgram && glGetUniformLocation
|
||||
&& glUniform1i && glUniform1f && glUniform2fv && glUniform4fv && glUniformMatrix4fv
|
||||
&& glGetShaderiv && glGetShaderInfoLog && glGetProgramiv && glGetProgramInfoLog
|
||||
&& glDeleteProgram && glGetAttachedShaders
|
||||
&& glGetAttribLocation && glEnableVertexAttribArray && glDisableVertexAttribArray
|
||||
&& glVertexAttribPointer
|
||||
&& glGenBuffers && glBufferData && glDeleteBuffers && glBindBuffer;
|
||||
|
||||
if (!shader_support)
|
||||
{
|
||||
@ -919,8 +818,8 @@ static bool gl_glsl_init(const char *path)
|
||||
|
||||
for (unsigned i = 0; i < GFX_MAX_SHADERS; i++)
|
||||
{
|
||||
pglGenBuffers(1, &glsl_vbo[i].vbo_primary);
|
||||
pglGenBuffers(1, &glsl_vbo[i].vbo_secondary);
|
||||
glGenBuffers(1, &glsl_vbo[i].vbo_primary);
|
||||
glGenBuffers(1, &glsl_vbo[i].vbo_secondary);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -961,33 +860,33 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
float texture_size[2] = {(float)tex_width, (float)tex_height};
|
||||
|
||||
if (uni->input_size >= 0)
|
||||
pglUniform2fv(uni->input_size, 1, input_size);
|
||||
glUniform2fv(uni->input_size, 1, input_size);
|
||||
|
||||
if (uni->output_size >= 0)
|
||||
pglUniform2fv(uni->output_size, 1, output_size);
|
||||
glUniform2fv(uni->output_size, 1, output_size);
|
||||
|
||||
if (uni->texture_size >= 0)
|
||||
pglUniform2fv(uni->texture_size, 1, texture_size);
|
||||
glUniform2fv(uni->texture_size, 1, texture_size);
|
||||
|
||||
if (uni->frame_count >= 0 && active_index)
|
||||
{
|
||||
unsigned modulo = glsl_shader->pass[active_index - 1].frame_count_mod;
|
||||
if (modulo)
|
||||
frame_count %= modulo;
|
||||
pglUniform1i(uni->frame_count, frame_count);
|
||||
glUniform1i(uni->frame_count, frame_count);
|
||||
}
|
||||
|
||||
if (uni->frame_direction >= 0)
|
||||
pglUniform1i(uni->frame_direction, g_extern.frame_is_reverse ? -1 : 1);
|
||||
glUniform1i(uni->frame_direction, g_extern.frame_is_reverse ? -1 : 1);
|
||||
|
||||
for (unsigned i = 0; i < glsl_shader->luts; i++)
|
||||
{
|
||||
if (uni->lut_texture[i] >= 0)
|
||||
{
|
||||
// Have to rebind as HW render could override this.
|
||||
pglActiveTexture(GL_TEXTURE0 + i + 1);
|
||||
glActiveTexture(GL_TEXTURE0 + i + 1);
|
||||
glBindTexture(GL_TEXTURE_2D, gl_teximage[i]);
|
||||
pglUniform1i(uni->lut_texture[i], i + 1);
|
||||
glUniform1i(uni->lut_texture[i], i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -999,18 +898,18 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
if (uni->orig.texture >= 0)
|
||||
{
|
||||
// Bind original texture.
|
||||
pglActiveTexture(GL_TEXTURE0 + texunit);
|
||||
pglUniform1i(uni->orig.texture, texunit);
|
||||
glActiveTexture(GL_TEXTURE0 + texunit);
|
||||
glUniform1i(uni->orig.texture, texunit);
|
||||
glBindTexture(GL_TEXTURE_2D, info->tex);
|
||||
}
|
||||
|
||||
texunit++;
|
||||
|
||||
if (uni->orig.texture_size >= 0)
|
||||
pglUniform2fv(uni->orig.texture_size, 1, info->tex_size);
|
||||
glUniform2fv(uni->orig.texture_size, 1, info->tex_size);
|
||||
|
||||
if (uni->orig.input_size >= 0)
|
||||
pglUniform2fv(uni->orig.input_size, 1, info->input_size);
|
||||
glUniform2fv(uni->orig.input_size, 1, info->input_size);
|
||||
|
||||
// Pass texture coordinates.
|
||||
if (uni->orig.tex_coord >= 0)
|
||||
@ -1028,7 +927,7 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
// Bind new texture in the chain.
|
||||
if (fbo_info_cnt > 0)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE0 + texunit + fbo_info_cnt - 1);
|
||||
glActiveTexture(GL_TEXTURE0 + texunit + fbo_info_cnt - 1);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_info[fbo_info_cnt - 1].tex);
|
||||
}
|
||||
|
||||
@ -1036,15 +935,15 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
for (unsigned i = 0; i < fbo_info_cnt; i++)
|
||||
{
|
||||
if (uni->pass[i].texture)
|
||||
pglUniform1i(uni->pass[i].texture, texunit);
|
||||
glUniform1i(uni->pass[i].texture, texunit);
|
||||
|
||||
texunit++;
|
||||
|
||||
if (uni->pass[i].texture_size >= 0)
|
||||
pglUniform2fv(uni->pass[i].texture_size, 1, fbo_info[i].tex_size);
|
||||
glUniform2fv(uni->pass[i].texture_size, 1, fbo_info[i].tex_size);
|
||||
|
||||
if (uni->pass[i].input_size >= 0)
|
||||
pglUniform2fv(uni->pass[i].input_size, 1, fbo_info[i].input_size);
|
||||
glUniform2fv(uni->pass[i].input_size, 1, fbo_info[i].input_size);
|
||||
|
||||
if (uni->pass[i].tex_coord >= 0)
|
||||
{
|
||||
@ -1063,7 +962,7 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
{
|
||||
// First pass, so unbind everything to avoid collitions.
|
||||
// Unbind ORIG.
|
||||
pglActiveTexture(GL_TEXTURE0 + texunit);
|
||||
glActiveTexture(GL_TEXTURE0 + texunit);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
GLuint base_tex = texunit + 1;
|
||||
@ -1072,7 +971,7 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
// sounds very shaky ... ;)
|
||||
for (unsigned i = 0; i < glsl_shader->passes; i++)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE0 + base_tex + i);
|
||||
glActiveTexture(GL_TEXTURE0 + base_tex + i);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
}
|
||||
@ -1082,18 +981,18 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
{
|
||||
if (uni->prev[i].texture >= 0)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE0 + texunit);
|
||||
glActiveTexture(GL_TEXTURE0 + texunit);
|
||||
glBindTexture(GL_TEXTURE_2D, prev_info[i].tex);
|
||||
pglUniform1i(uni->prev[i].texture, texunit++);
|
||||
glUniform1i(uni->prev[i].texture, texunit++);
|
||||
}
|
||||
|
||||
texunit++;
|
||||
|
||||
if (uni->prev[i].texture_size >= 0)
|
||||
pglUniform2fv(uni->prev[i].texture_size, 1, prev_info[i].tex_size);
|
||||
glUniform2fv(uni->prev[i].texture_size, 1, prev_info[i].tex_size);
|
||||
|
||||
if (uni->prev[i].input_size >= 0)
|
||||
pglUniform2fv(uni->prev[i].input_size, 1, prev_info[i].input_size);
|
||||
glUniform2fv(uni->prev[i].input_size, 1, prev_info[i].input_size);
|
||||
|
||||
// Pass texture coordinates.
|
||||
if (uni->prev[i].tex_coord >= 0)
|
||||
@ -1117,7 +1016,7 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
buffer, size, attribs, attribs_size);
|
||||
}
|
||||
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
if (gl_state_tracker)
|
||||
{
|
||||
@ -1129,8 +1028,8 @@ static void gl_glsl_set_params(unsigned width, unsigned height,
|
||||
|
||||
for (unsigned i = 0; i < cnt; i++)
|
||||
{
|
||||
int location = pglGetUniformLocation(gl_program[active_index], info[i].id);
|
||||
pglUniform1f(location, info[i].value);
|
||||
int location = glGetUniformLocation(gl_program[active_index], info[i].id);
|
||||
glUniform1f(location, info[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1142,7 +1041,7 @@ static bool gl_glsl_set_mvp(const math_matrix *mat)
|
||||
|
||||
int loc = gl_uniforms[active_index].mvp;
|
||||
if (loc >= 0)
|
||||
pglUniformMatrix4fv(loc, 1, GL_FALSE, mat->data);
|
||||
glUniformMatrix4fv(loc, 1, GL_FALSE, mat->data);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1227,7 +1126,7 @@ static void gl_glsl_use(unsigned index)
|
||||
gl_glsl_reset_attrib();
|
||||
|
||||
active_index = index;
|
||||
pglUseProgram(gl_program[index]);
|
||||
glUseProgram(gl_program[index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ check_lib COREAUDIO "-framework AudioUnit" AudioUnitInitialize
|
||||
|
||||
check_pkgconf SDL sdl 1.2.10
|
||||
|
||||
if [ "$HAVE_OPENGL" != 'no' ]; then
|
||||
if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_GLES" != 'yes' ]; then
|
||||
if [ "$OS" = 'Darwin' ]; then
|
||||
check_lib CG "-framework Cg" cgCreateContext
|
||||
else
|
||||
@ -143,7 +143,7 @@ if [ "$HAVE_OPENGL" != 'no' ]; then
|
||||
check_lib_cxx CG -lCg cgCreateContext
|
||||
fi
|
||||
else
|
||||
echo "Ignoring Cg. OpenGL is not enabled."
|
||||
echo "Ignoring Cg. Desktop OpenGL is not enabled."
|
||||
HAVE_CG='no'
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user