Create d3d_device_get_render_target_data

This commit is contained in:
twinaphex 2017-10-01 23:14:43 +02:00
parent d960cc8c0f
commit ebe5f65893
3 changed files with 19 additions and 1 deletions

View File

@ -391,6 +391,21 @@ void d3d_clear(LPDIRECT3DDEVICE dev,
#endif
}
bool d3d_device_get_render_target_data(LPDIRECT3DDEVICE dev,
void *_src, void *_dst)
{
LPDIRECT3DSURFACE src = (LPDIRECT3DSURFACE)_src;
LPDIRECT3DSURFACE dst = (LPDIRECT3DSURFACE)_dst;
#if defined(HAVE_D3D9) && !defined(__cplusplus)
if (SUCCEEDED(IDirect3DDevice9_GetRenderTargetData(dev, src, dst)))
return true;
#else
if (SUCCEEDED(dev->GetRenderTargetData(src, dst)))
return true;
#endif
return false;
}
bool d3d_device_get_render_target(LPDIRECT3DDEVICE dev,
unsigned idx, void **data)
{

View File

@ -110,6 +110,9 @@ void d3d_frame_postprocess(void *data);
void d3d_surface_free(void *data);
bool d3d_device_get_render_target_data(LPDIRECT3DDEVICE dev,
void *_src, void *_dst);
bool d3d_device_get_render_target(LPDIRECT3DDEVICE dev,
unsigned idx, void **data);

View File

@ -1565,7 +1565,7 @@ static bool d3d9_cg_renderchain_read_viewport(
goto end;
}
if (FAILED(d3d->d3d_err = d3dr->GetRenderTargetData(target, dest)))
if (!d3d_device_get_render_target_data(d3dr, (void*)target, (void*)dest))
{
ret = false;
goto end;