(D3D) Create d3d_vertex_buffer_unlock

This commit is contained in:
twinaphex 2014-09-13 19:56:52 +02:00
parent 548c04bd1b
commit 22dd54e1f5
6 changed files with 19 additions and 9 deletions

View File

@ -1024,7 +1024,7 @@ static bool texture_image_render(void *data,
/* copy the new verts over the old verts */
memcpy(verts, newVerts, sizeof(newVerts));
out_img->vertex_buf->Unlock();
d3d_vertex_buffer_unlock(out_img->vertex_buf);
d3d->dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3d->dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
@ -1284,7 +1284,7 @@ static void d3d_overlay_render(void *data, overlay_t *overlay)
overlay->vert_buf->Lock(0, sizeof(vert), &verts, 0);
memcpy(verts, vert, sizeof(vert));
overlay->vert_buf->Unlock();
d3d_vertex_buffer_unlock(overlay->vert_buf);
// enable alpha
d3d->dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

View File

@ -104,6 +104,20 @@ LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
return buf;
}
void d3d_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER vertbuf)
{
/* This is a stub on Xbox 1, see docs. */
#ifndef _XBOX1
#ifdef _XBOX360
D3DVertexBuffer_Unlock(vertbuf);
#else
vertbuf->Unlock();
#endif
#endif
}
void *d3d_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER vertbuf)
{
#ifdef _XBOX1

View File

@ -27,6 +27,7 @@ LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
D3DPOOL pool, void *handle);
void *d3d_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER vertbuf);
void d3d_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER vertbuf);
void d3d_vertex_buffer_free(LPDIRECT3DVERTEXBUFFER buf);

View File

@ -457,7 +457,7 @@ void renderchain_set_vertices(void *data, Pass *pass,
void *verts = d3d_vertex_buffer_lock(pass->vertex_buf);
memcpy(verts, vert, sizeof(vert));
pass->vertex_buf->Unlock();
d3d_vertex_buffer_unlock(pass->vertex_buf);
}
renderchain_set_mvp(chain, pass->vPrg, vp_width, vp_height, rotation);

View File

@ -206,7 +206,7 @@ static void renderchain_set_vertices(void *data, unsigned pass, unsigned width,
void *verts = d3d_vertex_buffer_lock(d3d->vertex_buf);
memcpy(verts, vert, sizeof(vert));
RD3DVertexBuffer_Unlock(d3d->vertex_buf);
d3d_vertex_buffer_unlock(d3d->vertex_buf);
}
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)

View File

@ -23,16 +23,11 @@
#define RD3DDevice_SetTransform(device, State, pMatrix) D3DDevice_SetTransform(State, pMatrix)
#define RD3DVertexBuffer_Lock(device, OffsetToLock, SizeToLock, ppbData, Flags) *ppbData = D3DVertexBuffer_Lock2(device, Flags) + OffsetToLock
#define RD3DVertexBuffer_Unlock(device)
#define RD3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil) D3DDevice_Clear(Count, pRects, Flags, Color, Z, Stencil)
#elif defined(_XBOX360)
/* XBox 360*/
#define RD3DVertexBuffer_Lock(device, OffsetToLock, SizeToLock, ppbData, Flags) *ppbData = D3DVertexBuffer_Lock(device, OffsetToLock, SizeToLock, Flags)
#define RD3DVertexBuffer_Unlock(device) D3DVertexBuffer_Unlock(device)
#define RD3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil) D3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil, false)
#endif