From 08afcbfa3d59fe78c313b7d29b7a8c3703854e29 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 3 Jan 2013 03:02:52 +0100 Subject: [PATCH] (RARCH_CONSOLE) Use void* for param passing type --- gfx/gl.c | 23 +++++++++++++++++------ gfx/gl_common.h | 12 ++++++------ gx/gx_video.c | 12 +++++++----- xdk/xdk_d3d.cpp | 24 +++++++++++++++++------- xdk/xdk_d3d.h | 4 ++-- 5 files changed, 49 insertions(+), 26 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index 027e5209e8..3e0a072173 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -272,8 +272,10 @@ static bool gl_shader_init(gl_t *gl) } #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) gl->shader->use(index); } @@ -316,8 +318,10 @@ static void gl_set_mvp(const math_matrix *mat) } #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_mvp = false; @@ -520,8 +524,10 @@ error: 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) { 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. if (!g_settings.video.render_to_texture && gl_shader_num_func(gl) == 0) 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 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); } -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; struct gl_ortho ortho = {0, 1, 0, 1, -1, 1}; diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 0e1636e3ff..d35247b11b 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -362,13 +362,13 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture; extern const GLfloat vertexes_flipped[]; extern const GLfloat white_color[]; -void gl_shader_use(gl_t *gl, unsigned index); -void gl_set_projection(gl_t *gl, 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_shader_set_coords(gl_t *gl, const struct gl_coords *coords, const math_matrix *mat); +void gl_shader_use(void *data, unsigned index); +void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate); +void gl_set_viewport(void *data, unsigned width, unsigned height, bool force_full, bool allow_rotate); +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_deinit_fbo(gl_t *gl); +void gl_init_fbo(void *data, unsigned width, unsigned height); +void gl_deinit_fbo(void *data); #endif diff --git a/gx/gx_video.c b/gx/gx_video.c index eb118e64e7..244f339fc3 100644 --- a/gx/gx_video.c +++ b/gx/gx_video.c @@ -262,7 +262,7 @@ void gx_set_video_mode(unsigned fbWidth, unsigned lines) g_current_framebuf = 0; } -const char *gx_get_video_mode() +const char *gx_get_video_mode(void) { 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'); @@ -284,7 +284,7 @@ void gx_set_aspect_ratio(void *data, unsigned aspectratio_idx) gx->should_resize = true; } -static void setup_video_mode() +static void setup_video_mode(void) { for (unsigned i = 0; i < 2; i++) 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(); } -static void init_vtx() +static void init_vtx(void) { GX_SetCullMode(GX_CULL_NONE); GX_SetClipMode(GX_CLIP_DISABLE); @@ -366,7 +366,7 @@ static void build_disp_list(void) #ifdef TAKE_EFB_SCREENSHOT_ON_EXIT // 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; @@ -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; unsigned width = gx->win_width, height = gx->win_height; diff --git a/xdk/xdk_d3d.cpp b/xdk/xdk_d3d.cpp index 3f3b758e2c..03cfcd24b2 100644 --- a/xdk/xdk_d3d.cpp +++ b/xdk/xdk_d3d.cpp @@ -110,8 +110,10 @@ const DWORD g_MapLinearToSrgbGpuFormat[] = }; #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; d3d->ctx_driver->check_window(&quit, @@ -133,7 +135,7 @@ static bool hlsl_shader_init(void) } #endif -static void xdk_d3d_free(void * data) +static void xdk_d3d_free(void *data) { #ifdef RARCH_CONSOLE 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; 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 -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->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) return; @@ -403,8 +409,10 @@ void xdk_d3d_generate_pp(D3DPRESENT_PARAMETERS *d3dpp, const video_info_t *video 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; D3DVIEWPORT vp = {0}; 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; } -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_width = d3d->tex_w; unsigned old_height = d3d->tex_h; diff --git a/xdk/xdk_d3d.h b/xdk/xdk_d3d.h index 84e52dba0f..81179fa2af 100644 --- a/xdk/xdk_d3d.h +++ b/xdk/xdk_d3d.h @@ -83,8 +83,8 @@ typedef struct xdk_d3d_video extern void xdk_d3d_generate_pp(D3DPRESENT_PARAMETERS *d3dpp, const video_info_t *video); #ifdef HAVE_FBO -extern void xdk_d3d_deinit_fbo(xdk_d3d_video_t *d3d); -extern void xdk_d3d_init_fbo(xdk_d3d_video_t *d3d); +extern void xdk_d3d_deinit_fbo(void *data); +extern void xdk_d3d_init_fbo(void *data); #endif #endif