mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Create d3d_begin_scene/d3d_end_scene
This commit is contained in:
parent
c1cf1af265
commit
c4c41b277e
@ -411,6 +411,42 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
|
||||
#endif
|
||||
}
|
||||
|
||||
bool d3d_begin_scene(LPDIRECT3DDEVICE dev)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3DDevice9_BeginScene(dev)))
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
if (SUCCEEDED(IDirect3DDevice8_BeginScene(dev)))
|
||||
#else
|
||||
if (SUCCEEDED(dev->BeginScene()))
|
||||
#endif
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void d3d_end_scene(LPDIRECT3DDEVICE dev)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_EndScene(dev);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_EndScene(dev);
|
||||
#else
|
||||
dev->EndScene();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void d3d_draw_primitive_internal(LPDIRECT3DDEVICE dev,
|
||||
D3DPRIMITIVETYPE type, unsigned start, unsigned count)
|
||||
{
|
||||
#if defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_DrawPrimitive(dev, type, start, count);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_DrawPrimitive(dev, type, start, count);
|
||||
#else
|
||||
dev->DrawPrimitive(type, start, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
||||
D3DPRIMITIVETYPE type, unsigned start, unsigned count)
|
||||
{
|
||||
@ -418,19 +454,11 @@ void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
||||
D3DDevice_DrawVertices(type, start, D3DVERTEXCOUNT(type, count));
|
||||
#elif defined(_XBOX360)
|
||||
D3DDevice_DrawVertices(dev, type, start, D3DVERTEXCOUNT(type, count));
|
||||
#elif defined(HAVE_D3D9) && !defined(__cplusplus)
|
||||
IDirect3DDevice9_BeginScene(dev);
|
||||
IDirect3DDevice9_DrawPrimitive(dev, type, start, count);
|
||||
IDirect3DDevice9_EndScene(dev);
|
||||
#elif defined(HAVE_D3D8) && !defined(__cplusplus)
|
||||
IDirect3DDevice8_BeginScene(dev);
|
||||
IDirect3DDevice8_DrawPrimitive(dev, type, start, count);
|
||||
IDirect3DDevice8_EndScene(dev);
|
||||
#else
|
||||
if (SUCCEEDED(dev->BeginScene()))
|
||||
if (d3d_begin_scene(dev))
|
||||
{
|
||||
dev->DrawPrimitive(type, start, count);
|
||||
dev->EndScene();
|
||||
d3d_draw_primitive_internal(dev, type, start, count);
|
||||
d3d_end_scene(dev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -63,6 +63,10 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
|
||||
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
|
||||
unsigned sampler, unsigned value);
|
||||
|
||||
bool d3d_begin_scene(LPDIRECT3DDEVICE dev);
|
||||
|
||||
void d3d_end_scene(LPDIRECT3DDEVICE dev);
|
||||
|
||||
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
|
||||
D3DPRIMITIVETYPE type, unsigned start, unsigned count);
|
||||
|
||||
|
@ -105,7 +105,7 @@ static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data,
|
||||
if (!msg)
|
||||
return;
|
||||
d3d_set_viewports(d3dfonts->d3d->dev, &d3dfonts->d3d->final_viewport);
|
||||
if (!(SUCCEEDED(d3dfonts->d3d->dev->BeginScene())))
|
||||
if (!d3d_begin_scene(d3dfonts->d3d->dev))
|
||||
return;
|
||||
|
||||
d3dfonts->font->DrawTextA(NULL,
|
||||
@ -122,7 +122,7 @@ static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, void *data,
|
||||
DT_LEFT,
|
||||
d3dfonts->color | 0xff000000);
|
||||
|
||||
d3dfonts->d3d->dev->EndScene();
|
||||
d3d_end_scene(d3dfonts->d3d->dev);
|
||||
}
|
||||
|
||||
font_renderer_t d3d_win32_font = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user