(zahnrad) Get past crash when shader is NULL
This commit is contained in:
parent
97eea9e71f
commit
5cef419209
|
@ -269,11 +269,11 @@ static void zrmenu_set_style(struct zr_context *ctx, enum zr_theme theme)
|
||||||
static void zrmenu_wnd_shader_parameters(struct zr_context *ctx,
|
static void zrmenu_wnd_shader_parameters(struct zr_context *ctx,
|
||||||
int width, int height, struct zrmenu *gui)
|
int width, int height, struct zrmenu *gui)
|
||||||
{
|
{
|
||||||
|
video_shader_ctx_t shader_info;
|
||||||
|
struct zr_panel layout;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
video_shader_ctx_t shader_info;
|
|
||||||
|
|
||||||
struct zr_panel layout;
|
|
||||||
if (zr_begin(ctx, &layout, "Shader Parameters", zr_rect(240, 10, 300, 400),
|
if (zr_begin(ctx, &layout, "Shader Parameters", zr_rect(240, 10, 300, 400),
|
||||||
ZR_WINDOW_CLOSABLE|ZR_WINDOW_MINIMIZABLE|ZR_WINDOW_MOVABLE|
|
ZR_WINDOW_CLOSABLE|ZR_WINDOW_MINIMIZABLE|ZR_WINDOW_MOVABLE|
|
||||||
ZR_WINDOW_SCALABLE|ZR_WINDOW_BORDER))
|
ZR_WINDOW_SCALABLE|ZR_WINDOW_BORDER))
|
||||||
|
@ -285,21 +285,25 @@ static void zrmenu_wnd_shader_parameters(struct zr_context *ctx,
|
||||||
zr_layout_row_dynamic(ctx, 30, 1);
|
zr_layout_row_dynamic(ctx, 30, 1);
|
||||||
|
|
||||||
video_shader_driver_ctl(SHADER_CTL_GET_CURRENT_SHADER, &shader_info);
|
video_shader_driver_ctl(SHADER_CTL_GET_CURRENT_SHADER, &shader_info);
|
||||||
for (i = 0; i < GFX_MAX_PARAMETERS; i++)
|
|
||||||
|
if (shader_info.data)
|
||||||
{
|
{
|
||||||
if (!string_is_empty(shader_info.data->parameters[i].desc))
|
for (i = 0; i < GFX_MAX_PARAMETERS; i++)
|
||||||
{
|
{
|
||||||
if(shader_info.data->parameters[i].minimum == 0 &&
|
if (!string_is_empty(shader_info.data->parameters[i].desc))
|
||||||
shader_info.data->parameters[i].maximum == 1 &&
|
{
|
||||||
shader_info.data->parameters[i].step == 1)
|
if(shader_info.data->parameters[i].minimum == 0 &&
|
||||||
zr_checkbox_float(ctx, shader_info.data->parameters[i].desc,
|
shader_info.data->parameters[i].maximum == 1 &&
|
||||||
&(shader_info.data->parameters[i].current));
|
shader_info.data->parameters[i].step == 1)
|
||||||
else
|
zr_checkbox_float(ctx, shader_info.data->parameters[i].desc,
|
||||||
zr_property_float(ctx, shader_info.data->parameters[i].desc,
|
&(shader_info.data->parameters[i].current));
|
||||||
shader_info.data->parameters[i].minimum,
|
else
|
||||||
&(shader_info.data->parameters[i].current),
|
zr_property_float(ctx, shader_info.data->parameters[i].desc,
|
||||||
shader_info.data->parameters[i].maximum,
|
shader_info.data->parameters[i].minimum,
|
||||||
shader_info.data->parameters[i].step, 1);
|
&(shader_info.data->parameters[i].current),
|
||||||
|
shader_info.data->parameters[i].maximum,
|
||||||
|
shader_info.data->parameters[i].step, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue