mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(shader_gl_cg.c) Cleanups
This commit is contained in:
parent
4b9571140f
commit
65ba82ca4b
@ -516,8 +516,8 @@ static bool gl_cg_compile_program(
|
||||
void *program_data,
|
||||
struct shader_program_info *program_info)
|
||||
{
|
||||
const char *list = NULL;
|
||||
const char *argv[2 + GFX_MAX_SHADERS];
|
||||
const char *list = NULL;
|
||||
bool ret = true;
|
||||
char *listing_f = NULL;
|
||||
char *listing_v = NULL;
|
||||
@ -529,11 +529,13 @@ static bool gl_cg_compile_program(
|
||||
program = &cg->prg[idx];
|
||||
|
||||
argv[argc++] = "-DPARAMETER_UNIFORM";
|
||||
|
||||
for (i = 0; i < GFX_MAX_SHADERS; i++)
|
||||
{
|
||||
if (*(cg->alias_define[i]))
|
||||
argv[argc++] = cg->alias_define[i];
|
||||
}
|
||||
|
||||
argv[argc] = NULL;
|
||||
|
||||
if (program_info->is_file)
|
||||
@ -595,8 +597,8 @@ static void gl_cg_set_program_base_attrib(void *data, unsigned i)
|
||||
{
|
||||
uint32_t semantic_hash;
|
||||
const char *semantic = NULL;
|
||||
if (cgGetParameterDirection(param) != CG_IN
|
||||
|| cgGetParameterVariability(param) != CG_VARYING)
|
||||
if ( (cgGetParameterDirection(param) != CG_IN)
|
||||
|| (cgGetParameterVariability(param) != CG_VARYING))
|
||||
continue;
|
||||
|
||||
semantic = cgGetParameterSemantic(param);
|
||||
@ -659,6 +661,7 @@ error:
|
||||
static bool gl_cg_load_plain(void *data, const char *path)
|
||||
{
|
||||
cg_shader_data_t *cg = (cg_shader_data_t*)data;
|
||||
|
||||
if (!gl_cg_load_stock(cg))
|
||||
return false;
|
||||
|
||||
@ -669,7 +672,12 @@ static bool gl_cg_load_plain(void *data, const char *path)
|
||||
|
||||
cg->shader->passes = 1;
|
||||
|
||||
if (path)
|
||||
if (string_is_empty(path))
|
||||
{
|
||||
RARCH_LOG("Loading stock Cg file.\n");
|
||||
cg->prg[1] = cg->prg[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
struct shader_program_info program_info;
|
||||
|
||||
@ -682,11 +690,6 @@ static bool gl_cg_load_plain(void *data, const char *path)
|
||||
if (!gl_cg_compile_program(data, 1, &cg->prg[1], &program_info))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("Loading stock Cg file.\n");
|
||||
cg->prg[1] = cg->prg[0];
|
||||
}
|
||||
|
||||
video_shader_resolve_parameters(NULL, cg->shader);
|
||||
return true;
|
||||
@ -816,11 +819,13 @@ static bool gl_cg_load_preset(void *data, const char *path)
|
||||
}
|
||||
|
||||
for (i = 0; i < cg->shader->passes; i++)
|
||||
{
|
||||
if (*cg->shader->pass[i].alias)
|
||||
snprintf(cg->alias_define[i],
|
||||
sizeof(cg->alias_define[i]),
|
||||
"-D%s_ALIAS",
|
||||
cg->shader->pass[i].alias);
|
||||
}
|
||||
|
||||
for (i = 0; i < cg->shader->passes; i++)
|
||||
{
|
||||
@ -1042,7 +1047,8 @@ static void *gl_cg_init(void *data, const char *path)
|
||||
|
||||
memset(cg->alias_define, 0, sizeof(cg->alias_define));
|
||||
|
||||
if (path && string_is_equal(path_get_extension(path), "cgp"))
|
||||
if ( !string_is_empty(path)
|
||||
&& string_is_equal(path_get_extension(path), "cgp"))
|
||||
{
|
||||
if (!gl_cg_load_preset(cg, path))
|
||||
goto error;
|
||||
|
Loading…
x
Reference in New Issue
Block a user