Use d3d wrapper functions more

This commit is contained in:
twinaphex 2015-11-09 15:39:47 +01:00
parent 3a9ee7feae
commit 0bb7f30d6a
5 changed files with 18 additions and 20 deletions

View File

@ -1552,8 +1552,8 @@ static bool d3d_overlay_load(void *data,
return false;
}
if (SUCCEEDED(overlay->tex->LockRect(0, &d3dlr,
NULL, D3DLOCK_NOSYSLOCK)))
if (d3d_lockrectangle(overlay->tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
uint32_t *dst = (uint32_t*)(d3dlr.pBits);
const uint32_t *src = images[i].pixels;
@ -1561,7 +1561,7 @@ static bool d3d_overlay_load(void *data,
for (y = 0; y < height; y++, dst += pitch, src += width)
memcpy(dst, src, width << 2);
overlay->tex->UnlockRect(0);
d3d_unlock_rectangle(overlay->tex);
}
overlay->tex_w = width;
@ -1916,11 +1916,8 @@ static void d3d_set_menu_texture_frame(void *data,
d3d->menu->alpha_mod = alpha;
#ifdef _XBOX
d3d->menu->tex->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
#else
if (SUCCEEDED(d3d->menu->tex->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK)))
#endif
if (d3d_lock_rectangle(d3d->menu->tex, 0, &d3dlr,
NULL, 0, D3DLOCK_NOSYSLOCK))
{
unsigned h, w;
if (rgb32)
@ -1958,8 +1955,9 @@ static void d3d_set_menu_texture_frame(void *data,
}
}
if (d3d->menu)
d3d->menu->tex->UnlockRect(0);
d3d_unlock_rectangle(d3d->menu->tex);
}
}

View File

@ -299,7 +299,7 @@ void d3d_clear(LPDIRECT3DDEVICE dev,
#endif
}
void d3d_lockrectangle(LPDIRECT3DTEXTURE tex,
void d3d_lock_rectangle(LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags)
{
@ -313,14 +313,14 @@ void d3d_lockrectangle(LPDIRECT3DTEXTURE tex,
#endif
}
void d3d_unlockrectangle_clear(LPDIRECT3DTEXTURE tex)
void d3d_unlock_rectangle(LPDIRECT3DTEXTURE tex)
{
#ifndef _XBOX
tex->UnlockRect(0);
#endif
}
void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
void d3d_lock_rectangle_clear(LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags)
{
@ -328,7 +328,7 @@ void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
level = 0;
#endif
memset(lock_rect->pBits, level, rectangle_height * lock_rect->Pitch);
d3d_unlockrectangle_clear(tex);
d3d_unlock_rectangle(tex);
}
void d3d_set_viewport(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp)

View File

@ -72,15 +72,15 @@ void d3d_clear(LPDIRECT3DDEVICE dev,
unsigned count, const D3DRECT *rects, unsigned flags,
D3DCOLOR color, float z, unsigned stencil);
void d3d_lockrectangle(LPDIRECT3DTEXTURE tex,
void d3d_lock_rectangle(LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags);
void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
void d3d_lock_rectangle_clear(LPDIRECT3DTEXTURE tex,
unsigned level, D3DLOCKED_RECT *lock_rect, RECT *rect,
unsigned rectangle_height, unsigned flags);
void d3d_unlockrectangle_clear(LPDIRECT3DTEXTURE tex);
void d3d_unlock_rectangle(LPDIRECT3DTEXTURE tex);
void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
LPDIRECT3DTEXTURE tex);

View File

@ -1338,9 +1338,9 @@ static void renderchain_blit_to_texture(void *data,
if (first->last_width != width || first->last_height != height)
{
d3d_lockrectangle(first->tex, 0, &d3dlr,
d3d_lock_rectangle(first->tex, 0, &d3dlr,
NULL, first->info.tex_h, D3DLOCK_NOSYSLOCK);
d3d_lockrectangle_clear(first->tex, 0, &d3dlr,
d3d_lock_rectangle_clear(first->tex, 0, &d3dlr,
NULL, first->info.tex_h, D3DLOCK_NOSYSLOCK);
}

View File

@ -234,9 +234,9 @@ static void renderchain_blit_to_texture(void *data, const void *frame,
if (chain->last_width != width || chain->last_height != height)
{
d3d_lockrectangle(chain->tex,
d3d_lock_rectangle(chain->tex,
0, &d3dlr, NULL, chain->tex_h, D3DLOCK_NOSYSLOCK);
d3d_lockrectangle_clear(chain->tex,
d3d_lock_rectangle_clear(chain->tex,
0, &d3dlr, NULL, chain->tex_h, D3DLOCK_NOSYSLOCK);
}