Shorten some variables

This commit is contained in:
twinaphex 2015-07-10 19:17:26 +02:00
parent 2f9e8b44e3
commit 4c9077568d
2 changed files with 122 additions and 122 deletions

View File

@ -149,7 +149,7 @@ typedef struct cg_shader_data
unsigned cg_attrib_idx;
CGprofile cgVProf;
CGprofile cgFProf;
struct video_shader *cg_shader;
struct video_shader *shader;
state_tracker_t *state_tracker;
GLuint lut_textures[GFX_MAX_TEXTURES];
CGparameter cg_attribs[PREV_TEXTURES + 1 + 4 + GFX_MAX_SHADERS];
@ -260,7 +260,7 @@ static void gl_cg_set_params(void *data, unsigned width, unsigned height,
if (cg->prg[cg->active_idx].frame_cnt_f || cg->prg[cg->active_idx].frame_cnt_v)
{
unsigned modulo = cg->cg_shader->pass[cg->active_idx - 1].frame_count_mod;
unsigned modulo = cg->shader->pass[cg->active_idx - 1].frame_count_mod;
if (modulo)
frame_count %= modulo;
@ -322,11 +322,11 @@ static void gl_cg_set_params(void *data, unsigned width, unsigned height,
}
/* Set lookup textures. */
for (i = 0; i < cg->cg_shader->luts; i++)
for (i = 0; i < cg->shader->luts; i++)
{
CGparameter vparam;
CGparameter fparam = cgGetNamedParameter(
cg->prg[cg->active_idx].fprg, cg->cg_shader->lut[i].id);
cg->prg[cg->active_idx].fprg, cg->shader->lut[i].id);
if (fparam)
{
@ -335,7 +335,7 @@ static void gl_cg_set_params(void *data, unsigned width, unsigned height,
}
vparam = cgGetNamedParameter(cg->prg[cg->active_idx].vprg,
cg->cg_shader->lut[i].id);
cg->shader->lut[i].id);
if (vparam)
{
@ -377,14 +377,14 @@ static void gl_cg_set_params(void *data, unsigned width, unsigned height,
}
/* #pragma parameters. */
for (i = 0; i < cg->cg_shader->num_parameters; i++)
for (i = 0; i < cg->shader->num_parameters; i++)
{
CGparameter param_v = cgGetNamedParameter(
cg->prg[cg->active_idx].vprg, cg->cg_shader->parameters[i].id);
cg->prg[cg->active_idx].vprg, cg->shader->parameters[i].id);
CGparameter param_f = cgGetNamedParameter(
cg->prg[cg->active_idx].fprg, cg->cg_shader->parameters[i].id);
set_param_1f(param_v, cg->cg_shader->parameters[i].current);
set_param_1f(param_f, cg->cg_shader->parameters[i].current);
cg->prg[cg->active_idx].fprg, cg->shader->parameters[i].id);
set_param_1f(param_v, cg->shader->parameters[i].current);
set_param_1f(param_f, cg->shader->parameters[i].current);
}
/* Set state parameters. */
@ -447,9 +447,9 @@ static void gl_cg_destroy_resources(cg_shader_data_t *cg)
gl_cg_deinit_progs(cg);
if (cg->cg_shader && cg->cg_shader->luts)
if (cg->shader && cg->shader->luts)
{
glDeleteTextures(cg->cg_shader->luts, cg->lut_textures);
glDeleteTextures(cg->shader->luts, cg->lut_textures);
memset(cg->lut_textures, 0, sizeof(cg->lut_textures));
}
@ -459,8 +459,8 @@ static void gl_cg_destroy_resources(cg_shader_data_t *cg)
cg->state_tracker = NULL;
}
free(cg->cg_shader);
cg->cg_shader = NULL;
free(cg->shader);
cg->shader = NULL;
}
/* Final deinit. */
@ -575,17 +575,17 @@ static bool load_plain(cg_shader_data_t *cg, const char *path)
if (!load_stock(cg))
return false;
cg->cg_shader = (struct video_shader*)calloc(1, sizeof(*cg->cg_shader));
if (!cg->cg_shader)
cg->shader = (struct video_shader*)calloc(1, sizeof(*cg->shader));
if (!cg->shader)
return false;
cg->cg_shader->passes = 1;
cg->shader->passes = 1;
if (path)
{
RARCH_LOG("Loading Cg file: %s\n", path);
strlcpy(cg->cg_shader->pass[0].source.path, path,
sizeof(cg->cg_shader->pass[0].source.path));
strlcpy(cg->shader->pass[0].source.path, path,
sizeof(cg->shader->pass[0].source.path));
if (!load_program(cg, 1, path, true))
return false;
}
@ -595,7 +595,7 @@ static bool load_plain(cg_shader_data_t *cg, const char *path)
cg->prg[1] = cg->prg[0];
}
video_shader_resolve_parameters(NULL, cg->cg_shader);
video_shader_resolve_parameters(NULL, cg->shader);
return true;
}
@ -604,13 +604,13 @@ static bool gl_cg_load_imports(cg_shader_data_t *cg)
unsigned i;
struct state_tracker_info tracker_info = {0};
if (!cg->cg_shader->variables)
if (!cg->shader->variables)
return true;
for (i = 0; i < cg->cg_shader->variables; i++)
for (i = 0; i < cg->shader->variables; i++)
{
unsigned memtype;
switch (cg->cg_shader->variable[i].ram_type)
switch (cg->shader->variable[i].ram_type)
{
case RARCH_STATE_WRAM:
memtype = RETRO_MEMORY_SYSTEM_RAM;
@ -621,7 +621,7 @@ static bool gl_cg_load_imports(cg_shader_data_t *cg)
}
if ((memtype != -1u) &&
(cg->cg_shader->variable[i].addr >= pretro_get_memory_size(memtype)))
(cg->shader->variable[i].addr >= pretro_get_memory_size(memtype)))
{
RARCH_ERR("Address out of bounds.\n");
return false;
@ -630,18 +630,18 @@ static bool gl_cg_load_imports(cg_shader_data_t *cg)
tracker_info.wram = (uint8_t*)
pretro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM);
tracker_info.info = cg->cg_shader->variable;
tracker_info.info_elem = cg->cg_shader->variables;
tracker_info.info = cg->shader->variable;
tracker_info.info_elem = cg->shader->variables;
#ifdef HAVE_PYTHON
if (*cg->cg_shader->script_path)
if (*cg->shader->script_path)
{
tracker_info.script = cg->cg_shader->script_path;
tracker_info.script = cg->shader->script_path;
tracker_info.script_is_file = true;
}
tracker_info.script_class =
*cg->cg_shader->script_class ? cg->cg_shader->script_class : NULL;
*cg->shader->script_class ? cg->shader->script_class : NULL;
#endif
cg->state_tracker = state_tracker_init(&tracker_info);
@ -654,10 +654,10 @@ static bool gl_cg_load_imports(cg_shader_data_t *cg)
static bool load_shader(cg_shader_data_t *cg, unsigned i)
{
RARCH_LOG("Loading Cg shader: \"%s\".\n",
cg->cg_shader->pass[i].source.path);
cg->shader->pass[i].source.path);
if (!load_program(cg, i + 1,
cg->cg_shader->pass[i].source.path, true))
cg->shader->pass[i].source.path, true))
return false;
return true;
@ -679,39 +679,39 @@ static bool load_preset(cg_shader_data_t *cg, const char *path)
return false;
}
cg->cg_shader = (struct video_shader*)calloc(1, sizeof(*cg->cg_shader));
if (!cg->cg_shader)
cg->shader = (struct video_shader*)calloc(1, sizeof(*cg->shader));
if (!cg->shader)
{
config_file_free(conf);
return false;
}
if (!video_shader_read_conf_cgp(conf, cg->cg_shader))
if (!video_shader_read_conf_cgp(conf, cg->shader))
{
RARCH_ERR("Failed to parse CGP file.\n");
config_file_free(conf);
return false;
}
video_shader_resolve_relative(cg->cg_shader, path);
video_shader_resolve_parameters(conf, cg->cg_shader);
video_shader_resolve_relative(cg->shader, path);
video_shader_resolve_parameters(conf, cg->shader);
config_file_free(conf);
if (cg->cg_shader->passes > GFX_MAX_SHADERS - 3)
if (cg->shader->passes > GFX_MAX_SHADERS - 3)
{
RARCH_WARN("Too many shaders ... Capping shader amount to %d.\n",
GFX_MAX_SHADERS - 3);
cg->cg_shader->passes = GFX_MAX_SHADERS - 3;
cg->shader->passes = GFX_MAX_SHADERS - 3;
}
for (i = 0; i < cg->cg_shader->passes; i++)
if (*cg->cg_shader->pass[i].alias)
for (i = 0; i < cg->shader->passes; i++)
if (*cg->shader->pass[i].alias)
snprintf(cg->cg_alias_define[i],
sizeof(cg->cg_alias_define[i]),
"-D%s_ALIAS",
cg->cg_shader->pass[i].alias);
cg->shader->pass[i].alias);
for (i = 0; i < cg->cg_shader->passes; i++)
for (i = 0; i < cg->shader->passes; i++)
{
if (!load_shader(cg, i))
{
@ -720,7 +720,7 @@ static bool load_preset(cg_shader_data_t *cg, const char *path)
}
}
if (!gl_load_luts(cg->cg_shader, cg->lut_textures))
if (!gl_load_luts(cg->shader, cg->lut_textures))
{
RARCH_ERR("Failed to load lookup textures ...\n");
return false;
@ -907,8 +907,8 @@ static void set_program_attributes(cg_shader_data_t *cg, unsigned i)
snprintf(pass_str, sizeof(pass_str), "PASSPREV%u", i - (j + 1));
set_pass_attrib(&cg->prg[i], &cg->prg[i].fbo[j], pass_str);
if (*cg->cg_shader->pass[j].alias)
set_pass_attrib(&cg->prg[i], &cg->prg[i].fbo[j], cg->cg_shader->pass[j].alias);
if (*cg->shader->pass[j].alias)
set_pass_attrib(&cg->prg[i], &cg->prg[i].fbo[j], cg->shader->pass[j].alias);
}
}
@ -977,7 +977,7 @@ static bool gl_cg_init(void *data, const char *path)
}
cg->prg[0].mvp = cgGetNamedParameter(cg->prg[0].vprg, "IN.mvp_matrix");
for (i = 1; i <= cg->cg_shader->passes; i++)
for (i = 1; i <= cg->shader->passes; i++)
set_program_attributes(cg, i);
/* If we aren't using last pass non-FBO shader,
@ -985,7 +985,7 @@ static bool gl_cg_init(void *data, const char *path)
*
* Just use prg[0] for that pass, which will be
* pass-through. */
cg->prg[cg->cg_shader->passes + 1] = cg->prg[0];
cg->prg[cg->shader->passes + 1] = cg->prg[0];
/* No need to apply Android hack in Cg. */
cg->prg[GL_SHADER_STOCK_BLEND] = cg->prg[0];
@ -1026,7 +1026,7 @@ static unsigned gl_cg_num(void)
cg_shader_data_t *cg = (cg_shader_data_t*)driver->video_shader_data;
if (!cg)
return 0;
return cg->cg_shader->passes;
return cg->shader->passes;
}
static bool gl_cg_filter_type(unsigned idx, bool *smooth)
@ -1034,10 +1034,10 @@ static bool gl_cg_filter_type(unsigned idx, bool *smooth)
driver_t *driver = driver_get_ptr();
cg_shader_data_t *cg = (cg_shader_data_t*)driver->video_shader_data;
if (cg && idx &&
(cg->cg_shader->pass[idx - 1].filter != RARCH_FILTER_UNSPEC)
(cg->shader->pass[idx - 1].filter != RARCH_FILTER_UNSPEC)
)
{
*smooth = (cg->cg_shader->pass[idx - 1].filter == RARCH_FILTER_LINEAR);
*smooth = (cg->shader->pass[idx - 1].filter == RARCH_FILTER_LINEAR);
return true;
}
@ -1049,7 +1049,7 @@ static enum gfx_wrap_type gl_cg_wrap_type(unsigned idx)
driver_t *driver = driver_get_ptr();
cg_shader_data_t *cg = (cg_shader_data_t*)driver->video_shader_data;
if (cg && idx)
return cg->cg_shader->pass[idx - 1].wrap;
return cg->shader->pass[idx - 1].wrap;
return RARCH_WRAP_BORDER;
}
@ -1058,7 +1058,7 @@ static void gl_cg_shader_scale(unsigned idx, struct gfx_fbo_scale *scale)
driver_t *driver = driver_get_ptr();
cg_shader_data_t *cg = (cg_shader_data_t*)driver->video_shader_data;
if (cg && idx)
*scale = cg->cg_shader->pass[idx - 1].fbo;
*scale = cg->shader->pass[idx - 1].fbo;
else
scale->valid = false;
}
@ -1073,7 +1073,7 @@ static unsigned gl_cg_get_prev_textures(void)
if (!cg)
return 0;
for (i = 1; i <= cg->cg_shader->passes; i++)
for (i = 1; i <= cg->shader->passes; i++)
for (j = 0; j < PREV_TEXTURES; j++)
if (cg->prg[i].prev[j].tex)
max_prev = max(j + 1, max_prev);
@ -1086,7 +1086,7 @@ static bool gl_cg_mipmap_input(unsigned idx)
driver_t *driver = driver_get_ptr();
cg_shader_data_t *cg = (cg_shader_data_t*)driver->video_shader_data;
if (cg && idx)
return cg->cg_shader->pass[idx - 1].mipmap;
return cg->shader->pass[idx - 1].mipmap;
return false;
}
@ -1096,7 +1096,7 @@ static struct video_shader *gl_cg_get_current_shader(void)
cg_shader_data_t *cg = (cg_shader_data_t*)driver->video_shader_data;
if (!cg)
return NULL;
return cg->cg_shader;
return cg->shader;
}
const shader_backend_t gl_cg_backend = {

View File

@ -204,7 +204,7 @@ static const char *stock_fragment_core_blend =
typedef struct glsl_shader_data
{
struct video_shader *glsl_shader;
struct video_shader *shader;
struct shader_uniforms gl_uniforms[GFX_MAX_SHADERS];
struct cache_vbo glsl_vbo[GFX_MAX_SHADERS];
char glsl_alias_define[1024];
@ -227,7 +227,7 @@ static GLint get_uniform(glsl_shader_data_t *glsl,
GLint loc;
char buf[64] = {0};
snprintf(buf, sizeof(buf), "%s%s", glsl->glsl_shader->prefix, base);
snprintf(buf, sizeof(buf), "%s%s", glsl->shader->prefix, base);
loc = glGetUniformLocation(prog, buf);
if (loc >= 0)
return loc;
@ -250,7 +250,7 @@ static GLint get_attrib(glsl_shader_data_t *glsl,
GLint loc;
char buf[64] = {0};
snprintf(buf, sizeof(buf), "%s%s", glsl->glsl_shader->prefix, base);
snprintf(buf, sizeof(buf), "%s%s", glsl->shader->prefix, base);
loc = glGetUniformLocation(prog, buf);
if (loc >= 0)
return loc;
@ -451,12 +451,12 @@ static bool compile_programs(glsl_shader_data_t *glsl, GLuint *gl_prog)
{
unsigned i;
for (i = 0; i < glsl->glsl_shader->passes; i++)
for (i = 0; i < glsl->shader->passes; i++)
{
const char *vertex = NULL;
const char *fragment = NULL;
struct video_shader_pass *pass = (struct video_shader_pass*)
&glsl->glsl_shader->pass[i];
&glsl->shader->pass[i];
/* If we load from GLSLP (CGP),
* load the file here, and pretend
@ -601,8 +601,8 @@ static void find_uniforms(glsl_shader_data_t *glsl,
uni->frame_count = get_uniform(glsl, prog, "FrameCount");
uni->frame_direction = get_uniform(glsl, prog, "FrameDirection");
for (i = 0; i < glsl->glsl_shader->luts; i++)
uni->lut_texture[i] = glGetUniformLocation(prog, glsl->glsl_shader->lut[i].id);
for (i = 0; i < glsl->shader->luts; i++)
uni->lut_texture[i] = glGetUniformLocation(prog, glsl->shader->lut[i].id);
clear_uniforms_frame(&uni->orig);
find_uniforms_frame(glsl, prog, &uni->orig, "Orig");
@ -620,8 +620,8 @@ static void find_uniforms(glsl_shader_data_t *glsl,
snprintf(frame_base, sizeof(frame_base), "PassPrev%u", pass - (i + 1));
find_uniforms_frame(glsl, prog, &uni->pass[i], frame_base);
if (*glsl->glsl_shader->pass[i].alias)
find_uniforms_frame(glsl, prog, &uni->pass[i], glsl->glsl_shader->pass[i].alias);
if (*glsl->shader->pass[i].alias)
find_uniforms_frame(glsl, prog, &uni->pass[i], glsl->shader->pass[i].alias);
}
clear_uniforms_frame(&uni->prev[0]);
@ -640,18 +640,18 @@ static void gl_glsl_deinit_shader(glsl_shader_data_t *glsl)
{
unsigned i;
if (!glsl || !glsl->glsl_shader)
if (!glsl || !glsl->shader)
return;
for (i = 0; i < glsl->glsl_shader->passes; i++)
for (i = 0; i < glsl->shader->passes; i++)
{
free(glsl->glsl_shader->pass[i].source.string.vertex);
free(glsl->glsl_shader->pass[i].source.string.fragment);
free(glsl->shader->pass[i].source.string.vertex);
free(glsl->shader->pass[i].source.string.fragment);
}
free(glsl->glsl_shader->script);
free(glsl->glsl_shader);
glsl->glsl_shader = NULL;
free(glsl->shader->script);
free(glsl->shader);
glsl->shader = NULL;
}
static void gl_glsl_destroy_resources(glsl_shader_data_t *glsl)
@ -670,8 +670,8 @@ static void gl_glsl_destroy_resources(glsl_shader_data_t *glsl)
glDeleteProgram(glsl->gl_program[i]);
}
if (glsl->glsl_shader && glsl->glsl_shader->luts)
glDeleteTextures(glsl->glsl_shader->luts, glsl->gl_teximage);
if (glsl->shader && glsl->shader->luts)
glDeleteTextures(glsl->shader->luts, glsl->gl_teximage);
memset(glsl->gl_program, 0, sizeof(glsl->gl_program));
memset(glsl->gl_uniforms, 0, sizeof(glsl->gl_uniforms));
@ -752,8 +752,8 @@ static bool gl_glsl_init(void *data, const char *path)
}
#endif
glsl->glsl_shader = (struct video_shader*)calloc(1, sizeof(*glsl->glsl_shader));
if (!glsl->glsl_shader)
glsl->shader = (struct video_shader*)calloc(1, sizeof(*glsl->shader));
if (!glsl->shader)
{
free(glsl);
return false;
@ -766,10 +766,10 @@ static bool gl_glsl_init(void *data, const char *path)
if (!strcmp(path_ext, "glsl"))
{
strlcpy(glsl->glsl_shader->pass[0].source.path, path,
sizeof(glsl->glsl_shader->pass[0].source.path));
glsl->glsl_shader->passes = 1;
glsl->glsl_shader->modern = true;
strlcpy(glsl->shader->pass[0].source.path, path,
sizeof(glsl->shader->pass[0].source.path));
glsl->shader->passes = 1;
glsl->shader->modern = true;
ret = true;
}
else if (!strcmp(path_ext, "glslp"))
@ -777,8 +777,8 @@ static bool gl_glsl_init(void *data, const char *path)
conf = config_file_new(path);
if (conf)
{
ret = video_shader_read_conf_cgp(conf, glsl->glsl_shader);
glsl->glsl_shader->modern = true;
ret = video_shader_read_conf_cgp(conf, glsl->shader);
glsl->shader->modern = true;
}
else
ret = false;
@ -789,7 +789,7 @@ static bool gl_glsl_init(void *data, const char *path)
if (!ret)
{
RARCH_ERR("[GL]: Failed to parse GLSL shader.\n");
free(glsl->glsl_shader);
free(glsl->shader);
free(glsl);
return false;
}
@ -797,16 +797,16 @@ static bool gl_glsl_init(void *data, const char *path)
else
{
RARCH_WARN("[GL]: Stock GLSL shaders will be used.\n");
glsl->glsl_shader->passes = 1;
glsl->glsl_shader->pass[0].source.string.vertex =
glsl->shader->passes = 1;
glsl->shader->pass[0].source.string.vertex =
strdup(glsl_core ? stock_vertex_core : stock_vertex_modern);
glsl->glsl_shader->pass[0].source.string.fragment =
glsl->shader->pass[0].source.string.fragment =
strdup(glsl_core ? stock_fragment_core : stock_fragment_modern);
glsl->glsl_shader->modern = true;
glsl->shader->modern = true;
}
video_shader_resolve_relative(glsl->glsl_shader, path);
video_shader_resolve_parameters(conf, glsl->glsl_shader);
video_shader_resolve_relative(glsl->shader, path);
video_shader_resolve_parameters(conf, glsl->shader);
if (conf)
{
@ -814,9 +814,9 @@ static bool gl_glsl_init(void *data, const char *path)
conf = NULL;
}
stock_vertex = (glsl->glsl_shader->modern) ?
stock_vertex = (glsl->shader->modern) ?
stock_vertex_modern : stock_vertex_legacy;
stock_fragment = (glsl->glsl_shader->modern) ?
stock_fragment = (glsl->shader->modern) ?
stock_fragment_modern : stock_fragment_legacy;
if (glsl_core)
@ -826,13 +826,13 @@ static bool gl_glsl_init(void *data, const char *path)
}
#ifdef HAVE_OPENGLES2
if (!glsl->glsl_shader->modern)
if (!glsl->shader->modern)
{
RARCH_ERR("[GL]: GLES context is used, but shader is not modern. Cannot use it.\n");
goto error;
}
#else
if (glsl_core && !glsl->glsl_shader->modern)
if (glsl_core && !glsl->shader->modern)
{
RARCH_ERR("[GL]: GL core context is used, but shader is not core compatible. Cannot use it.\n");
goto error;
@ -842,14 +842,14 @@ static bool gl_glsl_init(void *data, const char *path)
/* Find all aliases we use in our GLSLP and add #defines for them so
* that a shader can choose a fallback if we are not using a preset. */
*glsl->glsl_alias_define = '\0';
for (i = 0; i < glsl->glsl_shader->passes; i++)
for (i = 0; i < glsl->shader->passes; i++)
{
if (*glsl->glsl_shader->pass[i].alias)
if (*glsl->shader->pass[i].alias)
{
char define[128] = {0};
snprintf(define, sizeof(define), "#define %s_ALIAS\n",
glsl->glsl_shader->pass[i].alias);
glsl->shader->pass[i].alias);
strlcat(glsl->glsl_alias_define, define, sizeof(glsl->glsl_alias_define));
}
}
@ -863,13 +863,13 @@ static bool gl_glsl_init(void *data, const char *path)
if (!compile_programs(glsl, &glsl->gl_program[1]))
goto error;
if (!gl_load_luts(glsl->glsl_shader, glsl->gl_teximage))
if (!gl_load_luts(glsl->shader, glsl->gl_teximage))
{
RARCH_ERR("[GL]: Failed to load LUTs.\n");
goto error;
}
for (i = 0; i <= glsl->glsl_shader->passes; i++)
for (i = 0; i <= glsl->shader->passes; i++)
find_uniforms(glsl, i, glsl->gl_program[i], &glsl->gl_uniforms[i]);
#ifdef GLSL_DEBUG
@ -877,18 +877,18 @@ static bool gl_glsl_init(void *data, const char *path)
RARCH_WARN("Detected GL error in GLSL.\n");
#endif
if (glsl->glsl_shader->variables)
if (glsl->shader->variables)
{
struct state_tracker_info info = {0};
info.wram = (uint8_t*)pretro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM);
info.info = glsl->glsl_shader->variable;
info.info_elem = glsl->glsl_shader->variables;
info.info = glsl->shader->variable;
info.info_elem = glsl->shader->variables;
#ifdef HAVE_PYTHON
info.script = glsl->glsl_shader->script;
info.script_class = *glsl->glsl_shader->script_class ?
glsl->glsl_shader->script_class : NULL;
info.script = glsl->shader->script;
info.script_class = *glsl->shader->script_class ?
glsl->shader->script_class : NULL;
#endif
glsl->gl_state_tracker = state_tracker_init(&info);
@ -896,10 +896,10 @@ static bool gl_glsl_init(void *data, const char *path)
RARCH_WARN("Failed to init state tracker.\n");
}
glsl->gl_program[glsl->glsl_shader->passes + 1] = glsl->gl_program[0];
glsl->gl_uniforms[glsl->glsl_shader->passes + 1] = glsl->gl_uniforms[0];
glsl->gl_program[glsl->shader->passes + 1] = glsl->gl_program[0];
glsl->gl_uniforms[glsl->shader->passes + 1] = glsl->gl_uniforms[0];
if (glsl->glsl_shader->modern)
if (glsl->shader->modern)
{
glsl->gl_program[GL_SHADER_STOCK_BLEND] = compile_program(
glsl,
@ -988,7 +988,7 @@ static void gl_glsl_set_params(void *data, unsigned width, unsigned height,
if (uni->frame_count >= 0 && glsl->glsl_active_index)
{
unsigned modulo = glsl->glsl_shader->pass[glsl->glsl_active_index - 1].frame_count_mod;
unsigned modulo = glsl->shader->pass[glsl->glsl_active_index - 1].frame_count_mod;
if (modulo)
frame_count %= modulo;
@ -999,7 +999,7 @@ static void gl_glsl_set_params(void *data, unsigned width, unsigned height,
glUniform1i(uni->frame_direction, global->rewind.frame_is_reverse ? -1 : 1);
for (i = 0; i < glsl->glsl_shader->luts; i++)
for (i = 0; i < glsl->shader->luts; i++)
{
if (uni->lut_texture[i] < 0)
continue;
@ -1115,12 +1115,12 @@ static void gl_glsl_set_params(void *data, unsigned width, unsigned height,
glActiveTexture(GL_TEXTURE0);
/* #pragma parameters. */
for (i = 0; i < glsl->glsl_shader->num_parameters; i++)
for (i = 0; i < glsl->shader->num_parameters; i++)
{
int location = glGetUniformLocation(
glsl->gl_program[glsl->glsl_active_index],
glsl->glsl_shader->parameters[i].id);
glUniform1f(location, glsl->glsl_shader->parameters[i].current);
glsl->shader->parameters[i].id);
glUniform1f(location, glsl->shader->parameters[i].current);
}
/* Set state parameters. */
@ -1151,7 +1151,7 @@ static bool gl_glsl_set_mvp(void *data, const math_matrix_4x4 *mat)
(void)data;
if (!glsl || !glsl->glsl_shader->modern)
if (!glsl || !glsl->shader->modern)
{
gl_ff_matrix(mat);
return false;
@ -1177,7 +1177,7 @@ static bool gl_glsl_set_coords(const void *data)
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (!glsl || !glsl->glsl_shader->modern || !coords)
if (!glsl || !glsl->shader->modern || !coords)
{
gl_ff_vertex(coords);
return false;
@ -1285,8 +1285,8 @@ static unsigned gl_glsl_num(void)
{
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (glsl && glsl->glsl_shader)
return glsl->glsl_shader->passes;
if (glsl && glsl->shader)
return glsl->shader->passes;
return 0;
}
@ -1295,10 +1295,10 @@ static bool gl_glsl_filter_type(unsigned idx, bool *smooth)
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (glsl && idx
&& (glsl->glsl_shader->pass[idx - 1].filter != RARCH_FILTER_UNSPEC)
&& (glsl->shader->pass[idx - 1].filter != RARCH_FILTER_UNSPEC)
)
{
*smooth = (glsl->glsl_shader->pass[idx - 1].filter == RARCH_FILTER_LINEAR);
*smooth = (glsl->shader->pass[idx - 1].filter == RARCH_FILTER_LINEAR);
return true;
}
return false;
@ -1309,7 +1309,7 @@ static enum gfx_wrap_type gl_glsl_wrap_type(unsigned idx)
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (glsl && idx)
return glsl->glsl_shader->pass[idx - 1].wrap;
return glsl->shader->pass[idx - 1].wrap;
return RARCH_WRAP_BORDER;
}
@ -1318,7 +1318,7 @@ static void gl_glsl_shader_scale(unsigned idx, struct gfx_fbo_scale *scale)
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (glsl && idx)
*scale = glsl->glsl_shader->pass[idx - 1].fbo;
*scale = glsl->shader->pass[idx - 1].fbo;
else
scale->valid = false;
}
@ -1333,7 +1333,7 @@ static unsigned gl_glsl_get_prev_textures(void)
if (!glsl)
return 0;
for (i = 1; i <= glsl->glsl_shader->passes; i++)
for (i = 1; i <= glsl->shader->passes; i++)
for (j = 0; j < PREV_TEXTURES; j++)
if (glsl->gl_uniforms[i].prev[j].texture >= 0)
max_prev = max(j + 1, max_prev);
@ -1346,7 +1346,7 @@ static bool gl_glsl_mipmap_input(unsigned idx)
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (glsl && idx)
return glsl->glsl_shader->pass[idx - 1].mipmap;
return glsl->shader->pass[idx - 1].mipmap;
return false;
}
@ -1356,7 +1356,7 @@ static struct video_shader *gl_glsl_get_current_shader(void)
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
if (!glsl)
return NULL;
return glsl->glsl_shader;
return glsl->shader;
}
void gl_glsl_set_get_proc_address(gfx_ctx_proc_t (*proc)(const char*))