mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-26 17:50:56 +00:00
Update GLSM
This commit is contained in:
parent
4676d16f8d
commit
39742dae1f
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glsym/glsym.h>
|
||||
#include <glsm/glsm.h>
|
||||
|
||||
@ -28,7 +29,7 @@ struct gl_cached_state
|
||||
{
|
||||
struct
|
||||
{
|
||||
GLuint ids[MAX_TEXTURE];
|
||||
GLuint *ids;
|
||||
} bind_textures;
|
||||
|
||||
#ifndef HAVE_OPENGLES
|
||||
@ -176,6 +177,7 @@ struct gl_cached_state
|
||||
int cap_translate[SGL_CAP_MAX];
|
||||
};
|
||||
|
||||
static GLint glsm_max_textures;
|
||||
static struct retro_hw_render_callback hw_render;
|
||||
static struct gl_cached_state gl_state;
|
||||
|
||||
@ -1853,6 +1855,10 @@ static void glsm_state_setup(void)
|
||||
for (i = 0; i < MAX_ATTRIB; i++)
|
||||
gl_state.vertex_attrib_pointer.enabled[i] = 0;
|
||||
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &glsm_max_textures);
|
||||
|
||||
gl_state.bind_textures.ids = (GLuint*)calloc(glsm_max_textures, sizeof(GLuint));
|
||||
|
||||
gl_state.framebuf = hw_render.get_current_framebuffer();
|
||||
gl_state.cullface.mode = GL_BACK;
|
||||
gl_state.frontface.mode = GL_CCW;
|
||||
@ -1978,7 +1984,7 @@ static void glsm_state_bind(void)
|
||||
gl_state.stencilfunc.ref,
|
||||
gl_state.stencilfunc.mask);
|
||||
|
||||
for (i = 0; i < MAX_TEXTURE; i ++)
|
||||
for (i = 0; i < glsm_max_textures; i ++)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, gl_state.bind_textures.ids[i]);
|
||||
@ -2035,7 +2041,7 @@ static void glsm_state_unbind(void)
|
||||
glStencilFunc(GL_ALWAYS,0,1);
|
||||
|
||||
/* Clear textures */
|
||||
for (i = 0; i < MAX_TEXTURE; i ++)
|
||||
for (i = 0; i < glsm_max_textures; i ++)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
@ -2048,6 +2054,13 @@ static void glsm_state_unbind(void)
|
||||
glBindFramebuffer(RARCH_GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
static bool glsm_state_ctx_destroy(void *data)
|
||||
{
|
||||
if (gl_state.bind_textures.ids)
|
||||
free(gl_state.bind_textures.ids);
|
||||
gl_state.bind_textures.ids = NULL;
|
||||
}
|
||||
|
||||
static bool glsm_state_ctx_init(void *data)
|
||||
{
|
||||
glsm_ctx_params_t *params = (glsm_ctx_params_t*)data;
|
||||
@ -2117,6 +2130,9 @@ bool glsm_ctl(enum glsm_state_ctl state, void *data)
|
||||
case GLSM_CTL_STATE_CONTEXT_RESET:
|
||||
rglgen_resolve_symbols(hw_render.get_proc_address);
|
||||
break;
|
||||
case GLSM_CTL_STATE_CONTEXT_DESTROY:
|
||||
glsm_state_ctx_destroy(data);
|
||||
break;
|
||||
case GLSM_CTL_STATE_CONTEXT_INIT:
|
||||
return glsm_state_ctx_init(data);
|
||||
case GLSM_CTL_STATE_SETUP:
|
||||
|
@ -85,7 +85,6 @@ typedef GLclampf GLclampd;
|
||||
#endif
|
||||
|
||||
#define MAX_ATTRIB 8
|
||||
#define MAX_TEXTURE 32
|
||||
|
||||
enum
|
||||
{
|
||||
@ -117,6 +116,7 @@ enum glsm_state_ctl
|
||||
GLSM_CTL_STATE_BIND,
|
||||
GLSM_CTL_STATE_UNBIND,
|
||||
GLSM_CTL_STATE_CONTEXT_RESET,
|
||||
GLSM_CTL_STATE_CONTEXT_DESTROY,
|
||||
GLSM_CTL_STATE_CONTEXT_INIT,
|
||||
GLSM_CTL_IS_IMM_VBO,
|
||||
GLSM_CTL_SET_IMM_VBO,
|
||||
|
Loading…
Reference in New Issue
Block a user