Commit 4adb3423 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove GetFVF() and SetFVF() from IWineD3DDevice.

parent 0c9b2c32
......@@ -1702,8 +1702,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa
TRACE("(%p) : Relay\n", This);
EnterCriticalSection(&d3d8_cs);
if (VS_HIGHESTFIXEDFXF >= pShader) {
TRACE("Setting FVF, %d %d\n", VS_HIGHESTFIXEDFXF, pShader);
IWineD3DDevice_SetFVF(This->WineD3DDevice, pShader);
TRACE("Setting FVF, %#x\n", pShader);
IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration);
IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL);
......
......@@ -1314,7 +1314,6 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO
return hr;
}
}
hr = IWineD3DDevice_SetFVF(This->WineD3DDevice, FVF);
LeaveCriticalSection(&d3d9_cs);
return hr;
......@@ -1322,12 +1321,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO
static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DVertexDeclaration9 *decl;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_GetFVF(This->WineD3DDevice, pFVF);
LeaveCriticalSection(&d3d9_cs);
hr = IDirect3DDevice9_GetVertexDeclaration(iface, &decl);
if (FAILED(hr))
{
WARN("Failed to get vertex declaration, %#x\n", hr);
*pFVF = 0;
return hr;
}
*pFVF = ((IDirect3DVertexDeclaration9Impl *)decl)->convFVF;
TRACE("Returning FVF %#x\n", *pFVF);
return hr;
}
......
......@@ -279,11 +279,8 @@ static HRESULT test_fvf_to_decl(
return E_FAIL;
}
static HRESULT test_decl_to_fvf(
IDirect3DDevice9* device,
DWORD default_fvf,
CONST D3DVERTEXELEMENT9 test_decl[],
DWORD test_fvf)
static HRESULT test_decl_to_fvf(IDirect3DDevice9* device, DWORD default_fvf,
const D3DVERTEXELEMENT9 test_decl[], DWORD test_fvf, BOOL todo)
{
HRESULT hr;
......@@ -310,9 +307,8 @@ static HRESULT test_decl_to_fvf(
hr = IDirect3DDevice9_GetFVF( device, &result_fvf);
ok(SUCCEEDED(hr), "GetFVF returned %#x, expected %#x\n", hr, D3D_OK);
if (FAILED(hr)) goto fail;
todo_wine {
ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf);
}
if (todo) todo_wine ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf);
else ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf);
if (test_fvf != result_fvf) goto fail;
IDirect3DDevice9_SetVertexDeclaration ( device, NULL );
......@@ -348,64 +344,64 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZ));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZ, TRUE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_POSITIONT, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZRHW));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZRHW, TRUE));
}
for (i = 0; i < 4; i++) {
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT1+i, 0, D3DDECLUSAGE_BLENDWEIGHT, 0}, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_UBYTE4, 0, D3DDECLUSAGE_BLENDINDICES, 0}, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_NORMAL, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_PSIZE, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 1 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
/* Make sure textures of different sizes work */
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
/* Make sure the TEXCOORD index works correctly - try several textures */
......@@ -415,25 +411,25 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
{ 0, 4, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_TEXCOORD, 1 },
{ 0, 16, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 2 },
{ 0, 24, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 3 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
/* No FVF mapping available */
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 1 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
{
CONST D3DVERTEXELEMENT9 test_buffer[] =
{ { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_NORMAL, 1 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
/* Try empty declaration */
{
CONST D3DVERTEXELEMENT9 test_buffer[] = { D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
/* Now try a combination test */
......@@ -445,7 +441,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
{ 0, 28, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 1 },
{ 0, 32, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_TEXCOORD, 0 },
{ 0, 44, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 1 }, D3DDECL_END() };
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
}
/* Test conversions from FVF to a vertex declaration
......
......@@ -2538,36 +2538,6 @@ static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *ifa
return (This->adapter->TextureRam - This->adapter->UsedTextureRam);
}
/*****
* Get / Set FVF
*****/
static HRESULT WINAPI IWineD3DDeviceImpl_SetFVF(IWineD3DDevice *iface, DWORD fvf) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* Update the current state block */
This->updateStateBlock->changed.fvf = TRUE;
if(This->updateStateBlock->fvf == fvf) {
TRACE("Application is setting the old fvf over, nothing to do\n");
return WINED3D_OK;
}
This->updateStateBlock->fvf = fvf;
TRACE("(%p) : FVF Shader FVF set to %x\n", This, fvf);
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DDeviceImpl_GetFVF(IWineD3DDevice *iface, DWORD *pfvf) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : GetFVF returning %x\n", This, This->stateBlock->fvf);
*pfvf = This->stateBlock->fvf;
return WINED3D_OK;
}
/*****
* Get / Set Stream Source
*****/
......@@ -7542,8 +7512,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_GetCurrentTexturePalette,
IWineD3DDeviceImpl_SetDepthStencilSurface,
IWineD3DDeviceImpl_GetDepthStencilSurface,
IWineD3DDeviceImpl_SetFVF,
IWineD3DDeviceImpl_GetFVF,
IWineD3DDeviceImpl_SetGammaRamp,
IWineD3DDeviceImpl_GetGammaRamp,
IWineD3DDeviceImpl_SetIndices,
......@@ -7687,8 +7655,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_DirtyConst_Vtbl =
IWineD3DDeviceImpl_GetCurrentTexturePalette,
IWineD3DDeviceImpl_SetDepthStencilSurface,
IWineD3DDeviceImpl_GetDepthStencilSurface,
IWineD3DDeviceImpl_SetFVF,
IWineD3DDeviceImpl_GetFVF,
IWineD3DDeviceImpl_SetGammaRamp,
IWineD3DDeviceImpl_GetGammaRamp,
IWineD3DDeviceImpl_SetIndices,
......
......@@ -82,7 +82,6 @@ static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES *
/* Single values */
dest->indices = source->indices;
dest->material = source->material;
dest->fvf = source->fvf;
dest->viewport = source->viewport;
dest->vertexDecl = source->vertexDecl;
dest->pixelShader = source->pixelShader;
......@@ -120,7 +119,6 @@ void stateblock_savedstates_set(
/* Single values */
states->indices = value;
states->material = value;
states->fvf = value;
states->viewport = value;
states->vertexDecl = value;
states->pixelShader = value;
......@@ -167,7 +165,6 @@ void stateblock_copy(
stateblock_savedstates_copy(source, &Dest->changed, &This->changed);
/* Single items */
Dest->fvf = This->fvf;
Dest->vertexDecl = This->vertexDecl;
Dest->vertexShader = This->vertexShader;
Dest->streamIsUP = This->streamIsUP;
......@@ -504,10 +501,6 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This->vertexDecl = targetStateBlock->vertexDecl;
}
if(This->changed.fvf && This->fvf != targetStateBlock->fvf){
This->fvf = targetStateBlock->fvf;
}
if (This->changed.material && memcmp(&targetStateBlock->material,
&This->material,
sizeof(WINED3DMATERIAL)) != 0) {
......@@ -810,10 +803,6 @@ should really perform a delta so that only the changes get updated*/
IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
}
if (This->changed.fvf) {
IWineD3DDevice_SetFVF(pDevice, This->fvf);
}
if (This->changed.vertexDecl) {
IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
}
......@@ -986,7 +975,6 @@ should really perform a delta so that only the changes get updated*/
}
IWineD3DDevice_SetIndices(pDevice, This->pIndexData);
IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
IWineD3DDevice_SetFVF(pDevice, This->fvf);
IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
IWineD3DDevice_SetMaterial(pDevice, &This->material);
IWineD3DDevice_SetViewport(pDevice, &This->viewport);
......
......@@ -1737,7 +1737,6 @@ extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
typedef struct SAVEDSTATES {
BOOL indices;
BOOL material;
BOOL fvf;
BOOL streamSource[MAX_STREAMS];
BOOL streamFreq[MAX_STREAMS];
BOOL textures[MAX_COMBINED_SAMPLERS];
......@@ -1786,8 +1785,6 @@ struct IWineD3DStateBlockImpl
struct list set_vconstantsF;
struct list set_pconstantsF;
/* Drawing - Vertex Shader or FVF related */
DWORD fvf;
/* Vertex Shader Declaration */
IWineD3DVertexDeclaration *vertexDecl;
......
......@@ -3070,12 +3070,6 @@ interface IWineD3DDevice : IWineD3DBase
HRESULT GetDepthStencilSurface(
[out] IWineD3DSurface **depth_stencil
);
HRESULT SetFVF(
[in] DWORD fvf
);
HRESULT GetFVF(
[out] DWORD *fvf
);
void SetGammaRamp(
[in] UINT swapchain_idx,
[in] DWORD flags,
......
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