(RARCH_CONSOLE) Use void* for param passing type

This commit is contained in:
twinaphex 2013-01-03 03:02:52 +01:00
parent 129ff2d8f3
commit 08afcbfa3d
5 changed files with 49 additions and 26 deletions

View File

@ -272,8 +272,10 @@ static bool gl_shader_init(gl_t *gl)
} }
#endif #endif
void gl_shader_use(gl_t *gl, unsigned index) void gl_shader_use(void *data, unsigned index)
{ {
gl_t *gl = (gl_t*)data;
if (gl->shader) if (gl->shader)
gl->shader->use(index); gl->shader->use(index);
} }
@ -316,8 +318,10 @@ static void gl_set_mvp(const math_matrix *mat)
} }
#endif #endif
void gl_shader_set_coords(gl_t *gl, const struct gl_coords *coords, const math_matrix *mat) void gl_shader_set_coords(void *data, const struct gl_coords *coords, const math_matrix *mat)
{ {
gl_t *gl = (gl_t*)data;
bool ret_coords = false; bool ret_coords = false;
bool ret_mvp = false; bool ret_mvp = false;
@ -520,8 +524,10 @@ error:
return false; return false;
} }
void gl_deinit_fbo(gl_t *gl) void gl_deinit_fbo(void *data)
{ {
gl_t *gl = (gl_t*)data;
if (gl->fbo_inited) if (gl->fbo_inited)
{ {
glDeleteTextures(gl->fbo_pass, gl->fbo_texture); glDeleteTextures(gl->fbo_pass, gl->fbo_texture);
@ -533,8 +539,10 @@ void gl_deinit_fbo(gl_t *gl)
} }
} }
void gl_init_fbo(gl_t *gl, unsigned width, unsigned height) void gl_init_fbo(void *data, unsigned width, unsigned height)
{ {
gl_t *gl = (gl_t*)data;
// No need to use FBOs. // No need to use FBOs.
if (!g_settings.video.render_to_texture && gl_shader_num_func(gl) == 0) if (!g_settings.video.render_to_texture && gl_shader_num_func(gl) == 0)
return; return;
@ -605,8 +613,9 @@ void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
//////////// ////////////
void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate) void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate)
{ {
gl_t *gl = (gl_t*)data;
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
if (g_extern.console.screen.state.overscan.enable) if (g_extern.console.screen.state.overscan.enable)
{ {
@ -632,8 +641,10 @@ void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate)
gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp); gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp);
} }
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate) void gl_set_viewport(void *data, unsigned width, unsigned height, bool force_full, bool allow_rotate)
{ {
gl_t *gl = (gl_t*)data;
unsigned x = 0, y = 0; unsigned x = 0, y = 0;
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1}; struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};

View File

@ -362,13 +362,13 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
extern const GLfloat vertexes_flipped[]; extern const GLfloat vertexes_flipped[];
extern const GLfloat white_color[]; extern const GLfloat white_color[];
void gl_shader_use(gl_t *gl, unsigned index); void gl_shader_use(void *data, unsigned index);
void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate); void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate);
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate); void gl_set_viewport(void *data, unsigned width, unsigned height, bool force_full, bool allow_rotate);
void gl_shader_set_coords(gl_t *gl, const struct gl_coords *coords, const math_matrix *mat); void gl_shader_set_coords(void *data, const struct gl_coords *coords, const math_matrix *mat);
void gl_init_fbo(gl_t *gl, unsigned width, unsigned height); void gl_init_fbo(void *data, unsigned width, unsigned height);
void gl_deinit_fbo(gl_t *gl); void gl_deinit_fbo(void *data);
#endif #endif

View File

