diff --git a/gfx/common/d3d8_common.h b/gfx/common/d3d8_common.h index eff0cc026b..103bc84b1f 100644 --- a/gfx/common/d3d8_common.h +++ b/gfx/common/d3d8_common.h @@ -56,7 +56,7 @@ typedef struct d3d8_video video_info_t video_info; WNDCLASSEX windowClass; LPDIRECT3DDEVICE8 dev; - d3d_video_viewport_t final_viewport; + D3DVIEWPORT8 final_viewport; char *shader_path; diff --git a/gfx/common/d3d9_common.h b/gfx/common/d3d9_common.h index d36d5e620f..2d45e4afb2 100644 --- a/gfx/common/d3d9_common.h +++ b/gfx/common/d3d9_common.h @@ -37,9 +37,9 @@ typedef struct d3d9_renderchain_driver void *(*chain_new)(void); bool (*init)(d3d9_video_t *d3d, const video_info_t *video_info, - void *dev_data, - const void *final_viewport_data, - const void *info_data, + LPDIRECT3DDEVICE9 dev, + const D3DVIEWPORT9 *final_viewport, + const struct LinkInfo *info, bool rgb32); void (*set_final_viewport)(d3d9_video_t *d3d, void *renderchain_data, const void *viewport_data); @@ -87,7 +87,7 @@ typedef struct d3d9_video video_info_t video_info; WNDCLASSEX windowClass; LPDIRECT3DDEVICE9 dev; - d3d_video_viewport_t final_viewport; + D3DVIEWPORT9 final_viewport; char *shader_path; diff --git a/gfx/drivers/d3d.h b/gfx/drivers/d3d.h index fa4814fb33..116b1e5020 100644 --- a/gfx/drivers/d3d.h +++ b/gfx/drivers/d3d.h @@ -52,15 +52,5 @@ typedef struct Vertex float u, v; } Vertex; -typedef struct d3d_video_viewport -{ - DWORD x; - DWORD y; - DWORD width; - DWORD height; - float min_z; - float max_z; -} d3d_video_viewport_t; - #endif diff --git a/gfx/drivers/d3d8.c b/gfx/drivers/d3d8.c index da30e422c1..b8b8a3a6ce 100644 --- a/gfx/drivers/d3d8.c +++ b/gfx/drivers/d3d8.c @@ -261,10 +261,10 @@ static void d3d8_renderchain_viewport_info(void *data, video_driver_get_size(&width, &height); - vp->x = d3d->final_viewport.x; - vp->y = d3d->final_viewport.y; - vp->width = d3d->final_viewport.width; - vp->height = d3d->final_viewport.height; + vp->x = d3d->final_viewport.X; + vp->y = d3d->final_viewport.Y; + vp->width = d3d->final_viewport.Width; + vp->height = d3d->final_viewport.Height; vp->full_width = width; vp->full_height = height; @@ -285,7 +285,7 @@ static void d3d8_renderchain_render_pass( d3d8_set_sampler_minfilter(d3dr, pass_index, video_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT); - d3d8_set_viewports(chain->dev, (D3DVIEWPORT8*)&d3d->final_viewport); + d3d8_set_viewports(chain->dev, &d3d->final_viewport); d3d8_set_vertex_shader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_DIFFUSE, NULL); @@ -892,12 +892,12 @@ static void d3d8_set_viewport(void *data, if (y < 0) y = 0; - d3d->final_viewport.x = x; - d3d->final_viewport.y = y; - d3d->final_viewport.width = width; - d3d->final_viewport.height= height; - d3d->final_viewport.min_z = 0.0f; - d3d->final_viewport.max_z = 0.0f; + d3d->final_viewport.X = x; + d3d->final_viewport.Y = y; + d3d->final_viewport.Width = width; + d3d->final_viewport.Height = height; + d3d->final_viewport.MinZ = 0.0f; + d3d->final_viewport.MaxZ = 0.0f; d3d_matrix_ortho_off_center_lh(&ortho, 0, 1, 0, 1, 0.0f, 1.0f); d3d_matrix_identity(&rot); diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index 4ea93953b0..0a2b1e9d48 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -447,10 +447,10 @@ static void d3d9_viewport_info(void *data, struct video_viewport *vp) video_driver_get_size(&width, &height); - vp->x = d3d->final_viewport.x; - vp->y = d3d->final_viewport.y; - vp->width = d3d->final_viewport.width; - vp->height = d3d->final_viewport.height; + vp->x = d3d->final_viewport.X; + vp->y = d3d->final_viewport.Y; + vp->width = d3d->final_viewport.Width; + vp->height = d3d->final_viewport.Height; vp->full_width = width; vp->full_height = height; @@ -894,12 +894,12 @@ static void d3d9_set_viewport(void *data, if (y < 0) y = 0; - d3d->final_viewport.x = x; - d3d->final_viewport.y = y; - d3d->final_viewport.width = width; - d3d->final_viewport.height = height; - d3d->final_viewport.min_z = 0.0f; - d3d->final_viewport.max_z = 1.0f; + d3d->final_viewport.X = x; + d3d->final_viewport.Y = y; + d3d->final_viewport.Width = width; + d3d->final_viewport.Height = height; + d3d->final_viewport.MinZ = 0.0f; + d3d->final_viewport.MaxZ = 1.0f; if (d3d->renderchain_driver && d3d->renderchain_driver->set_font_rect) d3d->renderchain_driver->set_font_rect(d3d, NULL); diff --git a/gfx/drivers_renderchain/d3d9_cg_renderchain.c b/gfx/drivers_renderchain/d3d9_cg_renderchain.c index 45904b5e0d..e1e70c6ced 100644 --- a/gfx/drivers_renderchain/d3d9_cg_renderchain.c +++ b/gfx/drivers_renderchain/d3d9_cg_renderchain.c @@ -860,11 +860,11 @@ static bool d3d9_cg_renderchain_create_first_pass( static bool d3d9_cg_renderchain_init( d3d9_video_t *d3d, const video_info_t *video_info, - void *dev_, - const void *final_viewport_, - const void *info_data, bool rgb32) + LPDIRECT3DDEVICE9 dev, + const D3DVIEWPORT9 *final_viewport, + const struct LinkInfo *info, + bool rgb32) { - const struct LinkInfo *info = (const struct LinkInfo*)info_data; cg_renderchain_t *chain = (cg_renderchain_t*)d3d->renderchain_data; unsigned fmt = (rgb32) ? RETRO_PIXEL_FORMAT_XRGB8888 : RETRO_PIXEL_FORMAT_RGB565; @@ -876,10 +876,10 @@ static bool d3d9_cg_renderchain_init( return false; } - chain->dev = (void*)dev_; + chain->dev = dev; chain->video_info = video_info; chain->state_tracker = NULL; - chain->final_viewport = (D3DVIEWPORT9*)final_viewport_; + chain->final_viewport = (D3DVIEWPORT9*)final_viewport; chain->frame_count = 0; chain->pixel_size = (fmt == RETRO_PIXEL_FORMAT_RGB565) ? 2 : 4; @@ -1599,13 +1599,13 @@ static bool d3d9_cg_renderchain_read_viewport( unsigned pitchpix = rect.Pitch / 4; const uint32_t *pixels = (const uint32_t*)rect.pBits; - pixels += d3d->final_viewport.x; - pixels += (d3d->final_viewport.height - 1) * pitchpix; - pixels -= d3d->final_viewport.y * pitchpix; + pixels += d3d->final_viewport.X; + pixels += (d3d->final_viewport.Height - 1) * pitchpix; + pixels -= d3d->final_viewport.Y * pitchpix; - for (y = 0; y < d3d->final_viewport.height; y++, pixels -= pitchpix) + for (y = 0; y < d3d->final_viewport.Height; y++, pixels -= pitchpix) { - for (x = 0; x < d3d->final_viewport.width; x++) + for (x = 0; x < d3d->final_viewport.Width; x++) { *buffer++ = (pixels[x] >> 0) & 0xff; *buffer++ = (pixels[x] >> 8) & 0xff; diff --git a/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c b/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c index c5bccdc8b7..41d19a78a0 100644 --- a/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c +++ b/gfx/drivers_renderchain/d3d9_hlsl_renderchain.c @@ -252,14 +252,13 @@ static bool hlsl_d3d9_renderchain_init_shader(d3d9_video_t *d3d, static bool hlsl_d3d9_renderchain_init( d3d9_video_t *d3d, const video_info_t *video_info, - void *dev_data, - const void *final_viewport_data, - const void *info_data, + LPDIRECT3DDEVICE9 dev, + const D3DVIEWPORT9 *final_viewport, + const struct LinkInfo *info, bool rgb32 ) { unsigned width, height; - const struct LinkInfo *info = (const struct LinkInfo*)info_data; hlsl_d3d9_renderchain_t *chain = (hlsl_d3d9_renderchain_t*) d3d->renderchain_data; unsigned fmt = (rgb32) @@ -271,7 +270,7 @@ static bool hlsl_d3d9_renderchain_init( video_driver_get_size(&width, &height); - chain->dev = (LPDIRECT3DDEVICE9)dev_data; + chain->dev = dev; chain->pixel_size = (fmt == RETRO_PIXEL_FORMAT_RGB565) ? 2 : 4; chain->tex_w = info->tex_w; chain->tex_h = info->tex_h;