mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +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_AddressV(d3d->dev, 0, D3DTADDRESS_BORDER);
|
||||||
D3DDevice_SetSamplerState_MinFilter(d3d->dev, 0, D3DTEXF_LINEAR);
|
D3DDevice_SetSamplerState_MinFilter(d3d->dev, 0, D3DTEXF_LINEAR);
|
||||||
D3DDevice_SetSamplerState_MagFilter(d3d->dev, 0, D3DTEXF_LINEAR);
|
D3DDevice_SetSamplerState_MagFilter(d3d->dev, 0, D3DTEXF_LINEAR);
|
||||||
if (SUCCEEDED(d3d->dev->BeginScene()))
|
D3DDevice_DrawPrimitive(d3d->dev, D3DPT_TRIANGLESTRIP, 0, 2);
|
||||||
{
|
|
||||||
d3d->dev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
|
||||||
d3d->dev->EndScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
// restore previous state
|
// restore previous state
|
||||||
d3d->dev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
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_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_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_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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,16 +481,7 @@ void renderchain_set_mvp(void *data, CGprogram &vPrg,
|
|||||||
void renderchain_clear_texture(void *data, Pass &pass)
|
void renderchain_clear_texture(void *data, Pass &pass)
|
||||||
{
|
{
|
||||||
D3DLOCKED_RECT d3dlr;
|
D3DLOCKED_RECT d3dlr;
|
||||||
#ifdef _XBOX
|
D3DTexture_LockRectClear(pass, pass.tex, 0, d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderchain_convert_geometry(void *data, const LinkInfo *info,
|
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_luts(chain, pass);
|
||||||
renderchain_bind_tracker(chain, pass, pass_index);
|
renderchain_bind_tracker(chain, pass, pass_index);
|
||||||
|
|
||||||
#ifdef _XBOX
|
D3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
||||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
|
||||||
#else
|
|
||||||
if (SUCCEEDED(d3dr->BeginScene()))
|
|
||||||
{
|
|
||||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
|
||||||
d3dr->EndScene();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// So we don't render with linear filter into render targets,
|
// So we don't render with linear filter into render targets,
|
||||||
// which apparently looked odd (too blurry).
|
// 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;
|
vp.MaxZ = 1.0f;
|
||||||
d3dr->SetViewport(&vp);
|
d3dr->SetViewport(&vp);
|
||||||
}
|
}
|
||||||
d3dr->DrawPrimitive(D3DPT_QUADLIST, 0, 1);
|
D3DDevice_DrawPrimitive(d3dr, D3DPT_QUADLIST, 0, 1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -522,8 +522,7 @@ static void clear_texture(void *data)
|
|||||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
|
||||||
D3DLOCKED_RECT d3dlr;
|
D3DLOCKED_RECT d3dlr;
|
||||||
|
|
||||||
D3DTexture_LockRect(d3d->tex, 0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
D3DTexture_LockRectClear(d3d, d3d->tex, 0, d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||||
memset(d3dlr.pBits, 0, d3d->tex_w * d3dlr.Pitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blit_to_texture(void *data, const void *frame,
|
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));
|
D3DDevice_SetStreamSource_Inline(d3dr, 0, d3d->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _XBOX
|
D3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
|
||||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
|
||||||
#else
|
|
||||||
if (SUCCEEDED(d3dr->BeginScene()))
|
|
||||||
{
|
|
||||||
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
|
||||||
d3dr->EndScene();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_extern.frame_count++;
|
g_extern.frame_count++;
|
||||||
|
|
||||||
|
@ -98,4 +98,10 @@
|
|||||||
|
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user