(PS3/360) Add load_shader wrapper function for consoles

This commit is contained in:
Twinaphex 2012-06-28 17:35:20 +02:00
parent 2865fc1fc9
commit ed57cc81f9
4 changed files with 28 additions and 8 deletions

View File

@ -591,18 +591,15 @@ HRESULT CRetroArchShaderBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHand
{
case 1:
snprintf(g_settings.video.cg_shader_path, sizeof(g_settings.video.cg_shader_path), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), strbuffer);
hlsl_load_shader(set_shader, g_settings.video.cg_shader_path);
rarch_load_shader(set_shader, g_settings.video.cg_shader_path);
break;
case 2:
snprintf (g_settings.video.second_pass_shader, sizeof(g_settings.video.second_pass_shader), "%s\\%s", filebrowser_get_current_dir(&tmp_browser), strbuffer);
hlsl_load_shader(set_shader, g_settings.video.second_pass_shader);
rarch_load_shader(set_shader, g_settings.video.second_pass_shader);
break;
default:
break;
}
if (g_console.info_msg_enable)
rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180);
}
else if(tmp_browser.current_dir.list->elems[index].attr.b)
{

View File

@ -535,6 +535,12 @@ void rarch_input_set_default_keybind_names_for_emulator(void)
VIDEO EXTENSIONS
============================================================ */
#if defined(HAVE_HLSL)
#include "../gfx/shader_hlsl.h"
#elif defined(HAVE_CG) && defined(HAVE_OPENGL)
#include "../gfx/shader_cg.h"
#endif
struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END] = {
{ "1:1", 1.0f },
{ "2:1", 2.0f },
@ -589,6 +595,22 @@ void rarch_set_auto_viewport(unsigned width, unsigned height)
aspectratio_lut[ASPECT_RATIO_AUTO].value = (int)aspect_x / (int)aspect_y;
}
void rarch_load_shader(unsigned slot, const char *path)
{
#if defined(HAVE_HLSL)
hlsl_load_shader(slot, path);
#elif defined(HAVE_CG) && defined(HAVE_OPENGL)
gl_cg_load_shader(slot, path);
#else
RARCH_WARN("Shader support is not implemented for this build.\n");
#endif
#if defined(HAVE_HLSL) || defined(HAVE_CG)
if (g_console.info_msg_enable)
rarch_settings_msg(S_MSG_SHADER_LOADING_SUCCEEDED, S_DELAY_180);
#endif
}
/*============================================================
RetroArch MAIN WRAP
============================================================ */

View File

@ -112,6 +112,7 @@ struct aspect_ratio_elem
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
extern void rarch_set_auto_viewport(unsigned width, unsigned height);
extern void rarch_load_shader(unsigned slot, const char *path);
#include "console_ext_input.h"

View File

@ -794,7 +794,7 @@ static void select_file(uint32_t menu_id)
switch(menu_id)
{
case SHADER_CHOICE:
gl_cg_load_shader(set_shader+1, path);
rarch_load_shader(set_shader+1, path);
switch(set_shader+1)
{
case 1:
@ -1099,7 +1099,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
}
if(CTRL_START(trigger_state))
{
gl_cg_load_shader(1, NULL);
rarch_load_shader(1, NULL);
strlcpy(g_settings.video.cg_shader_path, DEFAULT_SHADER_FILE, sizeof(g_settings.video.cg_shader_path));
menu_reinit_settings();
}
@ -1115,7 +1115,7 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue)
}
if(CTRL_START(trigger_state))
{
gl_cg_load_shader(2, NULL);
rarch_load_shader(2, NULL);
strlcpy(g_settings.video.second_pass_shader, DEFAULT_SHADER_FILE, sizeof(g_settings.video.second_pass_shader));
menu_reinit_settings();
}