Commit 7d31ab95 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Add support for VBOs to the drawing code.

parent a796b8a3
......@@ -5107,14 +5107,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexBufferImpl *SrcImpl = (IWineD3DVertexBufferImpl *) pVertexDecl;
WineDirect3DVertexStridedData strided;
HRESULT hr;
TRACE("(%p)->(%d,%d,%d,%p,%p,%ld\n", This, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags);
hr = IWineD3DDevice_SetFVF(iface, SrcImpl->fvf);
hr = IWineD3DDevice_SetStreamSource(iface, 0, pVertexDecl, get_flexible_vertex_size(SrcImpl->fvf) * SrcStartIndex, get_flexible_vertex_size(SrcImpl->fvf));
memset(&strided, 0, sizeof(strided));
primitiveConvertToStridedData(iface, &strided, 0);
primitiveConvertFVFtoOffset(SrcImpl->fvf, get_flexible_vertex_size(SrcImpl->fvf), SrcImpl->resource.allocatedMemory + get_flexible_vertex_size(SrcImpl->fvf) * SrcStartIndex, &strided, 0);
return process_vertices_strided(This, DestIndex, VertexCount, &strided, SrcImpl->fvf, (IWineD3DVertexBufferImpl *) pDestBuffer, Flags);
}
......
......@@ -152,8 +152,9 @@ const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
IWineD3DVertexBufferImpl_GetDesc
};
BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset) {
BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset, GLint *vbo) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
*vbo = 0;
return This->resource.allocatedMemory + iOffset;
}
......
......@@ -357,9 +357,21 @@ void drawPrimitive(IWineD3DDevice *iface,
int minIndex,
WineDirect3DVertexStridedData *DrawPrimStrideData);
void primitiveConvertToStridedData(IWineD3DDevice *iface,
WineDirect3DVertexStridedData *strided,
LONG BaseVertexIndex);
void primitiveConvertToStridedData(IWineD3DDevice *iface, WineDirect3DVertexStridedData *strided, LONG BaseVertexIndex, BOOL *fixup);
void primitiveDeclarationConvertToStridedData(
IWineD3DDevice *iface,
BOOL useVertexShaderFunction,
WineDirect3DVertexStridedData *strided,
LONG BaseVertexIndex,
DWORD *fvf,
BOOL *fixup);
void primitiveConvertFVFtoOffset(DWORD thisFVF,
DWORD stride,
BYTE *data,
WineDirect3DVertexStridedData *strided,
GLint streamVBO);
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType);
......@@ -615,10 +627,24 @@ typedef struct IWineD3DVertexBufferImpl
/* WineD3DVertexBuffer specifics */
DWORD fvf;
/* Vertex buffer object support */
GLuint vbo;
BYTE Flags;
UINT stream;
UINT dirtystart, dirtyend;
/* Last description of the buffer */
WineDirect3DVertexStridedData strided;
} IWineD3DVertexBufferImpl;
extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
#define VBFLAG_LOAD 0x01 /* Data is written from allocatedMemory to the VBO */
#define VBFLAG_OPTIMIZED 0x02 /* Optimize has been called for the VB */
#define VBFLAG_DIRTY 0x04 /* Buffer data has been modified */
#define VBFLAG_STREAM 0x08 /* The vertex buffer is in a stream */
#define VBFLAG_HASDESC 0x10 /* A vertex description has been found */
/*****************************************************************************
* IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
......@@ -1220,7 +1246,7 @@ void multiply_matrix(D3DMATRIX *dest, D3DMATRIX *src1, D3DMATRIX *src2);
extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
extern BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset);
extern BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset, GLint *vbo);
extern HRESULT WINAPI IWineD3DVertexBufferImpl_ReleaseMemory(IWineD3DVertexBuffer* iface);
extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
......
......@@ -898,6 +898,7 @@ typedef struct WineDirect3DStridedData {
BYTE *lpData; /* Pointer to start of data */
DWORD dwStride; /* Stride between occurances of this data */
DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
int VBO; /* Vertex buffer object this data is in */
} WineDirect3DStridedData;
typedef struct WineDirect3DVertexStridedData {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment