This commit is contained in:
twinaphex 2017-11-08 02:36:38 +01:00
parent dc664ff4f2
commit 96876c66ce
2 changed files with 23 additions and 32 deletions

View File

@ -110,12 +110,8 @@ typedef struct cg_shader_data
struct video_shader *shader;
char alias_define[GFX_MAX_SHADERS][128];
unsigned active_idx;
struct
{
CGparameter elems[32 * PREV_TEXTURES + 2 + 4 + GFX_MAX_SHADERS];
unsigned index;
} attribs;
unsigned attribs_index;
CGparameter attribs_elems[32 * PREV_TEXTURES + 2 + 4 + GFX_MAX_SHADERS];
CGprofile cgVProf;
CGprofile cgFProf;
struct shader_program_cg prg[GFX_MAX_SHADERS];
@ -133,7 +129,7 @@ struct uniform_cg
{ \
cgGLSetParameterPointer(param, len, GL_FLOAT, 0, ptr); \
cgGLEnableClientState(param); \
cg->attribs.elems[cg->attribs.index++] = param; \
cg->attribs_elems[cg->attribs_index++] = param; \
}
#define cg_gl_set_texture_parameter(param, texture) \
@ -250,11 +246,11 @@ static void gl_cg_reset_attrib(void *data)
cg_shader_data_t *cg = (cg_shader_data_t*)data;
/* Add sanity check that we did not overflow. */
retro_assert(cg->attribs.index <= ARRAY_SIZE(cg->attribs.elems));
retro_assert(cg->attribs_index <= ARRAY_SIZE(cg->attribs_elems));
for (i = 0; i < cg->attribs.index; i++)
cgGLDisableClientState(cg->attribs.elems[i]);
cg->attribs.index = 0;
for (i = 0; i < cg->attribs_index; i++)
cgGLDisableClientState(cg->attribs_elems[i]);
cg->attribs_index = 0;
}
static bool gl_cg_set_mvp(void *data, void *shader_data, const math_matrix_4x4 *mat)

View File

@ -43,12 +43,11 @@
struct cache_vbo
{
GLuint vbo_primary;
GLfloat *buffer_primary;
size_t size_primary;
GLuint vbo_secondary;
GLfloat *buffer_secondary;
size_t size_primary;
size_t size_secondary;
GLfloat *buffer_primary;
GLfloat *buffer_secondary;
};
struct shader_program_glsl_data
@ -89,10 +88,10 @@ struct shader_uniforms
int texture_size;
int frame_count;
unsigned frame_count_mod;
int frame_direction;
int lut_texture[GFX_MAX_TEXTURES];
unsigned frame_count_mod;
struct shader_uniforms_frame orig;
struct shader_uniforms_frame feedback;
@ -134,19 +133,15 @@ static const char *glsl_prefixes[] = {
typedef struct glsl_shader_data
{
struct video_shader *shader;
char alias_define[1024];
GLint attribs_elems[32 * PREV_TEXTURES + 2 + 4 + GFX_MAX_SHADERS];
unsigned attribs_index;
unsigned active_idx;
GLuint lut_textures[GFX_MAX_TEXTURES];
struct shader_uniforms uniforms[GFX_MAX_SHADERS];
struct cache_vbo vbo[GFX_MAX_SHADERS];
char alias_define[1024];
unsigned active_idx;
struct
{
GLint elems[32 * PREV_TEXTURES + 2 + 4 + GFX_MAX_SHADERS];
unsigned index;
} attribs;
struct shader_program_glsl_data prg[GFX_MAX_SHADERS];
GLuint lut_textures[GFX_MAX_TEXTURES];
struct video_shader *shader;
state_tracker_t *state_tracker;
} glsl_shader_data_t;
@ -563,11 +558,11 @@ static void gl_glsl_reset_attrib(glsl_shader_data_t *glsl)
unsigned i;
/* Add sanity check that we did not overflow. */
retro_assert(glsl->attribs.index <= ARRAY_SIZE(glsl->attribs.elems));
retro_assert(glsl->attribs_index <= ARRAY_SIZE(glsl->attribs_elems));
for (i = 0; i < glsl->attribs.index; i++)
glDisableVertexAttribArray(glsl->attribs.elems[i]);
glsl->attribs.index = 0;
for (i = 0; i < glsl->attribs_index; i++)
glDisableVertexAttribArray(glsl->attribs_elems[i]);
glsl->attribs_index = 0;
}
static void gl_glsl_set_vbo(GLfloat **buffer, size_t *buffer_elems,
@ -603,14 +598,14 @@ static INLINE void gl_glsl_set_attribs(glsl_shader_data_t *glsl,
for (i = 0; i < num_attrs; i++)
{
if (glsl->attribs.index < ARRAY_SIZE(glsl->attribs.elems))
if (glsl->attribs_index < ARRAY_SIZE(glsl->attribs_elems))
{
GLint loc = attrs[i].loc;
glEnableVertexAttribArray(loc);
glVertexAttribPointer(loc, attrs[i].size, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*)(uintptr_t)attrs[i].offset);
glsl->attribs.elems[glsl->attribs.index++] = loc;
glsl->attribs_elems[glsl->attribs_index++] = loc;
}
else
RARCH_WARN("Attrib array buffer was overflown!\n");