Create d3d_device_create_offscreen_plain_surface

This commit is contained in:
twinaphex 2017-10-02 00:38:05 +02:00
parent 95ca5a3876
commit 0559be4e72
3 changed files with 33 additions and 16 deletions

View File

@ -271,6 +271,23 @@ void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no,
#endif
}
bool d3d_device_create_offscreen_plain_surface(
LPDIRECT3DDEVICE dev,
unsigned width,
unsigned height,
unsigned format,
unsigned pool,
void **surf_data,
void *data)
{
if (FAILED(dev->CreateOffscreenPlainSurface(width, height,
(D3DFORMAT)format, (D3DPOOL)pool,
(LPDIRECT3DSURFACE*)surf_data,
(HANDLE*)data)))
return false;
return true;
}
static void d3d_set_texture_stage_state(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned value, unsigned type)
{

View File

@ -124,6 +124,15 @@ void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value);
void d3d_device_set_render_target(LPDIRECT3DDEVICE dev, unsigned idx,
void *data);
bool d3d_device_create_offscreen_plain_surface(
LPDIRECT3DDEVICE dev,
unsigned width,
unsigned height,
unsigned format,
unsigned pool,
void **surf_data,
void *data);
bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp);
void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d);

View File

@ -1547,25 +1547,16 @@ static bool d3d9_cg_renderchain_read_viewport(
video_driver_get_size(&width, &height);
(void)d3d;
(void)data;
(void)buffer;
if (!d3d_device_get_render_target(d3dr, 0, (void**)&target))
{
ret = false;
goto end;
}
if (FAILED(d3d->d3d_err = d3dr->CreateOffscreenPlainSurface(
width, height,
D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM,
&dest, NULL)))
{
ret = false;
goto end;
}
if (!d3d_device_get_render_target_data(d3dr, (void*)target, (void*)dest))
if (
!d3d_device_get_render_target(d3dr, 0, (void**)&target) ||
!d3d_device_create_offscreen_plain_surface(d3dr, width, height,
D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, (void**)&dest, NULL) ||
!d3d_device_get_render_target_data(d3dr, (void*)target, (void*)dest)
)
{
ret = false;
goto end;