Add size_t argument to d3d_vertex_buffer_lock

This commit is contained in:
twinaphex 2015-11-17 23:32:32 +01:00
parent f028273dec
commit 4f54dbe9d9
6 changed files with 7 additions and 10 deletions

View File

@ -1032,7 +1032,7 @@ static bool texture_image_render(d3d_video_t *d3d,
};
/* Load the existing vertices */
verts = d3d_vertex_buffer_lock(d3dv);
verts = d3d_vertex_buffer_lock(d3dv, sizeof(newVerts));
if (!verts)
return false;
@ -1242,7 +1242,7 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
vert[i][1] += 0.5f;
}
overlay->vert_buf->Lock(0, sizeof(vert), &verts, 0);
d3d_vertex_buffer_lock(overlay->vert_buf, sizeof(vert));
memcpy(verts, vert, sizeof(vert));
d3d_vertex_buffer_unlock(overlay->vert_buf);

View File

@ -70,9 +70,7 @@ typedef struct
bool enabled;
float alpha_mod;
LPDIRECT3DTEXTURE tex;
#ifdef HAVE_D3D9
LPDIRECT3DVERTEXBUFFER vert_buf;
#endif
} overlay_t;
#ifdef _XBOX

View File

@ -176,16 +176,15 @@ void d3d_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER vertbuf)
#endif
}
void *d3d_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER vertbuf)
void *d3d_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER vertbuf, size_t len)
{
void *buf;
#if defined(_XBOX1)
buf = (void*)D3DVertexBuffer_Lock2(vertbuf, 0);
#elif defined(_XBOX360)
buf = D3DVertexBuffer_Lock(vertbuf, 0, 0, 0);
#else
vertbuf->Lock(0, sizeof(buf), &buf, 0);
vertbuf->Lock(0, len, &buf, 0);
#endif
if (!buf)

View File

@ -32,7 +32,7 @@ LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
unsigned length, unsigned usage, unsigned fvf,
D3DPOOL pool, void *handle);
void *d3d_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER vertbuf);
void *d3d_vertex_buffer_lock(LPDIRECT3DVERTEXBUFFER vertbuf, size_t len);
void d3d_vertex_buffer_unlock(LPDIRECT3DVERTEXBUFFER vertbuf);
void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration);

View File

@ -1280,7 +1280,7 @@ static void renderchain_set_vertices(
vert[i].y += 0.5f;
}
verts = d3d_vertex_buffer_lock(pass->vertex_buf);
verts = d3d_vertex_buffer_lock(pass->vertex_buf, sizeof(vert));
memcpy(verts, vert, sizeof(vert));
d3d_vertex_buffer_unlock(pass->vertex_buf);
}

View File

@ -202,7 +202,7 @@ static void renderchain_set_vertices(void *data, unsigned pass,
vert[i].y += 0.5f / ((float)chain->tex_h);
}
verts = d3d_vertex_buffer_lock(chain->vertex_buf);
verts = d3d_vertex_buffer_lock(chain->vertex_buf, sizeof(vert));
memcpy(verts, vert, sizeof(vert));
d3d_vertex_buffer_unlock(chain->vertex_buf);
}