From 58f145282ed1c4f9f4aecb6af4b7da8eca802eb0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 17 Apr 2016 06:11:48 +0200 Subject: [PATCH] (XMB) Set uniform to vertex program and add 'add_prefix' to uniform_info struct --- gfx/drivers_shader/shader_gl_cg.c | 9 ++++++++- gfx/video_shader_driver.h | 1 + menu/drivers/xmb.c | 12 +++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gfx/drivers_shader/shader_gl_cg.c b/gfx/drivers_shader/shader_gl_cg.c index 0c3f46bc09..f1417dbf2a 100644 --- a/gfx/drivers_shader/shader_gl_cg.c +++ b/gfx/drivers_shader/shader_gl_cg.c @@ -131,6 +131,7 @@ static void gl_cg_set_uniform_parameter( if (param->lookup.enable) { + char ident[64]; CGprogram prog = 0; switch (param->lookup.type) @@ -143,7 +144,13 @@ static void gl_cg_set_uniform_parameter( prog = cg_data->prg[param->lookup.idx].fprg; break; } - location = cgGetNamedParameter(prog, param->lookup.ident); + + if (param->lookup.add_prefix) + { + strlcat(ident, "IN.", sizeof(ident)); + strlcat(ident, param->lookup.ident, sizeof(ident)); + } + location = cgGetNamedParameter(prog, param->lookup.add_prefix ? ident : param->lookup.ident); } else { diff --git a/gfx/video_shader_driver.h b/gfx/video_shader_driver.h index 6c1492e0e7..f6189b8fb3 100644 --- a/gfx/video_shader_driver.h +++ b/gfx/video_shader_driver.h @@ -122,6 +122,7 @@ struct uniform_info enum shader_program_type type; const char *ident; uint32_t idx; + bool add_prefix; bool enable; } lookup; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 513e08523e..dd5b3757e5 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1934,11 +1934,13 @@ static void xmb_draw_ribbon(menu_display_ctx_draw_t *draw) t += 0.01; - uniform_param.lookup.enable = true; - uniform_param.lookup.idx = VIDEO_SHADER_MENU; - uniform_param.lookup.type = SHADER_PROGRAM_FRAGMENT; - uniform_param.lookup.ident = "time"; - uniform_param.result.f.v0 = t; + uniform_param.lookup.enable = true; + uniform_param.lookup.add_prefix = true; + uniform_param.lookup.idx = VIDEO_SHADER_MENU; + uniform_param.lookup.type = SHADER_PROGRAM_VERTEX; + uniform_param.type = UNIFORM_1F; + uniform_param.lookup.ident = "time"; + uniform_param.result.f.v0 = t; video_shader_driver_ctl(SHADER_CTL_SET_PARAMETER, &uniform_param);