mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Cleanups - get rid of shader ifdefs
This commit is contained in:
parent
5ca618c8d6
commit
d3a4cc90c8
@ -57,13 +57,10 @@
|
|||||||
|
|
||||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
|
||||||
|
|
||||||
#if defined(HAVE_CG)
|
|
||||||
#define HAVE_SHADERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_HLSL
|
#ifdef HAVE_HLSL
|
||||||
#include "../drivers_shader/shader_hlsl.h"
|
#include "../drivers_shader/shader_hlsl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
@ -252,12 +249,12 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
#ifdef HAVE_FBO
|
||||||
static bool d3d_init_multipass(d3d_video_t *d3d)
|
static bool d3d_init_multipass(d3d_video_t *d3d, const char *shader_path)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
bool use_extra_pass = false;
|
bool use_extra_pass = false;
|
||||||
struct video_shader_pass *pass = NULL;
|
struct video_shader_pass *pass = NULL;
|
||||||
config_file_t *conf = !string_is_empty(d3d->shader_path) ? config_file_new(d3d->shader_path) : NULL;
|
config_file_t *conf = config_file_new(shader_path);
|
||||||
|
|
||||||
if (!conf)
|
if (!conf)
|
||||||
{
|
{
|
||||||
@ -266,19 +263,18 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(&d3d->shader, 0, sizeof(d3d->shader));
|
memset(&d3d->shader, 0, sizeof(d3d->shader));
|
||||||
#ifdef HAVE_SHADERPIPELINE
|
|
||||||
if (!video_shader_read_conf_cgp(conf, &d3d->shader))
|
if (!video_shader_read_conf_cgp(conf, &d3d->shader))
|
||||||
{
|
{
|
||||||
config_file_free(conf);
|
config_file_free(conf);
|
||||||
RARCH_ERR("[D3D]: Failed to parse CGP file.\n");
|
RARCH_ERR("[D3D]: Failed to parse CGP file.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
config_file_free(conf);
|
config_file_free(conf);
|
||||||
#ifdef HAVE_SHADERPIPELINE
|
|
||||||
if (!string_is_empty(d3d->shader_path))
|
if (!string_is_empty(shader_path))
|
||||||
video_shader_resolve_relative(&d3d->shader, d3d->shader_path);
|
video_shader_resolve_relative(&d3d->shader, shader_path);
|
||||||
#endif
|
|
||||||
RARCH_LOG("[D3D]: Found %u shaders.\n", d3d->shader.passes);
|
RARCH_LOG("[D3D]: Found %u shaders.\n", d3d->shader.passes);
|
||||||
|
|
||||||
for (i = 0; i < d3d->shader.passes; i++)
|
for (i = 0; i < d3d->shader.passes; i++)
|
||||||
@ -301,8 +297,10 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
|||||||
pass = (struct video_shader_pass*)
|
pass = (struct video_shader_pass*)
|
||||||
&d3d->shader.pass[d3d->shader.passes - 1];
|
&d3d->shader.pass[d3d->shader.passes - 1];
|
||||||
|
|
||||||
pass->fbo.scale_x = pass->fbo.scale_y = 1.0f;
|
pass->fbo.scale_x = 1.0f;
|
||||||
pass->fbo.type_x = pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
|
pass->fbo.scale_y = 1.0f;
|
||||||
|
pass->fbo.type_x = RARCH_SCALE_VIEWPORT;
|
||||||
|
pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
|
||||||
pass->filter = RARCH_FILTER_UNSPEC;
|
pass->filter = RARCH_FILTER_UNSPEC;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -310,8 +308,10 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
|||||||
pass = (struct video_shader_pass*)
|
pass = (struct video_shader_pass*)
|
||||||
&d3d->shader.pass[d3d->shader.passes - 1];
|
&d3d->shader.pass[d3d->shader.passes - 1];
|
||||||
|
|
||||||
pass->fbo.scale_x = pass->fbo.scale_y = 1.0f;
|
pass->fbo.scale_x = 1.0f;
|
||||||
pass->fbo.type_x = pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
|
pass->fbo.scale_y = 1.0f;
|
||||||
|
pass->fbo.type_x = RARCH_SCALE_VIEWPORT;
|
||||||
|
pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -321,9 +321,10 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
|
|||||||
static bool d3d_process_shader(d3d_video_t *d3d)
|
static bool d3d_process_shader(d3d_video_t *d3d)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FBO
|
#ifdef HAVE_FBO
|
||||||
if (d3d && !string_is_empty(d3d->shader_path) &&
|
const char *shader_path = d3d->shader_path;
|
||||||
string_is_equal(path_get_extension(d3d->shader_path), "cgp"))
|
if (d3d && !string_is_empty(shader_path) &&
|
||||||
return d3d_init_multipass(d3d);
|
string_is_equal(path_get_extension(shader_path), "cgp"))
|
||||||
|
return d3d_init_multipass(d3d, shader_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return d3d_init_singlepass(d3d);
|
return d3d_init_singlepass(d3d);
|
||||||
@ -1102,7 +1103,6 @@ static bool d3d_init_internal(d3d_video_t *d3d,
|
|||||||
windowed_full, &rect);
|
windowed_full, &rect);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SHADERS
|
|
||||||
/* This should only be done once here
|
/* This should only be done once here
|
||||||
* to avoid set_shader() to be overridden
|
* to avoid set_shader() to be overridden
|
||||||
* later. */
|
* later. */
|
||||||
@ -1127,7 +1127,6 @@ static bool d3d_init_internal(d3d_video_t *d3d,
|
|||||||
|
|
||||||
if (!d3d_process_shader(d3d))
|
if (!d3d_process_shader(d3d))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
|
|
||||||
d3d->video_info = *info;
|
d3d->video_info = *info;
|
||||||
if (!d3d_initialize(d3d, &d3d->video_info))
|
if (!d3d_initialize(d3d, &d3d->video_info))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user