@ -262,7 +262,7 @@ void gx_set_video_mode(unsigned fbWidth, unsigned lines)
g_current_framebuf = 0; g_current_framebuf = 0;
} }
const char *gx_get_video_mode() const char *gx_get_video_mode(void)
{ {
static char format[16]; static char format[16];
snprintf(format, sizeof(format), "%.3ux%.3u%c", gx_mode.fbWidth, gx_mode.efbHeight, (gx_mode.viTVMode & 3) == VI_INTERLACE ? 'i' : 'p'); snprintf(format, sizeof(format), "%.3ux%.3u%c", gx_mode.fbWidth, gx_mode.efbHeight, (gx_mode.viTVMode & 3) == VI_INTERLACE ? 'i' : 'p');
@ -284,7 +284,7 @@ void gx_set_aspect_ratio(void *data, unsigned aspectratio_idx)
gx->should_resize = true; gx->should_resize = true;
} }
static void setup_video_mode() static void setup_video_mode(void)
{ {
for (unsigned i = 0; i < 2; i++) for (unsigned i = 0; i < 2; i++)
g_framebuf[i] = MEM_K0_TO_K1(memalign(32, 640 * 576 * VI_DISPLAY_PIX_SZ)); g_framebuf[i] = MEM_K0_TO_K1(memalign(32, 640 * 576 * VI_DISPLAY_PIX_SZ));
@ -310,7 +310,7 @@ static void init_texture(unsigned width, unsigned height)
GX_InvalidateTexAll(); GX_InvalidateTexAll();
} }
static void init_vtx() static void init_vtx(void)
{ {
GX_SetCullMode(GX_CULL_NONE); GX_SetCullMode(GX_CULL_NONE);
GX_SetClipMode(GX_CLIP_DISABLE); GX_SetClipMode(GX_CLIP_DISABLE);
@ -366,7 +366,7 @@ static void build_disp_list(void)
#ifdef TAKE_EFB_SCREENSHOT_ON_EXIT #ifdef TAKE_EFB_SCREENSHOT_ON_EXIT
// Adapted from code by Crayon for GRRLIB (http://code.google.com/p/grrlib) // Adapted from code by Crayon for GRRLIB (http://code.google.com/p/grrlib)
static void gx_efb_screenshot() static void gx_efb_screenshot(void)
{ {
int x, y; int x, y;
@ -677,8 +677,10 @@ static void convert_texture32(const uint32_t *_src, uint32_t *_dst,
} }
} }
static void gx_resize(gx_video_t *gx) static void gx_resize(void *data)
{ {
gx_video_t *gx = (gx_video_t*)data;
int x = 0, y = 0; int x = 0, y = 0;
unsigned width = gx->win_width, height = gx->win_height; unsigned width = gx->win_width, height = gx->win_height;

View File

@ -110,8 +110,10 @@ const DWORD g_MapLinearToSrgbGpuFormat[] =
}; };
#endif #endif
static void check_window(xdk_d3d_video_t *d3d) static void check_window(void *data)
{ {
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
bool quit, resize; bool quit, resize;
d3d->ctx_driver->check_window(&quit, d3d->ctx_driver->check_window(&quit,
@ -133,7 +135,7 @@ static bool hlsl_shader_init(void)
} }
#endif #endif
static void xdk_d3d_free(void * data) static void xdk_d3d_free(void *data)
{ {
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
if (driver.video_data) if (driver.video_data)
@ -241,7 +243,7 @@ static void xdk_d3d_set_viewport(bool force_full)
//} //}
} }
static void xdk_d3d_set_rotation(void * data, unsigned orientation) static void xdk_d3d_set_rotation(void *data, unsigned orientation)
{ {
(void)data; (void)data;
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data; xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
@ -278,8 +280,10 @@ static void xdk_d3d_set_rotation(void * data, unsigned orientation)
} }
#ifdef HAVE_FBO #ifdef HAVE_FBO
void xdk_d3d_deinit_fbo(xdk_d3d_video_t *d3d) void xdk_d3d_deinit_fbo(void *data)
{ {
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
if (d3d->fbo_inited) if (d3d->fbo_inited)
{ {
if (d3d->lpTexture_ot) if (d3d->lpTexture_ot)
@ -298,8 +302,10 @@ void xdk_d3d_deinit_fbo(xdk_d3d_video_t *d3d)
} }
} }
void xdk_d3d_init_fbo(xdk_d3d_video_t *d3d) void xdk_d3d_init_fbo(void *data)
{ {
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
if(!g_settings.video.render_to_texture) if(!g_settings.video.render_to_texture)
return; return;
@ -403,8 +409,10 @@ void xdk_d3d_generate_pp(D3DPRESENT_PARAMETERS *d3dpp, const video_info_t *video
d3dpp->EnableAutoDepthStencil = FALSE; d3dpp->EnableAutoDepthStencil = FALSE;
} }
static void xdk_d3d_init_textures(xdk_d3d_video_t *d3d, const video_info_t *video) static void xdk_d3d_init_textures(void *data, const video_info_t *video)
{ {
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
D3DPRESENT_PARAMETERS d3dpp; D3DPRESENT_PARAMETERS d3dpp;
D3DVIEWPORT vp = {0}; D3DVIEWPORT vp = {0};
xdk_d3d_generate_pp(&d3dpp, video); xdk_d3d_generate_pp(&d3dpp, video);
@ -456,8 +464,10 @@ static void xdk_d3d_init_textures(xdk_d3d_video_t *d3d, const video_info_t *vide
g_extern.console.screen.viewports.custom_vp.height = vp.Height; g_extern.console.screen.viewports.custom_vp.height = vp.Height;
} }
static void xdk_d3d_reinit_textures(xdk_d3d_video_t *d3d, const video_info_t *video) static void xdk_d3d_reinit_textures(void *data, const video_info_t *video)
{ {
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
unsigned old_base_size = d3d->base_size; unsigned old_base_size = d3d->base_size;
unsigned old_width = d3d->tex_w; unsigned old_width = d3d->tex_w;
unsigned old_height = d3d->tex_h; unsigned old_height = d3d->tex_h;

View File

@ -83,8 +83,8 @@ typedef struct xdk_d3d_video
extern void xdk_d3d_generate_pp(D3DPRESENT_PARAMETERS *d3dpp, const video_info_t *video); extern void xdk_d3d_generate_pp(D3DPRESENT_PARAMETERS *d3dpp, const video_info_t *video);
#ifdef HAVE_FBO #ifdef HAVE_FBO
extern void xdk_d3d_deinit_fbo(xdk_d3d_video_t *d3d); extern void xdk_d3d_deinit_fbo(void *data);
extern void xdk_d3d_init_fbo(xdk_d3d_video_t *d3d); extern void xdk_d3d_init_fbo(void *data);
#endif #endif
#endif #endif