diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 689825bc70..97e2ccc6a5 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -1091,9 +1091,10 @@ static void gl2_renderchain_init( video_shader_ctx_info_t shader_info; struct gfx_fbo_scale scale, scale_last; - shader_info.num = gl->shader->num_shaders(gl->shader_data); + if (!video_shader_driver_info(&shader_info)) + return; - if (shader_info.num == 0) + if (!gl || shader_info.num == 0) return; video_driver_get_size(&width, &height); @@ -3438,7 +3439,11 @@ static void *gl_init(const video_info_t *video, gl->textures = MAX(minimum + 1, gl->textures); } - shader_info.num = gl->shader->num_shaders(gl->shader_data); + if (!video_shader_driver_info(&shader_info)) + { + RARCH_ERR("[GL]: Shader driver info check failed.\n"); + goto error; + } RARCH_LOG("[GL]: Using %u textures.\n", gl->textures); RARCH_LOG("[GL]: Loaded %u program(s).\n", diff --git a/gfx/video_driver.c b/gfx/video_driver.c index ae6e5d54f5..7dfa0874ad 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3562,6 +3562,16 @@ bool video_shader_driver_init(video_shader_ctx_init_t *init) return true; } +bool video_shader_driver_info(video_shader_ctx_info_t *shader_info) +{ + if (!shader_info) + return false; + + shader_info->num = current_shader->num_shaders(current_shader_data); + + return true; +} + void video_driver_set_coords(video_shader_ctx_coords_t *coords) { if (current_shader && current_shader->set_coords) diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 9b6bff23b1..c88721e4b0 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1182,16 +1182,18 @@ void video_context_driver_free(void); bool video_shader_driver_get_ident(video_shader_ctx_ident_t *ident); +bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader); + bool video_shader_driver_deinit(void); bool video_shader_driver_init_first(void); -bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader); - bool video_shader_driver_init(video_shader_ctx_init_t *init); void video_driver_set_coords(video_shader_ctx_coords_t *coords); +bool video_shader_driver_info(video_shader_ctx_info_t *shader_info); + void video_driver_set_mvp(video_shader_ctx_mvp_t *mvp); float video_driver_get_refresh_rate(void); diff --git a/ui/drivers/qt/shaderparamsdialog.cpp b/ui/drivers/qt/shaderparamsdialog.cpp index 89a1fb9882..3935fa8521 100644 --- a/ui/drivers/qt/shaderparamsdialog.cpp +++ b/ui/drivers/qt/shaderparamsdialog.cpp @@ -28,7 +28,6 @@ extern "C" { #include #include "../../../command.h" #include "../../../configuration.h" -#include "../../../gfx/video_driver.h" #include "../../../retroarch.h" #include "../../../paths.h" #include "../../../file_path_special.h"