Skip to content

Commit

Permalink
Create d3d_device_get_render_target_data
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Oct 1, 2017
1 parent d960cc8 commit ebe5f65
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions gfx/common/d3d_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions gfx/common/d3d_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers_renderchain/d3d9_cg_renderchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ebe5f65

Please sign in to comment.