Skip to content

Commit 02f8cf6

Browse files
committed
Add on-screen error on auto shader preset load failures
1 parent fd626ce commit 02f8cf6

4 files changed

Lines changed: 41 additions & 6 deletions

File tree

gfx/drivers_shader/glslang_util_cxx.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#if defined(HAVE_GLSLANG)
3434
#include "glslang.hpp"
3535
#endif
36+
37+
#include "../../retroarch.h"
3638
#include "../../verbosity.h"
3739

3840
static std::string build_stage_source(
@@ -248,5 +250,16 @@ bool glslang_compile_shader(const char *shader_path, glslang_output *output)
248250
string_list_deinitialize(&lines);
249251
#endif
250252

253+
{
254+
size_t _len;
255+
char msg[NAME_MAX_LENGTH];
256+
257+
_len = snprintf(msg, sizeof(msg), "Failed to compile shader: \"%s\".",
258+
path_basename(shader_path));
259+
260+
runloop_msg_queue_push(msg, _len, 1, 120, true, NULL,
261+
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
262+
}
263+
251264
return false;
252265
}

gfx/drivers_shader/shader_glsl.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,17 @@ static void *gl_glsl_init(void *data, const char *path)
12291229
if (glsl)
12301230
free(glsl);
12311231

1232+
{
1233+
size_t _len;
1234+
char msg[NAME_MAX_LENGTH];
1235+
1236+
_len = snprintf(msg, sizeof(msg), "Failed to compile shader: \"%s\".",
1237+
path_basename(path));
1238+
1239+
runloop_msg_queue_push(msg, _len, 1, 120, true, NULL,
1240+
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
1241+
}
1242+
12321243
return NULL;
12331244
}
12341245

gfx/video_shader_parse.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,13 +3062,11 @@ bool video_shader_apply_shader(
30623062
#endif
30633063

30643064
/* Display error message */
3065-
_len = fill_pathname_join_delim(msg,
3065+
_len = snprintf(msg, sizeof(msg), "%s \"%s\".",
30663066
msg_hash_to_str(MSG_FAILED_TO_APPLY_SHADER_PRESET),
3067-
preset_file ? preset_file : "null",
3068-
' ',
3069-
sizeof(msg));
3067+
preset_file ? preset_file : "null");
30703068

3071-
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
3069+
runloop_msg_queue_push(msg, _len, 1, 120, true, NULL,
30723070
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
30733071
return false;
30743072
}
@@ -3125,7 +3123,7 @@ const char *video_shader_get_current_shader_preset(void)
31253123
runloop_st->runtime_shader_preset_path,
31263124
sizeof(runloop_st->runtime_shader_preset_path)))
31273125
{
3128-
RARCH_LOG("[Shaders] Specific shader preset found at \"%s\".\n",
3126+
RARCH_LOG("[Shaders] Shader preset found at \"%s\".\n",
31293127
runloop_st->runtime_shader_preset_path);
31303128
}
31313129
}

menu/menu_driver.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7087,6 +7087,19 @@ bool menu_shader_manager_init(void)
70877087
}
70887088

70897089
end:
7090+
7091+
if (!ret)
7092+
{
7093+
size_t _len;
7094+
char msg[NAME_MAX_LENGTH];
7095+
7096+
_len = snprintf(msg, sizeof(msg), "Could not read shader preset: \"%s\".",
7097+
path_basename(path_shader));
7098+
7099+
runloop_msg_queue_push(msg, _len, 1, 120, true, NULL,
7100+
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
7101+
}
7102+
70907103
video_st->menu_driver_shader = menu_shader;
70917104
command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL);
70927105
return ret;

0 commit comments

Comments
 (0)