Add some logging for shader backend setup

This commit is contained in:
twinaphex 2018-04-23 18:25:41 +02:00
parent 77d815a572
commit d6c17178a3
3 changed files with 26 additions and 5 deletions

View File

@ -266,7 +266,6 @@ static bool hlsl_d3d9_renderchain_init_shader(void *data,
void *renderchain_data)
{
video_shader_ctx_init_t init;
bool ret = false;
d3d_video_t *d3d = (d3d_video_t*)data;
settings_t *settings = config_get_ptr();
(void)renderchain_data;
@ -277,13 +276,11 @@ static bool hlsl_d3d9_renderchain_init_shader(void *data,
init.shader_type = RARCH_SHADER_HLSL;
init.data = data;
init.path = retroarch_get_shader_preset();
init.shader = &hlsl_backend;
init.shader = NULL;
RARCH_LOG("D3D]: Using HLSL shader backend.\n");
ret = video_shader_driver_init(&init);
return ret;
return video_shader_driver_init(&init);
}
static bool hlsl_d3d9_renderchain_init(void *data,

View File

@ -234,12 +234,18 @@ static bool hlsl_compile_program(
strlen(program_info->combined), NULL, NULL,
"main_fragment", "ps_3_0", 0, &code_f, &listing_f,
&program->f_ctable ))
{
RARCH_ERR("Failure building stock fragment shader..\n");
goto error;
}
if (!d3d9x_compile_shader(program_info->combined,
strlen(program_info->combined), NULL, NULL,
"main_vertex", "vs_3_0", 0, &code_v, &listing_v,
&program->v_ctable ))
{
RARCH_ERR("Failure building stock vertex shader..\n");
goto error;
}
}
d3d9_create_pixel_shader(d3dr, (const DWORD*)d3d9x_get_buffer_ptr(code_f), (void**)&program->fprg);
@ -471,10 +477,15 @@ static void *hlsl_init(void *data, const char *path)
goto error;
}
RARCH_LOG("Setting up program attributes...\n");
RARCH_LOG("Shader passes: %d\n", hlsl->cg_shader->passes);
for(i = 1; i <= hlsl->cg_shader->passes; i++)
hlsl_set_program_attributes(hlsl, i);
RARCH_LOG("Setting up vertex shader...\n");
d3d9_set_vertex_shader(hlsl->dev, 1, hlsl->prg[1].vprg);
RARCH_LOG("Setting up pixel shader...\n");
d3d9_set_pixel_shader(hlsl->dev, hlsl->prg[1].fprg);
return hlsl;

View File

@ -3400,6 +3400,13 @@ static const shader_backend_t *video_shader_set_backend(enum rarch_shader_type t
return &gl_glsl_backend;
#else
break;
#endif
case RARCH_SHADER_HLSL:
#ifdef HAVE_HLSL
RARCH_LOG("[Shader driver]: Using HLSL shader backend.\n");
return &hlsl_backend;
#else
break;
#endif
case RARCH_SHADER_NONE:
default:
@ -3614,9 +3621,15 @@ bool video_shader_driver_init(video_shader_ctx_init_t *init)
if (string_is_equal(settings->arrays.menu_driver, "xmb")
&& init->shader->init_menu_shaders)
{
RARCH_LOG("Setting up menu pipeline shaders for XMB ... \n");
init->shader->init_menu_shaders(tmp);
}
current_shader_data = tmp;
RARCH_LOG("Resetting shader to defaults ... \n");
current_shader = (shader_backend_t*)init->shader;
video_shader_driver_reset_to_defaults();