mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
(D3D) D3DTexture LockRect clear - turned into macro for
both PC D3D and XDK D3D
This commit is contained in:
parent
346a341cf8
commit
5d8e4cb358
@ -622,11 +622,7 @@ static void d3d_overlay_render(void *data, overlay_t *overlay)
|
||||
D3DDevice_SetSamplerState_AddressV(d3d->dev, 0, D3DTADDRESS_BORDER);
|
||||
D3DDevice_SetSamplerState_MinFilter(d3d->dev, 0, D3DTEXF_LINEAR);
|
||||
D3DDevice_SetSamplerState_MagFilter(d3d->dev, 0, D3DTEXF_LINEAR);
|
||||
if (SUCCEEDED(d3d->dev->BeginScene()))
|
||||
{
|
||||
d3d->dev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
d3d->dev->EndScene();
|
||||
}
|
||||
D3DDevice_DrawPrimitive(d3d->dev, D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
||||
// restore previous state
|
||||
d3d->dev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
|
@ -58,6 +58,18 @@ class RenderChain;
|
||||
#define D3DDevice_SetSamplerState_AddressV(dev, sampler, type) dev->SetSamplerState(sampler, D3DSAMP_ADDRESSV, type)
|
||||
#define D3DDevice_SetSamplerState_MinFilter(dev, sampler, type) dev->SetSamplerState(sampler, D3DSAMP_MINFILTER, type)
|
||||
#define D3DDevice_SetSamplerState_MagFilter(dev, sampler, type) dev->SetSamplerState(sampler, D3DSAMP_MAGFILTER, type)
|
||||
#define D3DDevice_DrawPrimitive(dev, type, start, count) \
|
||||
if (SUCCEEDED(dev->BeginScene())) \
|
||||
{ \
|
||||
dev->DrawPrimitive(type, start, count); \
|
||||
dev->EndScene(); \
|
||||
}
|
||||
#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); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -481,16 +481,7 @@ void renderchain_set_mvp(void *data, CGprogram &vPrg,
|
||||
void renderchain_clear_texture(void *data, Pass &pass)
|
||||
{
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
#ifdef _XBOX
|
||||
D3DTexture_LockRect(pass.tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
memset(d3dlr.pBits, 0, pass.info.tex_h * d3dlr.Pitch);
|
||||
#else
|
||||
if (SUCCEEDED(pass.tex->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK)))
|
||||
{
|
||||
memset(d3dlr.pBits, 0, pass.info.tex_h * d3dlr.Pitch);
|
||||
pass.tex->UnlockRect(0);
|
||||
}
|
||||
#endif
|
||||
D3DTexture_LockRectClear(pass, pass.tex, 0, d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
}
|
||||
|
||||
void renderchain_convert_geometry(void *data, const LinkInfo *info,
|
||||
@ -596,15 +587,7 @@ void renderchain_render_pass(void *data, Pass &pass, unsigned pass_index)
|
||||
renderchain_bind_luts(chain, pass);
|
||||
renderchain_bind_tracker(chain, pass, pass_index);
|
||||
|
||||
#ifdef _XBOX
|
||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
#else
|
||||
if (SUCCEEDED(d3dr->BeginScene()))
|
||||
{
|
||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
d3dr->EndScene();
|
||||
}
|
||||
#endif
|
||||
D3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
||||
// So we don't render with linear filter into render targets,
|
||||
// which apparently looked odd (too blurry).
|
||||
|
@ -488,7 +488,7 @@ static bool texture_image_render(void *data, struct texture_image *out_img,
|
||||
vp.MaxZ = 1.0f;
|
||||
d3dr->SetViewport(&vp);
|
||||
}
|
||||
d3dr->DrawPrimitive(D3DPT_QUADLIST, 0, 1);
|
||||
D3DDevice_DrawPrimitive(d3dr, D3DPT_QUADLIST, 0, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -522,8 +522,7 @@ static void clear_texture(void *data)
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
|
||||
D3DTexture_LockRect(d3d->tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
memset(d3dlr.pBits, 0, d3d->tex_w * d3dlr.Pitch);
|
||||
D3DTexture_LockRectClear(d3d, d3d->tex, 0, d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
}
|
||||
|
||||
static void blit_to_texture(void *data, const void *frame,
|
||||
@ -681,15 +680,7 @@ static void render_pass(void *data, const void *frame, unsigned width, unsigned
|
||||
D3DDevice_SetStreamSource_Inline(d3dr, 0, d3d->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX
|
||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
#else
|
||||
if (SUCCEEDED(d3dr->BeginScene()))
|
||||
{
|
||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
d3dr->EndScene();
|
||||
}
|
||||
#endif
|
||||
D3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
||||
g_extern.frame_count++;
|
||||
|
||||
|
@ -98,4 +98,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define D3DTexture_LockRectClear(pass, tex, level, lockedrect, rect, flags) \
|
||||
D3DTexture_LockRect(tex, level, &lockedrect, rect, flags); \
|
||||
memset(lockedrect.pBits, 0, pass->tex_w * lockedrect.Pitch)
|
||||
|
||||
#define D3DDevice_DrawPrimitive(dev, type, start, count) dev->DrawPrimitive(type, start, count)
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user