Make all functions static for renderchain drivers

This commit is contained in:
twinaphex 2015-04-06 18:02:42 +02:00
parent 7609c567c9
commit a9a4006ad8
5 changed files with 95 additions and 92 deletions

View File

@ -351,7 +351,7 @@ static void renderchain_bind_tracker(void *data, void *pass_data, unsigned pass_
{ (WORD)(stream), (WORD)(offset * sizeof(float)), D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, \
D3DDECLUSAGE_COLOR, (BYTE)(index) } \
bool renderchain_init_shader_fvf(void *data, void *pass_data)
static bool cg_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
{
CGparameter param;
unsigned index, i, count;
@ -600,7 +600,7 @@ static void renderchain_bind_prev(void *data, void *pass_data)
}
}
static void renderchain_add_lut(void *data,
static void cg_d3d9_renderchain_add_lut(void *data,
unsigned index, unsigned i)
{
cg_renderchain_t *chain = (cg_renderchain_t*)data;
@ -634,7 +634,7 @@ static void renderchain_bind_luts(void *data, void *pass_data)
index = cgGetParameterResourceIndex(fparam);
bound_index = index;
renderchain_add_lut(chain, index, i);
cg_d3d9_renderchain_add_lut(chain, index, i);
}
vparam = cgGetNamedParameter(pass->vPrg, chain->luts[i].id);
@ -643,7 +643,7 @@ static void renderchain_bind_luts(void *data, void *pass_data)
{
index = cgGetParameterResourceIndex(vparam);
if (index != (unsigned)bound_index)
renderchain_add_lut(chain, index, i);
cg_d3d9_renderchain_add_lut(chain, index, i);
}
}
}
@ -741,7 +741,7 @@ static void renderchain_clear(void *data)
chain->luts.clear();
}
void renderchain_free(void *data)
void cg_d3d9_renderchain_free(void *data)
{
cg_renderchain_t *chain = (cg_renderchain_t*)data;
@ -754,7 +754,7 @@ void renderchain_free(void *data)
state_tracker_free(chain->tracker);
}
void *renderchain_new(void)
void *cg_d3d9_renderchain_new(void)
{
cg_renderchain_t *renderchain = (cg_renderchain_t*)calloc(1, sizeof(*renderchain));
if (!renderchain)
@ -763,7 +763,7 @@ void *renderchain_new(void)
return renderchain;
}
void renderchain_deinit_shader(void)
static void cg_d3d9_renderchain_deinit_shader(void)
{
if (!cgCtx)
return;
@ -774,7 +774,7 @@ void renderchain_deinit_shader(void)
cgCtx = NULL;
}
bool renderchain_init_shader(void *data)
static bool cg_d3d9_renderchain_init_shader(void *data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
@ -793,7 +793,7 @@ bool renderchain_init_shader(void *data)
return true;
}
void renderchain_deinit(void *data)
static void cg_d3d9_renderchain_deinit(void *data)
{
cg_renderchain_t *renderchain = (cg_renderchain_t*)data;
@ -908,13 +908,13 @@ static bool renderchain_create_first_pass(void *data, const void *info_data,
renderchain_compile_shaders(chain, &pass.fPrg,
&pass.vPrg, info->pass->source.path);
if (!renderchain_init_shader_fvf(chain, &pass))
if (!cg_d3d9_renderchain_init_shader_fvf(chain, &pass))
return false;
chain->passes.push_back(pass);
return true;
}
bool renderchain_init(void *data, const video_info_t *video_info,
static bool cg_d3d9_renderchain_init(void *data, const video_info_t *video_info,
void *dev_,
const void *final_viewport_,
const void *info_data, unsigned fmt)
@ -974,7 +974,7 @@ static bool renderchain_set_pass_size(void *data, unsigned pass_index,
return true;
}
void renderchain_convert_geometry(
static void cg_d3d9_renderchain_convert_geometry(
void *data, const void *info_data,
unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height,
@ -1041,7 +1041,7 @@ static void d3d_recompute_pass_sizes(d3d_video_t *d3d,
for (i = 1; i < d3d->shader.passes; i++)
{
renderchain_convert_geometry(chain,
cg_d3d9_renderchain_convert_geometry(chain,
&link_info,
&out_width, &out_height,
current_width, current_height, &d3d->final_viewport);
@ -1063,7 +1063,7 @@ static void d3d_recompute_pass_sizes(d3d_video_t *d3d,
}
}
void renderchain_set_final_viewport(void *data,
static void cg_d3d9_renderchain_set_final_viewport(void *data,
void *renderchain_data, const void *viewport_data)
{
d3d_video_t *d3d = (d3d_video_t*)data;
@ -1076,7 +1076,7 @@ void renderchain_set_final_viewport(void *data,
d3d_recompute_pass_sizes(d3d, chain);
}
bool renderchain_add_pass(void *data, const void *info_data)
static bool cg_d3d9_renderchain_add_pass(void *data, const void *info_data)
{
Pass pass;
const LinkInfo *info = (const LinkInfo*)info_data;
@ -1090,7 +1090,7 @@ bool renderchain_add_pass(void *data, const void *info_data)
renderchain_compile_shaders(chain, &pass.fPrg,
&pass.vPrg, info->pass->source.path);
if (!renderchain_init_shader_fvf(chain, &pass))
if (!cg_d3d9_renderchain_init_shader_fvf(chain, &pass))
return false;
pass.vertex_buf = (LPDIRECT3DVERTEXBUFFER)d3d_vertex_buffer_new(d3dr, 4 * sizeof(Vertex),
@ -1120,9 +1120,8 @@ bool renderchain_add_pass(void *data, const void *info_data)
return true;
}
bool renderchain_add_lut(void *data, const char *id,
const char *path,
bool smooth)
static bool cg_d3d9_renderchain_add_lut(void *data,
const char *id, const char *path, bool smooth)
{
lut_info info;
cg_renderchain_t *chain = (cg_renderchain_t*)data;
@ -1160,7 +1159,8 @@ bool renderchain_add_lut(void *data, const char *id,
return true;
}
void renderchain_add_state_tracker(void *data, void *tracker_data)
static void cg_d3d9_renderchain_add_state_tracker(
void *data, void *tracker_data)
{
state_tracker_t *tracker = (state_tracker_t*)tracker_data;
cg_renderchain_t *chain = (cg_renderchain_t*)data;
@ -1390,7 +1390,7 @@ static void renderchain_render_pass(void *data, void *pass_data, unsigned pass_i
renderchain_unbind_all(chain);
}
bool renderchain_render(void *chain_data, const void *data,
static bool cg_d3d9_renderchain_render(void *chain_data, const void *data,
unsigned width, unsigned height, unsigned pitch, unsigned rotation)
{
Pass *last_pass;
@ -1403,7 +1403,7 @@ bool renderchain_render(void *chain_data, const void *data,
current_width = width;
current_height = height;
renderchain_convert_geometry(chain, &chain->passes[0].info,
cg_d3d9_renderchain_convert_geometry(chain, &chain->passes[0].info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
@ -1422,7 +1422,7 @@ bool renderchain_render(void *chain_data, const void *data,
to_pass->tex->GetSurfaceLevel(0, &target);
d3dr->SetRenderTarget(0, target);
renderchain_convert_geometry(chain, &from_pass->info,
cg_d3d9_renderchain_convert_geometry(chain, &from_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
@ -1456,7 +1456,7 @@ bool renderchain_render(void *chain_data, const void *data,
last_pass = (Pass*)&chain->passes.back();
renderchain_convert_geometry(chain, &last_pass->info,
cg_d3d9_renderchain_convert_geometry(chain, &last_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
renderchain_set_viewport(chain, chain->final_viewport);
@ -1480,18 +1480,18 @@ bool renderchain_render(void *chain_data, const void *data,
}
renderchain_driver_t cg_d3d9_renderchain = {
renderchain_free,
renderchain_new,
renderchain_deinit,
renderchain_deinit_shader,
renderchain_init_shader,
renderchain_init_shader_fvf,
renderchain_init,
renderchain_set_final_viewport,
renderchain_add_pass,
renderchain_add_lut,
renderchain_add_state_tracker,
renderchain_render,
renderchain_convert_geometry,
cg_d3d9_renderchain_free,
cg_d3d9_renderchain_new,
cg_d3d9_renderchain_deinit,
cg_d3d9_renderchain_deinit_shader,
cg_d3d9_renderchain_init_shader,
cg_d3d9_renderchain_init_shader_fvf,
cg_d3d9_renderchain_init,
cg_d3d9_renderchain_set_final_viewport,
cg_d3d9_renderchain_add_pass,
cg_d3d9_renderchain_add_lut,
cg_d3d9_renderchain_add_state_tracker,
cg_d3d9_renderchain_render,
cg_d3d9_renderchain_convert_geometry,
"cg_d3d9",
};

View File

@ -22,6 +22,7 @@ static const renderchain_driver_t *renderchain_drivers[] = {
#ifdef _XBOX
&xdk_renderchain,
#endif
&null_renderchain,
NULL
};

View File

@ -23,7 +23,7 @@ typedef struct null_renderchain
void *empty;
} null_renderchain_t;
static void renderchain_blit_to_texture(
static void null_renderchain_blit_to_texture(
void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch)
{
@ -34,11 +34,11 @@ static void renderchain_blit_to_texture(
(void)pitch;
}
void renderchain_free(void *data)
static void null_renderchain_free(void *data)
{
}
void renderchain_deinit(void *data)
static void null_renderchain_deinit(void *data)
{
null_renderchain_t *renderchain = (null_renderchain_t*)data;
@ -46,7 +46,7 @@ void renderchain_deinit(void *data)
free(renderchain);
}
void *renderchain_new(void)
static void *null_renderchain_new(void)
{
null_renderchain_t *renderchain = (null_renderchain_t*)calloc(1, sizeof(*renderchain));
if (!renderchain)
@ -55,18 +55,18 @@ void *renderchain_new(void)
return renderchain;
}
void renderchain_deinit_shader(void)
static void null_renderchain_deinit_shader(void)
{
}
bool renderchain_init_shader(void *data)
static bool null_renderchain_init_shader(void *data)
{
(void)data;
return true;
}
bool renderchain_init(void *data,
static bool null_renderchain_init(void *data,
const video_info_t *info,
void *dev_data,
const void *final_viewport_data,
@ -84,7 +84,7 @@ bool renderchain_init(void *data,
return true;
}
void renderchain_set_final_viewport(void *data,
static void null_renderchain_set_final_viewport(void *data,
void *renderchain_data, const void *viewport_data)
{
(void)data;
@ -92,7 +92,7 @@ void renderchain_set_final_viewport(void *data,
(void)viewport_data;
}
bool renderchain_render(void *data, const void *frame,
static bool null_renderchain_render(void *data, const void *frame,
unsigned width, unsigned height,
unsigned pitch, unsigned rotation)
{
@ -106,7 +106,7 @@ bool renderchain_render(void *data, const void *frame,
return true;
}
bool renderchain_init_shader_fvf(void *data, void *pass_data)
static bool null_renderchain_init_shader_fvf(void *data, void *pass_data)
{
(void)data;
(void)pass_data;
@ -114,7 +114,7 @@ bool renderchain_init_shader_fvf(void *data, void *pass_data)
return true;
}
void renderchain_add_lut(void *data,
static void null_renderchain_add_lut(void *data,
unsigned index, unsigned i)
{
(void)data;
@ -122,7 +122,7 @@ void renderchain_add_lut(void *data,
(void)i;
}
bool renderchain_add_pass(void *data, const void *info_data)
static bool null_renderchain_add_pass(void *data, const void *info_data)
{
(void)data;
(void)info_data;
@ -130,13 +130,13 @@ bool renderchain_add_pass(void *data, const void *info_data)
return true;
}
void renderchain_add_state_tracker(void *data, void *tracker_data)
static void null_renderchain_add_state_tracker(void *data, void *tracker_data)
{
(void)data;
(void)tracker_data;
}
void renderchain_convert_geometry(
static void null_renderchain_convert_geometry(
void *data, const void *info_data,
unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height,
@ -152,18 +152,18 @@ void renderchain_convert_geometry(
}
renderchain_driver_t null_renderchain = {
renderchain_free,
renderchain_new,
renderchain_deinit,
renderchain_deinit_shader,
renderchain_init_shader,
renderchain_init_shader_fvf,
renderchain_init,
renderchain_set_final_viewport,
renderchain_add_pass,
renderchain_add_lut,
renderchain_add_state_tracker,
renderchain_render,
renderchain_convert_geometry,
null_renderchain_free,
null_renderchain_new,
null_renderchain_deinit,
null_renderchain_deinit_shader,
null_renderchain_init_shader,
null_renderchain_init_shader_fvf,
null_renderchain_init,
null_renderchain_set_final_viewport,
null_renderchain_add_pass,
null_renderchain_add_lut,
null_renderchain_add_state_tracker,
null_renderchain_render,
null_renderchain_convert_geometry,
"null",
};

View File

@ -53,7 +53,7 @@ static void renderchain_clear(void *data)
d3d_vertex_buffer_free(d3d->vertex_buf, d3d->vertex_decl);
}
bool renderchain_init_shader_fvf(void *data, void *pass_data)
static bool xdk_renderchain_init_shader_fvf(void *data, void *pass_data)
{
d3d_video_t *chain = (d3d_video_t*)data;
d3d_video_t *pass = (d3d_video_t*)data;
@ -105,7 +105,7 @@ static bool renderchain_create_first_pass(void *data,
d3dr->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
d3dr->SetRenderState(D3DRS_ZENABLE, FALSE);
if (!renderchain_init_shader_fvf(chain, chain))
if (!xdk_renderchain_init_shader_fvf(chain, chain))
return false;
return true;
@ -227,7 +227,7 @@ static void renderchain_blit_to_texture(void *data, const void *frame,
&d3dlr, frame, width, height, pitch);
}
void renderchain_free(void *data)
static void xdk_renderchain_free(void *data)
{
d3d_video_t *chain = (d3d_video_t*)data;
@ -243,7 +243,7 @@ void renderchain_free(void *data)
#endif
}
void renderchain_deinit(void *data)
void xdk_renderchain_deinit(void *data)
{
xdk_renderchain_t *renderchain = (xdk_renderchain_t*)data;
@ -251,7 +251,7 @@ void renderchain_deinit(void *data)
free(renderchain);
}
void *renderchain_new(void)
void *xdk_renderchain_new(void)
{
xdk_renderchain_t *renderchain = (xdk_renderchain_t*)calloc(1, sizeof(*renderchain));
if (!renderchain)
@ -260,12 +260,12 @@ void *renderchain_new(void)
return renderchain;
}
void renderchain_deinit_shader(void)
void xdk_renderchain_deinit_shader(void)
{
/* stub */
}
bool renderchain_init_shader(void *data)
static bool xdk_renderchain_init_shader(void *data)
{
const char *shader_path = NULL;
d3d_video_t *d3d = (d3d_video_t*)data;
@ -288,7 +288,7 @@ bool renderchain_init_shader(void *data)
return true;
}
bool renderchain_init(void *data,
static bool xdk_renderchain_init(void *data,
const video_info_t *info,
void *dev_data,
const void *final_viewport_data,
@ -319,7 +319,7 @@ bool renderchain_init(void *data,
return true;
}
void renderchain_set_final_viewport(void *data,
static void xdk_renderchain_set_final_viewport(void *data,
void *renderchain_data, const void *viewport_data)
{
(void)data;
@ -329,7 +329,7 @@ void renderchain_set_final_viewport(void *data,
/* stub */
}
bool renderchain_render(void *data, const void *frame,
static bool xdk_renderchain_render(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch, unsigned rotation)
{
unsigned i;
@ -362,7 +362,7 @@ bool renderchain_render(void *data, const void *frame,
return true;
}
bool renderchain_add_lut(void *data,
static bool xdk_renderchain_add_lut(void *data,
const char *id, const char *path, bool smooth)
{
xdk_renderchain_t *chain = (xdk_renderchain_t*)data;
@ -376,7 +376,7 @@ bool renderchain_add_lut(void *data,
return false;
}
bool renderchain_add_pass(void *data, const void *info_data)
static bool xdk_renderchain_add_pass(void *data, const void *info_data)
{
(void)data;
(void)info_data;
@ -385,7 +385,7 @@ bool renderchain_add_pass(void *data, const void *info_data)
return true;
}
void renderchain_add_state_tracker(void *data, void *tracker_data)
static void xdk_renderchain_add_state_tracker(void *data, void *tracker_data)
{
(void)data;
(void)tracker_data;
@ -393,7 +393,7 @@ void renderchain_add_state_tracker(void *data, void *tracker_data)
/* stub */
}
void renderchain_convert_geometry(
static void xdk_renderchain_convert_geometry(
void *data, const void *info_data,
unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height,
@ -411,18 +411,18 @@ void renderchain_convert_geometry(
}
renderchain_driver_t xdk_renderchain = {
renderchain_free,
renderchain_new,
renderchain_deinit,
renderchain_deinit_shader,
renderchain_init_shader,
renderchain_init_shader_fvf,
renderchain_init,
renderchain_set_final_viewport,
renderchain_add_pass,
renderchain_add_lut,
renderchain_add_state_tracker,
renderchain_render,
renderchain_convert_geometry,
xdk_renderchain_free,
xdk_renderchain_new,
xdk_renderchain_deinit,
xdk_renderchain_deinit_shader,
xdk_renderchain_init_shader,
xdk_renderchain_init_shader_fvf,
xdk_renderchain_init,
xdk_renderchain_set_final_viewport,
xdk_renderchain_add_pass,
xdk_renderchain_add_lut,
xdk_renderchain_add_state_tracker,
xdk_renderchain_render,
xdk_renderchain_convert_geometry,
"xdk",
};

View File

@ -229,9 +229,11 @@ VIDEO DRIVER
#include "../gfx/d3d/render_chain_driver.cpp"
#ifdef _XBOX
#include "../gfx/d3d/render_chain_xdk.cpp"
#else
#endif
#ifdef HAVE_CG
#include "../gfx/d3d/render_chain_cg.cpp"
#endif
#include "../gfx/d3d/render_chain_null.cpp"
#endif
#if defined(GEKKO)