Stefan Dösinger : wined3d: Remove the buffer fvf.
Alexandre Julliard
julliard at winehq.org
Thu Apr 9 11:13:51 CDT 2009
Module: wine
Branch: master
Commit: f0efa9741353b9a7871eab17508404ffafb5fb3c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f0efa9741353b9a7871eab17508404ffafb5fb3c
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Apr 6 14:16:59 2009 +0200
wined3d: Remove the buffer fvf.
---
dlls/d3d8/device.c | 7 +++++--
dlls/d3d9/device.c | 3 ++-
dlls/d3d9/vertexbuffer.c | 4 +++-
dlls/ddraw/vertexbuffer.c | 3 ++-
dlls/wined3d/buffer.c | 5 ++++-
dlls/wined3d/device.c | 11 +++++------
dlls/wined3d/wined3d_private.h | 3 ---
include/wine/wined3d.idl | 4 ++--
8 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 352018f..057d895 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -737,7 +737,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(LPDIRECT3DDEVICE8
object->lpVtbl = &Direct3DVertexBuffer8_Vtbl;
object->ref = 1;
EnterCriticalSection(&d3d8_cs);
- hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK, FVF, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer), NULL, (IUnknown *)object);
+ hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK,
+ 0 /* fvf for ddraw only */, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer), NULL,
+ (IUnknown *)object);
LeaveCriticalSection(&d3d8_cs);
object->fvf = FVF;
@@ -1662,10 +1664,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI
static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(LPDIRECT3DDEVICE8 iface, UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr;
+ IDirect3DVertexBuffer8Impl *dest = (IDirect3DVertexBuffer8Impl *) pDestBuffer;
TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d8_cs);
- hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, ((IDirect3DVertexBuffer8Impl *)pDestBuffer)->wineD3DVertexBuffer, NULL, Flags);
+ hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, dest->wineD3DVertexBuffer, NULL, Flags, dest->fvf);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 0d335fc..bfbfe97 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1449,10 +1449,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9EX
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DVertexDeclaration9Impl *Decl = (IDirect3DVertexDeclaration9Impl *) pVertexDecl;
HRESULT hr;
+ IDirect3DVertexBuffer9Impl *dest = (IDirect3DVertexBuffer9Impl *) pDestBuffer;
TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs);
- hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, ((IDirect3DVertexBuffer9Impl *)pDestBuffer)->wineD3DVertexBuffer, Decl ? Decl->wineD3DVertexDeclaration : NULL, Flags);
+ hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, dest->wineD3DVertexBuffer, Decl ? Decl->wineD3DVertexDeclaration : NULL, Flags, dest->fvf);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
diff --git a/dlls/d3d9/vertexbuffer.c b/dlls/d3d9/vertexbuffer.c
index d13ebef..71a9ca7 100644
--- a/dlls/d3d9/vertexbuffer.c
+++ b/dlls/d3d9/vertexbuffer.c
@@ -247,7 +247,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9EX iface
object->ref = 1;
object->fvf = FVF;
EnterCriticalSection(&d3d9_cs);
- hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK, FVF, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object);
+ hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK,
+ 0 /* fvf for ddraw only */, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer),
+ pSharedHandle, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (hrc != D3D_OK) {
diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index de94791..df7528b 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -384,7 +384,8 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface,
Count,
This->wineD3DVertexBuffer,
NULL /* Output vdecl */,
- Flags);
+ Flags,
+ This->fvf);
/* Restore the states if needed */
if(doClip != oldClip)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 1945474..0c53c23 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -317,11 +317,15 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
* processing, FLOAT4 POSITIONT with fixed function, and FLOAT16 if
* GL_NV_half_float is not supported.
*
+ * Note for d3d8 and d3d9:
* The vertex buffer FVF doesn't help with finding them, we have to use
* the decoded vertex declaration and pick the things that concern the
* current buffer. A problem with this is that this can change between
* draws, so we have to validate the information and reprocess the buffer
* if it changes, and avoid false positives for performance reasons.
+ * WineD3D doesn't even know the vertex buffer any more, it is managed
+ * by the client libraries and passed to SetStreamSource and ProcessVertices
+ * as needed.
*
* We have to distinguish between vertex shaders and fixed function to
* pick the way we access the strided vertex information.
@@ -938,7 +942,6 @@ static HRESULT STDMETHODCALLTYPE buffer_GetDesc(IWineD3DBuffer *iface, WINED3DBU
desc->Usage = This->resource.usage;
desc->Pool = This->resource.pool;
desc->Size = This->resource.size;
- desc->FVF = This->fvf;
return WINED3D_OK;
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d0fcf59..fc968db 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -552,8 +552,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
TRACE("(%p) : Size=%d, Usage=0x%08x, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object);
*ppVertexBuffer = (IWineD3DBuffer *)object;
- object->fvf = FVF;
-
/* Observations show that drawStridedSlow is faster on dynamic VBs than converting +
* drawStridedFast (half-life 2).
*
@@ -4506,11 +4504,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(
#define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount,
- const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD dwFlags)
+ const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD dwFlags,
+ DWORD DestFVF)
{
char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL;
unsigned int i;
- DWORD DestFVF = dest->fvf;
WINED3DVIEWPORT vp;
WINED3DMATRIX mat, proj_mat, view_mat, world_mat;
BOOL doClip;
@@ -4866,7 +4864,8 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
#undef copy_and_next
static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex,
- UINT VertexCount, IWineD3DBuffer *pDestBuffer, IWineD3DVertexDeclaration *pVertexDecl, DWORD Flags)
+ UINT VertexCount, IWineD3DBuffer *pDestBuffer, IWineD3DVertexDeclaration *pVertexDecl, DWORD Flags,
+ DWORD DestFVF)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_stream_info stream_info;
@@ -4912,7 +4911,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
}
return process_vertices_strided(This, DestIndex, VertexCount, &stream_info,
- (struct wined3d_buffer *)pDestBuffer, Flags);
+ (struct wined3d_buffer *)pDestBuffer, Flags, DestFVF);
}
/*****
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 59944a4..4076912 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2095,9 +2095,6 @@ struct wined3d_buffer
UINT dirty_end;
LONG lock_count;
- /* legacy vertex buffers */
- DWORD fvf;
-
/* conversion stuff */
UINT conversion_count;
UINT draw_count;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index b33b8ca..f6e5ef5 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -1869,7 +1869,6 @@ typedef struct _WINED3DBUFFER_DESC
DWORD Usage;
WINED3DPOOL Pool;
UINT Size;
- DWORD FVF;
} WINED3DBUFFER_DESC;
typedef struct glDescriptor
@@ -3349,7 +3348,8 @@ interface IWineD3DDevice : IWineD3DBase
[in] UINT vertex_count,
[in] IWineD3DBuffer *dest_buffer,
[in] IWineD3DVertexDeclaration *declaration,
- [in] DWORD flags
+ [in] DWORD flags,
+ [in] DWORD DestFVF
);
HRESULT BeginStateBlock(
);
More information about the wine-cvs
mailing list