allow saving and properly loading 0 pass shader presets

This commit is contained in:
LazyBumHorse 2019-06-09 18:05:19 +02:00
parent d67a118ad4
commit b54a360ab8
2 changed files with 6 additions and 11 deletions

View File

@ -737,12 +737,6 @@ bool video_shader_read_conf_cgp(config_file_t *conf,
return false; return false;
} }
if (!shaders)
{
RARCH_ERR("Need to define at least 1 shader.\n");
return false;
}
if (!config_get_int(conf, "feedback_pass", if (!config_get_int(conf, "feedback_pass",
&shader->feedback_pass)) &shader->feedback_pass))
shader->feedback_pass = -1; shader->feedback_pass = -1;

View File

@ -451,7 +451,7 @@ void menu_shader_manager_clear_pass_path(unsigned i)
**/ **/
unsigned menu_shader_manager_get_type(const void *data) unsigned menu_shader_manager_get_type(const void *data)
{ {
unsigned type = RARCH_SHADER_NONE; enum rarch_shader_type type;
const struct video_shader *shader = (const struct video_shader*)data; const struct video_shader *shader = (const struct video_shader*)data;
/* All shader types must be the same, or we cannot use it. */ /* All shader types must be the same, or we cannot use it. */
uint8_t i = 0; uint8_t i = 0;
@ -459,6 +459,9 @@ unsigned menu_shader_manager_get_type(const void *data)
if (!shader) if (!shader)
return RARCH_SHADER_NONE; return RARCH_SHADER_NONE;
type = video_shader_parse_type(shader->path,
RARCH_SHADER_NONE);
for (i = 0; i < shader->passes; i++) for (i = 0; i < shader->passes; i++)
{ {
enum rarch_shader_type pass_type = enum rarch_shader_type pass_type =
@ -470,9 +473,7 @@ unsigned menu_shader_manager_get_type(const void *data)
case RARCH_SHADER_CG: case RARCH_SHADER_CG:
case RARCH_SHADER_GLSL: case RARCH_SHADER_GLSL:
case RARCH_SHADER_SLANG: case RARCH_SHADER_SLANG:
if (type == RARCH_SHADER_NONE) if (type != pass_type)
type = pass_type;
else if (type != pass_type)
return RARCH_SHADER_NONE; return RARCH_SHADER_NONE;
break; break;
default: default:
@ -498,7 +499,7 @@ void menu_shader_manager_apply_changes(void)
shader_type = menu_shader_manager_get_type(shader); shader_type = menu_shader_manager_get_type(shader);
if (shader->passes && shader_type != RARCH_SHADER_NONE) if (shader_type != RARCH_SHADER_NONE)
{ {
menu_shader_manager_save_preset(NULL, true, false); menu_shader_manager_save_preset(NULL, true, false);
return; return;