Move d3d9_renderchain_blit_to_texture to d3d9_common.c

This commit is contained in:
twinaphex 2022-04-22 13:50:36 +02:00
parent 6f71879012
commit cedf77d87f
6 changed files with 40 additions and 32 deletions

View File

@ -1506,6 +1506,34 @@ void d3d9_set_rotation(void *data, unsigned rot)
d3d->dev_rotation = rot;
}
void d3d9_blit_to_texture(
LPDIRECT3DTEXTURE9 tex,
const void *frame,
unsigned tex_width, unsigned tex_height,
unsigned width, unsigned height,
unsigned last_width, unsigned last_height,
unsigned pitch, unsigned pixel_size)
{
D3DLOCKED_RECT d3dlr = {0, NULL};
if (
(last_width != width || last_height != height)
)
{
d3d9_lock_rectangle(tex, 0, &d3dlr,
NULL, tex_height, D3DLOCK_NOSYSLOCK);
d3d9_lock_rectangle_clear(tex, 0, &d3dlr,
NULL, tex_height, D3DLOCK_NOSYSLOCK);
}
if (d3d9_lock_rectangle(tex, 0, &d3dlr, NULL, 0, 0))
{
d3d9_texture_blit(pixel_size, tex,
&d3dlr, frame, width, height, pitch);
d3d9_unlock_rectangle(tex);
}
}
#ifdef HAVE_OVERLAY
void d3d9_free_overlays(d3d9_video_t *d3d)
{

View File

@ -785,6 +785,14 @@ void d3d9_set_viewport(void *data,
void d3d9_set_menu_texture_enable(void *data,
bool state, bool full_screen);
void d3d9_blit_to_texture(
LPDIRECT3DTEXTURE9 tex,
const void *frame,
unsigned tex_width, unsigned tex_height,
unsigned width, unsigned height,
unsigned last_width, unsigned last_height,
unsigned pitch, unsigned pixel_size);
void d3d9_apply_state_changes(void *data);
extern LPDIRECT3D9 g_pD3D9;

View File

@ -214,7 +214,7 @@ static void d3d8_renderchain_set_vertices(
}
}
static void d3d8_renderchain_blit_to_texture(
static void d3d8_blit_to_texture(
d3d8_renderchain_t *chain,
const void *frame,
unsigned width, unsigned height, unsigned pitch)
@ -318,7 +318,7 @@ static bool d3d8_renderchain_render(
LPDIRECT3DDEVICE8 d3dr = (LPDIRECT3DDEVICE8)d3d->dev;
d3d8_renderchain_t *chain = (d3d8_renderchain_t*)d3d->renderchain_data;
d3d8_renderchain_blit_to_texture(chain, frame, frame_width, frame_height, pitch);
d3d8_blit_to_texture(chain, frame, frame_width, frame_height, pitch);
d3d8_renderchain_set_vertices(d3d, chain, 1, frame_width, frame_height, chain->frame_count);
d3d8_renderchain_render_pass(d3d, d3dr, chain, 0, rotation);

View File

@ -367,34 +367,6 @@ static INLINE void d3d9_init_renderchain(d3d9_renderchain_t *chain)
chain->bound_vert = unsigned_vector_list_new();
}
static INLINE void d3d9_renderchain_blit_to_texture(
LPDIRECT3DTEXTURE9 tex,
const void *frame,
unsigned tex_width, unsigned tex_height,
unsigned width, unsigned height,
unsigned last_width, unsigned last_height,
unsigned pitch, unsigned pixel_size)
{
D3DLOCKED_RECT d3dlr = {0, NULL};
if (
(last_width != width || last_height != height)
)
{
d3d9_lock_rectangle(tex, 0, &d3dlr,
NULL, tex_height, D3DLOCK_NOSYSLOCK);
d3d9_lock_rectangle_clear(tex, 0, &d3dlr,
NULL, tex_height, D3DLOCK_NOSYSLOCK);
}
if (d3d9_lock_rectangle(tex, 0, &d3dlr, NULL, 0, 0))
{
d3d9_texture_blit(pixel_size, tex,
&d3dlr, frame, width, height, pitch);
d3d9_unlock_rectangle(tex);
}
}
RETRO_END_DECLS
#endif

View File

@ -1133,7 +1133,7 @@ static bool d3d9_cg_renderchain_render(
&out_width, &out_height,
current_width, current_height, chain->final_viewport);
d3d9_renderchain_blit_to_texture(first_pass->tex,
d3d9_blit_to_texture(first_pass->tex,
frame_data,
first_pass->info.tex_w,
first_pass->info.tex_h,

View File

@ -689,7 +689,7 @@ static bool hlsl_d3d9_renderchain_render(
&out_width, &out_height,
current_width, current_height, chain->chain.final_viewport);
d3d9_renderchain_blit_to_texture(first_pass->tex,
d3d9_blit_to_texture(first_pass->tex,
frame,
first_pass->info.tex_w,
first_pass->info.tex_h,