create d3d9_convert_geometry

This commit is contained in:
twinaphex 2018-05-14 21:32:14 +02:00
parent c941b4e922
commit 39f45a17d2
4 changed files with 49 additions and 68 deletions

View File

@ -54,7 +54,7 @@ typedef struct d3d9_renderchain_driver
bool (*render)(d3d9_video_t *d3d, state_tracker_t *tracker,
const void *frame,
unsigned width, unsigned height, unsigned pitch, unsigned rotation);
void (*convert_geometry)(void *data, const struct LinkInfo *info,
void (*convert_geometry)(const struct LinkInfo *info,
unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height,
D3DVIEWPORT9 *final_viewport);
@ -771,6 +771,48 @@ static INLINE INT32 d3d9_get_xrgb8888_format(void)
#endif
}
static INLINE void d3d9_convert_geometry(
const struct LinkInfo *info,
unsigned *out_width,
unsigned *out_height,
unsigned width,
unsigned height,
D3DVIEWPORT9 *final_viewport)
{
if (!info)
return;
switch (info->pass->fbo.type_x)
{
case RARCH_SCALE_VIEWPORT:
*out_width = info->pass->fbo.scale_x * final_viewport->Width;
break;
case RARCH_SCALE_ABSOLUTE:
*out_width = info->pass->fbo.abs_x;
break;
case RARCH_SCALE_INPUT:
*out_width = info->pass->fbo.scale_x * width;
break;
}
switch (info->pass->fbo.type_y)
{
case RARCH_SCALE_VIEWPORT:
*out_height = info->pass->fbo.scale_y * final_viewport->Height;
break;
case RARCH_SCALE_ABSOLUTE:
*out_height = info->pass->fbo.abs_y;
break;
case RARCH_SCALE_INPUT:
*out_height = info->pass->fbo.scale_y * height;
break;
}
}
RETRO_END_DECLS
#endif

View File

@ -274,8 +274,8 @@ static bool d3d9_init_chain(d3d9_video_t *d3d, const video_info_t *video_info)
for (i = 1; i < d3d->shader.passes; i++)
{
d3d->renderchain_driver->convert_geometry(d3d->renderchain_data,
&link_info,
d3d9_convert_geometry(
&link_info,
&out_width, &out_height,
current_width, current_height, &d3d->final_viewport);

View File

@ -896,51 +896,6 @@ static bool d3d9_cg_renderchain_set_pass_size(
return true;
}
static void d3d9_cg_renderchain_convert_geometry(
void *data,
const struct LinkInfo *info,
unsigned *out_width,
unsigned *out_height,
unsigned width,
unsigned height,
D3DVIEWPORT9 *final_viewport)
{
cg_renderchain_t *chain = (cg_renderchain_t*)data;
if (!chain || !info)
return;
switch (info->pass->fbo.type_x)
{
case RARCH_SCALE_VIEWPORT:
*out_width = info->pass->fbo.scale_x * final_viewport->Width;
break;
case RARCH_SCALE_ABSOLUTE:
*out_width = info->pass->fbo.abs_x;
break;
case RARCH_SCALE_INPUT:
*out_width = info->pass->fbo.scale_x * width;
break;
}
switch (info->pass->fbo.type_y)
{
case RARCH_SCALE_VIEWPORT:
*out_height = info->pass->fbo.scale_y * final_viewport->Height;
break;
case RARCH_SCALE_ABSOLUTE:
*out_height = info->pass->fbo.abs_y;
break;
case RARCH_SCALE_INPUT:
*out_height = info->pass->fbo.scale_y * height;
break;
}
}
static void d3d_recompute_pass_sizes(cg_renderchain_t *chain,
d3d9_video_t *d3d)
{
@ -964,7 +919,7 @@ static void d3d_recompute_pass_sizes(cg_renderchain_t *chain,
for (i = 1; i < d3d->shader.passes; i++)
{
d3d9_cg_renderchain_convert_geometry(chain,
d3d9_convert_geometry(
&link_info,
&out_width, &out_height,
current_width, current_height, &d3d->final_viewport);
@ -1379,7 +1334,7 @@ static bool d3d9_cg_renderchain_render(
first_pass = (struct cg_pass*)&chain->passes->data[0];
d3d9_cg_renderchain_convert_geometry(chain,
d3d9_renderchain_convert_geometry(
&first_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
@ -1408,7 +1363,7 @@ static bool d3d9_cg_renderchain_render(
d3d9_device_set_render_target(chain->dev, 0, (void*)target);
d3d9_cg_renderchain_convert_geometry(chain, &from_pass->info,
d3d9_convert_geometry(&from_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
@ -1445,7 +1400,7 @@ static bool d3d9_cg_renderchain_render(
last_pass = (struct cg_pass*)&chain->passes->
data[chain->passes->count - 1];
d3d9_cg_renderchain_convert_geometry(chain, &last_pass->info,
d3d9_convert_geometry(&last_pass->info,
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
@ -1540,7 +1495,6 @@ d3d9_renderchain_driver_t cg_d3d9_renderchain = {
d3d9_cg_renderchain_add_pass,
d3d9_cg_renderchain_add_lut,
d3d9_cg_renderchain_render,
d3d9_cg_renderchain_convert_geometry,
d3d9_cg_renderchain_read_viewport,
"cg_d3d9",
};

View File

@ -487,20 +487,6 @@ static bool hlsl_d3d9_renderchain_add_pass(
return true;
}
static void hlsl_d3d9_renderchain_convert_geometry(
void *data, const struct LinkInfo *info,
unsigned *out_width, unsigned *out_height,
unsigned width, unsigned height,
D3DVIEWPORT9 *final_viewport)
{
(void)data;
(void)out_width;
(void)out_height;
(void)width;
(void)height;
/* stub */
}
d3d9_renderchain_driver_t hlsl_d3d9_renderchain = {
hlsl_d3d9_renderchain_free,
hlsl_d3d9_renderchain_new,
@ -509,7 +495,6 @@ d3d9_renderchain_driver_t hlsl_d3d9_renderchain = {
hlsl_d3d9_renderchain_add_pass,
NULL, /* add_lut */
hlsl_d3d9_renderchain_render,
hlsl_d3d9_renderchain_convert_geometry,
NULL, /* read_viewport */
"hlsl_d3d9",
};