(D3D) Use d3d_lockrectangle_clear wrapper function

This commit is contained in:
twinaphex 2014-09-12 21:15:49 +02:00
parent 0bc83ca6ae
commit f778d36272
6 changed files with 10 additions and 17 deletions

View File

@ -60,12 +60,6 @@
#include <vector>
#ifndef _XBOX
#define D3DTexture_LockRectClear(pass, tex, level, lockedrect, rect, flags) \
if (SUCCEEDED(tex->LockRect(level, &lockedrect, rect, flags))) \
{ \
memset(lockedrect.pBits, level, pass.info.tex_h * lockedrect.Pitch); \
tex->UnlockRect(0); \
}
#define D3DDevice_CreateVertexBuffers(device, Length, Usage, UnusedFVF, UnusedPool, ppVertexBuffer, pUnusedSharedHandle) device->CreateVertexBuffer(Length, Usage, UnusedFVF, UnusedPool, ppVertexBuffer, NULL)
#endif

View File

@ -137,15 +137,17 @@ void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
#endif
}
void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
unsigned tex_width, unsigned tex_height,
void d3d_lockrectangle_clear(void *data,
LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT lock_rect, RECT rect,
unsigned flags)
{
#if defined(_XBOX)
d3d_video_t *chain = (d3d_video_t*)data;
D3DTexture_LockRect(tex, level, &lock_rect, &rect, flags);
memset(lock_rect.pBits, 0, tex_height * lock_rect.Pitch);
memset(lock_rect.pBits, 0, chain->tex_h * lock_rect.Pitch);
#else
renderchain_t *chain = (renderchain_t*)data;
if (SUCCEEDED(tex->LockRect(level, &lock_rect, &rect, flags)))
{
memset(lock_rect.pBits, level, tex_height * lock_rect.Pitch);

View File

@ -45,8 +45,8 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
D3DPRIMITIVETYPE type, unsigned start, unsigned count);
void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
unsigned tex_width, unsigned tex_height,
void d3d_lockrectangle_clear(void *data,
LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT lock_rect, RECT rect,
unsigned flags);

View File

@ -537,7 +537,7 @@ void renderchain_blit_to_texture(void *data, const void *frame,
if (first.last_width != width || first.last_height != height)
{
D3DTexture_LockRectClear(first, first.tex, 0, d3dlr,
d3d_lockrectangle_clear(first, first.tex, 0, d3dlr,
NULL, D3DLOCK_NOSYSLOCK);
}

View File

@ -267,7 +267,8 @@ static void renderchain_blit_to_texture(void *data, const void *frame,
if (d3d->last_width != width || d3d->last_height != height)
{
D3DTexture_LockRectClear(d3d, d3d->tex, 0, d3dlr, NULL, D3DLOCK_NOSYSLOCK);
d3d_lockrectangle_clear(d3d, d3d->tex,
0, d3dlr, NULL, D3DLOCK_NOSYSLOCK);
}
D3DTexture_LockRect(d3d->tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);

View File

@ -42,8 +42,4 @@
#define RD3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil) D3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil, false)
#endif
#define D3DTexture_LockRectClear(pass, tex, level, lockedrect, rect, flags) \
D3DTexture_LockRect(tex, level, &lockedrect, rect, flags); \
memset(lockedrect.pBits, 0, pass->tex_h * lockedrect.Pitch)
#endif