Move renderchain code to the relevant files

This commit is contained in:
twinaphex 2018-02-16 11:24:10 +01:00
parent f5efddb7ec
commit 1e2d8de9ca
4 changed files with 78 additions and 88 deletions

View File

@ -106,6 +106,54 @@ static bool d3d9_init_imports(d3d_video_t *d3d)
return true;
}
extern d3d_renderchain_driver_t cg_d3d9_renderchain;
extern d3d_renderchain_driver_t hlsl_d3d9_renderchain;
extern d3d_renderchain_driver_t null_d3d_renderchain;
static bool renderchain_d3d_init_first(
enum gfx_ctx_api api,
const d3d_renderchain_driver_t **renderchain_driver,
void **renderchain_handle)
{
switch (api)
{
case GFX_CTX_DIRECT3D9_API:
#ifdef HAVE_D3D9
{
static const d3d_renderchain_driver_t *renderchain_d3d_drivers[] = {
#if defined(_WIN32) && defined(HAVE_CG)
&cg_d3d9_renderchain,
#endif
#if defined(_WIN32) && defined(HAVE_HLSL)
&hlsl_d3d9_renderchain,
#endif
&null_d3d_renderchain,
NULL
};
unsigned i;
for (i = 0; renderchain_d3d_drivers[i]; i++)
{
void *data = renderchain_d3d_drivers[i]->chain_new();
if (!data)
continue;
*renderchain_driver = renderchain_d3d_drivers[i];
*renderchain_handle = data;
return true;
}
}
#endif
break;
case GFX_CTX_NONE:
default:
break;
}
return false;
}
static bool d3d9_init_chain(d3d_video_t *d3d, const video_info_t *video_info)
{
struct LinkInfo link_info;

View File

@ -1666,6 +1666,36 @@ static void gl_begin_debug(gl_t *gl)
}
#endif
extern gl_renderchain_driver_t gl2_renderchain;
static const gl_renderchain_driver_t *renderchain_gl_drivers[] = {
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
&gl2_renderchain,
#endif
NULL
};
static bool renderchain_gl_init_first(
const gl_renderchain_driver_t **renderchain_driver,
void **renderchain_handle)
{
unsigned i;
for (i = 0; renderchain_gl_drivers[i]; i++)
{
void *data = renderchain_gl_drivers[i]->chain_new();
if (!data)
continue;
*renderchain_driver = renderchain_gl_drivers[i];
*renderchain_handle = data;
return true;
}
return false;
}
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{

View File

@ -421,14 +421,6 @@ static const shader_backend_t *shader_ctx_drivers[] = {
NULL
};
static const gl_renderchain_driver_t *renderchain_gl_drivers[] = {
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
&gl2_renderchain,
#endif
NULL
};
/* Stub functions */
static void update_window_title_null(void *data, void *data2)
@ -3543,68 +3535,3 @@ void video_driver_set_mvp(video_shader_ctx_mvp_t *mvp)
video_driver_poke->set_mvp(mvp->data, shader_data, mvp->matrix);
}
}
bool renderchain_d3d_init_first(
enum gfx_ctx_api api,
const d3d_renderchain_driver_t **renderchain_driver,
void **renderchain_handle)
{
switch (api)
{
case GFX_CTX_DIRECT3D9_API:
#ifdef HAVE_D3D9
{
static const d3d_renderchain_driver_t *renderchain_d3d_drivers[] = {
#if defined(_WIN32) && defined(HAVE_CG)
&cg_d3d9_renderchain,
#endif
#if defined(_WIN32) && defined(HAVE_HLSL)
&hlsl_d3d9_renderchain,
#endif
&null_d3d_renderchain,
NULL
};
unsigned i;
for (i = 0; renderchain_d3d_drivers[i]; i++)
{
void *data = renderchain_d3d_drivers[i]->chain_new();
if (!data)
continue;
*renderchain_driver = renderchain_d3d_drivers[i];
*renderchain_handle = data;
return true;
}
}
#endif
break;
case GFX_CTX_NONE:
default:
break;
}
return false;
}
bool renderchain_gl_init_first(
const gl_renderchain_driver_t **renderchain_driver,
void **renderchain_handle)
{
unsigned i;
for (i = 0; renderchain_gl_drivers[i]; i++)
{
void *data = renderchain_gl_drivers[i]->chain_new();
if (!data)
continue;
*renderchain_driver = renderchain_gl_drivers[i];
*renderchain_handle = data;
return true;
}
return false;
}

View File

@ -1316,15 +1316,6 @@ bool video_shader_driver_compile_program(struct shader_program_info *program_inf
bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap);
bool renderchain_d3d_init_first(
enum gfx_ctx_api,
const d3d_renderchain_driver_t **renderchain_driver,
void **renderchain_handle);
bool renderchain_gl_init_first(
const gl_renderchain_driver_t **renderchain_driver,
void **renderchain_handle);
extern bool (*video_driver_cb_has_focus)(void);
extern shader_backend_t *current_shader;
@ -1387,12 +1378,6 @@ extern const shader_backend_t hlsl_backend;
extern const shader_backend_t gl_cg_backend;
extern const shader_backend_t shader_null_backend;
extern d3d_renderchain_driver_t cg_d3d9_renderchain;
extern d3d_renderchain_driver_t hlsl_d3d9_renderchain;
extern d3d_renderchain_driver_t null_d3d_renderchain;
extern gl_renderchain_driver_t gl2_renderchain;
RETRO_END_DECLS
#endif