From 4c385f981d6e82763a193a39623d12aa79b76613 Mon Sep 17 00:00:00 2001 From: Raphael Junqueira Date: Wed, 26 Jan 2005 20:54:00 +0000 Subject: [PATCH] - VertexDeclaration device APIs - D3D9 declarations parsing - a little better APIs (trying to avoid compile problems) --- dlls/wined3d/device.c | 58 +++ dlls/wined3d/vertexdeclaration.c | 609 ++++++++++++++++++++++++++++++- dlls/wined3d/wined3d_private.h | 1 + include/wine/wined3d_interface.h | 155 ++++---- 4 files changed, 741 insertions(+), 82 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 5305485fd1e..2c754efd18b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3535,6 +3535,60 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, return D3D_OK; } +/***** + * Vertex Declaration + *****/ +extern HRESULT IWineD3DVertexDeclarationImpl_ParseDeclaration8(IWineD3DDeviceImpl* This, const DWORD* pDecl, IWineD3DVertexDeclarationImpl* object); +extern HRESULT IWineD3DVertexDeclarationImpl_ParseDeclaration9(IWineD3DDeviceImpl* This, const D3DVERTEXELEMENT9* pDecl, IWineD3DVertexDeclarationImpl* object); + +HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice* iface, UINT iDeclVersion, CONST VOID* pDeclaration, IWineD3DVertexDeclaration** ppDecl) { + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + IWineD3DVertexDeclarationImpl* object = NULL; + HRESULT hr = D3D_OK; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DVertexDeclarationImpl)); + + object->lpVtbl = &IWineD3DVertexDeclaration_Vtbl; + object->wineD3DDevice = This; + object->ref = 1; + object->allFVF = 0; + + *ppDecl = (IWineD3DVertexDeclaration*) object; + + if (8 == iDeclVersion) { + /** @TODO */ + hr = IWineD3DVertexDeclarationImpl_ParseDeclaration8(This, (const DWORD*) pDeclaration, object); + } else { + hr = IWineD3DVertexDeclarationImpl_ParseDeclaration9(This, (const D3DVERTEXELEMENT9*) pDeclaration, object); + } + + return hr; +} + +HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice* iface, IWineD3DVertexDeclaration* pDecl) { + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; + + TRACE("(%p) : pDecl=%p\n", This, pDecl); + + IWineD3DVertexDeclaration_AddRef(pDecl); + if (NULL != This->updateStateBlock->vertexDecl) { + IWineD3DVertexDeclaration_Release(This->updateStateBlock->vertexDecl); + } + This->updateStateBlock->vertexDecl = pDecl; + This->updateStateBlock->changed.vertexDecl = TRUE; + This->updateStateBlock->set.vertexDecl = TRUE; + return D3D_OK; +} +HRESULT WINAPI IWineD3DDeviceImpl_GetVertexDeclaration(IWineD3DDevice* iface, IWineD3DVertexDeclaration** ppDecl) { + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + + TRACE("(%p) : pDecl=%p\n", This, ppDecl); + + *ppDecl = This->updateStateBlock->vertexDecl; + if (NULL != *ppDecl) IWineD3DVertexDeclaration_AddRef(*ppDecl); + return D3D_OK; +} + /********************************************************** * IUnknown parts follows **********************************************************/ @@ -3628,5 +3682,9 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_DrawPrimitiveUP, IWineD3DDeviceImpl_DrawIndexedPrimitiveUP, + IWineD3DDeviceImpl_CreateVertexDeclaration, + IWineD3DDeviceImpl_SetVertexDeclaration, + IWineD3DDeviceImpl_GetVertexDeclaration, + IWineD3DDeviceImpl_SetupTextureStates }; diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index 042e2985fb5..d2125b243e7 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -58,9 +58,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_decl); */ /** Vertex Shader Declaration 8 data types tokens */ -#if 0 #define MAX_VSHADER_DECL_TYPES 8 -static CONST char* VertexShader8_DeclDataTypes[] = { + +static CONST char* VertexDecl8_DataTypes[] = { "D3DVSDT_FLOAT1", "D3DVSDT_FLOAT2", "D3DVSDT_FLOAT3", @@ -71,7 +71,598 @@ static CONST char* VertexShader8_DeclDataTypes[] = { "D3DVSDT_SHORT4", NULL }; + +static CONST char* VertexDecl8_Registers[] = { + "D3DVSDE_POSITION", + "D3DVSDE_BLENDWEIGHT", + "D3DVSDE_BLENDINDICES", + "D3DVSDE_NORMAL", + "D3DVSDE_PSIZE", + "D3DVSDE_DIFFUSE", + "D3DVSDE_SPECULAR", + "D3DVSDE_TEXCOORD0", + "D3DVSDE_TEXCOORD1", + "D3DVSDE_TEXCOORD2", + "D3DVSDE_TEXCOORD3", + "D3DVSDE_TEXCOORD4", + "D3DVSDE_TEXCOORD5", + "D3DVSDE_TEXCOORD6", + "D3DVSDE_TEXCOORD7", + "D3DVSDE_POSITION2", + "D3DVSDE_NORMAL2", + NULL +}; + +typedef enum _D3DVSD_TOKENTYPE { + D3DVSD_TOKEN_NOP = 0, + D3DVSD_TOKEN_STREAM = 1, + D3DVSD_TOKEN_STREAMDATA = 2, + D3DVSD_TOKEN_TESSELLATOR = 3, + D3DVSD_TOKEN_CONSTMEM = 4, + D3DVSD_TOKEN_EXT = 5, + /* RESERVED = 6 */ + D3DVSD_TOKEN_END = 7, + D3DVSD_FORCE_DWORD = 0x7FFFFFFF +} D3DVSD_TOKENTYPE; + +typedef enum _D3DVSDE_REGISTER { + D3DVSDE_POSITION = 0, + D3DVSDE_BLENDWEIGHT = 1, + D3DVSDE_BLENDINDICES = 2, + D3DVSDE_NORMAL = 3, + D3DVSDE_PSIZE = 4, + D3DVSDE_DIFFUSE = 5, + D3DVSDE_SPECULAR = 6, + D3DVSDE_TEXCOORD0 = 7, + D3DVSDE_TEXCOORD1 = 8, + D3DVSDE_TEXCOORD2 = 9, + D3DVSDE_TEXCOORD3 = 10, + D3DVSDE_TEXCOORD4 = 11, + D3DVSDE_TEXCOORD5 = 12, + D3DVSDE_TEXCOORD6 = 13, + D3DVSDE_TEXCOORD7 = 14, + D3DVSDE_POSITION2 = 15, + D3DVSDE_NORMAL2 = 16 +} D3DVSDE_REGISTER; + +typedef enum _D3DVSDT_TYPE { + D3DVSDT_FLOAT1 = 0x00, + D3DVSDT_FLOAT2 = 0x01, + D3DVSDT_FLOAT3 = 0x02, + D3DVSDT_FLOAT4 = 0x03, + D3DVSDT_D3DCOLOR = 0x04, + D3DVSDT_UBYTE4 = 0x05, + D3DVSDT_SHORT2 = 0x06, + D3DVSDT_SHORT4 = 0x07 +} D3DVSDT_TYPE; + + +#define D3DVSD_CONSTADDRESSSHIFT 0 +#define D3DVSD_EXTINFOSHIFT 0 +#define D3DVSD_STREAMNUMBERSHIFT 0 +#define D3DVSD_VERTEXREGSHIFT 0 +#define D3DVSD_CONSTRSSHIFT 16 +#define D3DVSD_DATATYPESHIFT 16 +#define D3DVSD_SKIPCOUNTSHIFT 16 +#define D3DVSD_VERTEXREGINSHIFT 20 +#define D3DVSD_EXTCOUNTSHIFT 24 +#define D3DVSD_CONSTCOUNTSHIFT 25 +#define D3DVSD_DATALOADTYPESHIFT 28 +#define D3DVSD_STREAMTESSSHIFT 28 +#define D3DVSD_TOKENTYPESHIFT 29 + +#define D3DVSD_CONSTADDRESSMASK (0x7F << D3DVSD_CONSTADDRESSSHIFT) +#define D3DVSD_EXTINFOMASK (0xFFFFFF << D3DVSD_EXTINFOSHIFT) +#define D3DVSD_STREAMNUMBERMASK (0xF << D3DVSD_STREAMNUMBERSHIFT) +#define D3DVSD_VERTEXREGMASK (0x1F << D3DVSD_VERTEXREGSHIFT) +#define D3DVSD_CONSTRSMASK (0x1FFF << D3DVSD_CONSTRSSHIFT) +#define D3DVSD_DATATYPEMASK (0xF << D3DVSD_DATATYPESHIFT) +#define D3DVSD_SKIPCOUNTMASK (0xF << D3DVSD_SKIPCOUNTSHIFT) +#define D3DVSD_EXTCOUNTMASK (0x1F << D3DVSD_EXTCOUNTSHIFT) +#define D3DVSD_VERTEXREGINMASK (0xF << D3DVSD_VERTEXREGINSHIFT) +#define D3DVSD_CONSTCOUNTMASK (0xF << D3DVSD_CONSTCOUNTSHIFT) +#define D3DVSD_DATALOADTYPEMASK (0x1 << D3DVSD_DATALOADTYPESHIFT) +#define D3DVSD_STREAMTESSMASK (0x1 << D3DVSD_STREAMTESSSHIFT) +#define D3DVSD_TOKENTYPEMASK (0x7 << D3DVSD_TOKENTYPESHIFT) + +#define D3DVSD_END() 0xFFFFFFFF +#define D3DVSD_NOP() 0x00000000 + +DWORD IWineD3DVertexDeclarationImpl_ParseToken8(const DWORD* pToken) { + const DWORD token = *pToken; + DWORD tokenlen = 1; + + switch ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT) { /* maybe a macro to inverse ... */ + case D3DVSD_TOKEN_NOP: + TRACE(" 0x%08lx NOP()\n", token); + break; + case D3DVSD_TOKEN_STREAM: + if (token & D3DVSD_STREAMTESSMASK) { + TRACE(" 0x%08lx STREAM_TESS()\n", token); + } else { + TRACE(" 0x%08lx STREAM(%lu)\n", token, ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT)); + } + break; + case D3DVSD_TOKEN_STREAMDATA: + if (token & 0x10000000) { + TRACE(" 0x%08lx SKIP(%lu)\n", token, ((token & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT)); + } else { + DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT); + DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT); + TRACE(" 0x%08lx REG(%s, %s)\n", token, VertexDecl8_Registers[reg], VertexDecl8_DataTypes[type]); + } + break; + case D3DVSD_TOKEN_TESSELLATOR: + if (token & 0x10000000) { + DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT); + DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT); + TRACE(" 0x%08lx TESSUV(%s) as %s\n", token, VertexDecl8_Registers[reg], VertexDecl8_DataTypes[type]); + } else { + DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT); + DWORD regout = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT); + DWORD regin = ((token & D3DVSD_VERTEXREGINMASK) >> D3DVSD_VERTEXREGINSHIFT); + TRACE(" 0x%08lx TESSNORMAL(%s, %s) as %s\n", token, VertexDecl8_Registers[regin], VertexDecl8_Registers[regout], VertexDecl8_DataTypes[type]); + } + break; + case D3DVSD_TOKEN_CONSTMEM: + { + DWORD i; + DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT); + DWORD constaddress = ((token & D3DVSD_CONSTADDRESSMASK) >> D3DVSD_CONSTADDRESSSHIFT); + TRACE(" 0x%08lx CONST(%lu, %lu)\n", token, constaddress, count); + ++pToken; + for (i = 0; i < count; ++i) { +#if 0 + TRACE(" c[%lu] = (0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx)\n", + constaddress, + *pToken, + *(pToken + 1), + *(pToken + 2), + *(pToken + 3)); #endif + TRACE(" c[%lu] = (%8f, %8f, %8f, %8f)\n", + constaddress, + *(const float*) pToken, + *(const float*) (pToken + 1), + *(const float*) (pToken + 2), + *(const float*) (pToken + 3)); + pToken += 4; + ++constaddress; + } + tokenlen = (4 * count) + 1; + } + break; + case D3DVSD_TOKEN_EXT: + { + DWORD count = ((token & D3DVSD_CONSTCOUNTMASK) >> D3DVSD_CONSTCOUNTSHIFT); + DWORD extinfo = ((token & D3DVSD_EXTINFOMASK) >> D3DVSD_EXTINFOSHIFT); + TRACE(" 0x%08lx EXT(%lu, %lu)\n", token, count, extinfo); + /* todo ... print extension */ + tokenlen = count + 1; + } + break; + case D3DVSD_TOKEN_END: + TRACE(" 0x%08lx END()\n", token); + break; + default: + TRACE(" 0x%08lx UNKNOWN\n", token); + /* argg error */ + } + return tokenlen; +} + +HRESULT IWineD3DVertexDeclarationImpl_ParseDeclaration8(IWineD3DDeviceImpl* This, const DWORD* pDecl, IWineD3DVertexDeclarationImpl* object) { + const DWORD* pToken = pDecl; + DWORD fvf = 0; + BOOL invalid_fvf = FALSE; + DWORD tex = D3DFVF_TEX0; + DWORD len = 0; + DWORD stream = 0; + DWORD token; + DWORD tokenlen; + DWORD tokentype; + + TRACE("(%p) : pDecl(%p)\n", This, pDecl); + + while (D3DVSD_END() != *pToken) { + token = *pToken; + tokenlen = IWineD3DVertexDeclarationImpl_ParseToken8(pToken); + tokentype = ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT); + + /** FVF generation block */ + if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) { + /** + * how really works streams, + * in DolphinVS dx8 dsk sample they seems to decal reg numbers !!! + */ + DWORD oldStream = stream; + stream = ((token & D3DVSD_STREAMNUMBERMASK) >> D3DVSD_STREAMNUMBERSHIFT); + + /* copy fvf if valid */ + if (FALSE == invalid_fvf) { + fvf |= tex << D3DFVF_TEXCOUNT_SHIFT; + tex = 0; + object->fvf[oldStream] = fvf; + object->allFVF |= fvf; + } else { + object->fvf[oldStream] = 0; + tex = 0; + } + + /* reset valid/invalid fvf */ + fvf = 0; + invalid_fvf = FALSE; + + } else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0 == (0x10000000 & tokentype)) { + DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT); + DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT); + + switch (reg) { + case D3DVSDE_POSITION: + switch (type) { + case D3DVSDT_FLOAT3: fvf |= D3DFVF_XYZ; break; + case D3DVSDT_FLOAT4: fvf |= D3DFVF_XYZRHW; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + if (type >= MAX_VSHADER_DECL_TYPES) { + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_POSITION register: unsupported and unrecognized type %08lx\n", type); + } else { + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_POSITION register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + } + break; + + case D3DVSDE_BLENDWEIGHT: + switch (type) { + case D3DVSDT_FLOAT1: fvf |= D3DFVF_XYZB1; break; + case D3DVSDT_FLOAT2: fvf |= D3DFVF_XYZB2; break; + case D3DVSDT_FLOAT3: fvf |= D3DFVF_XYZB3; break; + case D3DVSDT_FLOAT4: fvf |= D3DFVF_XYZB4; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_BLENDWEIGHT register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + break; + + case D3DVSDE_BLENDINDICES: /* seem to be B5 as said in MSDN Dx9SDK ?? */ + switch (type) { + case D3DVSDT_UBYTE4: fvf |= D3DFVF_LASTBETA_UBYTE4; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_BLENDINDINCES register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + break; + + case D3DVSDE_NORMAL: /* TODO: only FLOAT3 supported ... another choice possible ? */ + switch (type) { + case D3DVSDT_FLOAT3: fvf |= D3DFVF_NORMAL; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_NORMAL register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + break; + + case D3DVSDE_PSIZE: /* TODO: only FLOAT1 supported ... another choice possible ? */ + switch (type) { + case D3DVSDT_FLOAT1: fvf |= D3DFVF_PSIZE; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_PSIZE register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + break; + + case D3DVSDE_DIFFUSE: /* TODO: only D3DCOLOR supported */ + switch (type) { + case D3DVSDT_D3DCOLOR: fvf |= D3DFVF_DIFFUSE; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_DIFFUSE register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + break; + + case D3DVSDE_SPECULAR: /* TODO: only D3DCOLOR supported */ + switch (type) { + case D3DVSDT_D3DCOLOR: fvf |= D3DFVF_SPECULAR; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_SPECULAR register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + break; + + case D3DVSDE_TEXCOORD0: + case D3DVSDE_TEXCOORD1: + case D3DVSDE_TEXCOORD2: + case D3DVSDE_TEXCOORD3: + case D3DVSDE_TEXCOORD4: + case D3DVSDE_TEXCOORD5: + case D3DVSDE_TEXCOORD6: + case D3DVSDE_TEXCOORD7: + /* Fixme? - assume all tex coords in same stream */ + { + int texNo = 1 + (reg - D3DVSDE_TEXCOORD0); + tex = max(tex, texNo); + switch (type) { + case D3DVSDT_FLOAT1: fvf |= D3DFVF_TEXCOORDSIZE1(texNo); break; + case D3DVSDT_FLOAT2: fvf |= D3DFVF_TEXCOORDSIZE2(texNo); break; + case D3DVSDT_FLOAT3: fvf |= D3DFVF_TEXCOORDSIZE3(texNo); break; + case D3DVSDT_FLOAT4: fvf |= D3DFVF_TEXCOORDSIZE4(texNo); break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexShader declaration of D3DVSDE_TEXCOORD? register: unsupported type %s\n", VertexDecl8_DataTypes[type]); + } + } + break; + + case D3DVSDE_POSITION2: /* maybe D3DFVF_XYZRHW instead D3DFVF_XYZ (of D3DVDE_POSITION) ... to see */ + case D3DVSDE_NORMAL2: /* FIXME i don't know what to do here ;( */ + FIXME("[%lu] registers in VertexShader declaration not supported yet (token:0x%08lx)\n", reg, token); + break; + } + TRACE("VertexShader declaration define %lx as current FVF\n", fvf); + } + len += tokenlen; + pToken += tokenlen; + } + /* here D3DVSD_END() */ + len += IWineD3DVertexDeclarationImpl_ParseToken8(pToken); + + /* copy fvf if valid */ + if (FALSE == invalid_fvf) { + fvf |= tex << D3DFVF_TEXCOUNT_SHIFT; + object->fvf[stream] = fvf; + object->allFVF |= fvf; + } else { + object->fvf[stream] = 0; + } + TRACE("Completed, allFVF = %lx\n", object->allFVF); + + /* compute size */ + object->declaration8Length = len * sizeof(DWORD); + /* copy the declaration */ + object->pDeclaration8 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->declaration8Length); + memcpy(object->pDeclaration8, pDecl, object->declaration8Length); + /* returns */ + return D3D_OK; +} + +static CONST char* VertexDecl9_DeclUsages[] = { + "D3DDECLUSAGE_POSITION", + "D3DDECLUSAGE_BLENDWEIGHT", + "D3DDECLUSAGE_BLENDINDICES", + "D3DDECLUSAGE_NORMAL", + "D3DDECLUSAGE_PSIZE", + "D3DDECLUSAGE_TEXCOORD", + "D3DDECLUSAGE_TANGENT", + "D3DDECLUSAGE_BINORMAL", + "D3DDECLUSAGE_TESSFACTOR", + "D3DDECLUSAGE_POSITIONT", + "D3DDECLUSAGE_COLOR", + "D3DDECLUSAGE_FOG", + "D3DDECLUSAGE_DEPTH", + "D3DDECLUSAGE_SAMPLE", + NULL +}; + +static CONST char* VertexDecl9_DeclMethods[] = { + "D3DDECLMETHOD_DEFAULT", + "D3DDECLMETHOD_PARTIALU", + "D3DDECLMETHOD_PARTIALV", + "D3DDECLMETHOD_CROSSUV", + "D3DDECLMETHOD_UV", + "D3DDECLMETHOD_LOOKUP", + "D3DDECLMETHOD_LOOKUPPRESAMPLED", + NULL +}; + +static CONST char* VertexDecl9_DeclTypes[] = { + "D3DDECLTYPE_FLOAT1", + "D3DDECLTYPE_FLOAT2", + "D3DDECLTYPE_FLOAT3", + "D3DDECLTYPE_FLOAT4", + "D3DDECLTYPE_D3DCOLOR", + "D3DDECLTYPE_UBYTE4", + "D3DDECLTYPE_SHORT2", + "D3DDECLTYPE_SHORT4", + /* VS 2.0 */ + "D3DDECLTYPE_UBYTE4N", + "D3DDECLTYPE_SHORT2N", + "D3DDECLTYPE_SHORT4N", + "D3DDECLTYPE_USHORT2N", + "D3DDECLTYPE_USHORT4N", + "D3DDECLTYPE_UDEC3", + "D3DDECLTYPE_DEC3N", + "D3DDECLTYPE_FLOAT16_2", + "D3DDECLTYPE_FLOAT16_4", + "D3DDECLTYPE_UNUSED", + NULL +}; + +HRESULT IWineD3DVertexDeclarationImpl_ParseDeclaration9(IWineD3DDeviceImpl* This, const D3DVERTEXELEMENT9* pDecl, IWineD3DVertexDeclarationImpl* object) { + const D3DVERTEXELEMENT9* pToken = pDecl; + DWORD fvf = 0; + BOOL invalid_fvf = FALSE; + DWORD tex = D3DFVF_TEX0; + DWORD len = 0; + DWORD stream = 0; + + TRACE("(%p) : pDecl(%p)\n", This, pDecl); + + while (0xFF != pToken->Stream) { + DWORD type = pToken->Type; + DWORD oldStream = stream; + stream = pToken->Stream; + + if (D3DDECLMETHOD_DEFAULT != pToken->Method) { + WARN( + "%s register: Unsupported Method of %s (only D3DDECLMETHOD_DEFAULT for now) for VertexDeclaration (type %s)\n", + VertexDecl9_DeclUsages[pToken->Usage], + VertexDecl9_DeclMethods[pToken->Method], + VertexDecl9_DeclTypes[pToken->Type] + ); + } + + if (oldStream != stream) { + + if (FALSE == invalid_fvf) { + fvf |= tex << D3DFVF_TEXCOUNT_SHIFT; + tex = 0; + object->fvf[oldStream] = fvf; + object->allFVF |= fvf; + } else { + object->fvf[oldStream] = 0; + tex = 0; + } + + /* reset valid/invalid fvf */ + fvf = 0; + invalid_fvf = FALSE; + } + + switch (pToken->Usage) { + case D3DDECLUSAGE_POSITION: + if (0 < pToken->UsageIndex) { + invalid_fvf = TRUE; + TRACE("Mismatched UsageIndex (%u) in VertexDeclaration for D3DDECLUSAGE_POSITION register: unsupported type %s\n", pToken->UsageIndex, VertexDecl9_DeclTypes[type]); + } + switch (type) { + case D3DDECLTYPE_FLOAT3: fvf |= D3DFVF_XYZ; break; + case D3DDECLTYPE_FLOAT4: fvf |= D3DFVF_XYZRHW; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_POSITION register: unsupported type %s\n", VertexDecl9_DeclTypes[type]); + } + break; + + case D3DDECLUSAGE_BLENDWEIGHT: + switch (type) { + case D3DDECLTYPE_FLOAT1: fvf |= D3DFVF_XYZB1; break; + case D3DDECLTYPE_FLOAT2: fvf |= D3DFVF_XYZB2; break; + case D3DDECLTYPE_FLOAT3: fvf |= D3DFVF_XYZB3; break; + case D3DDECLTYPE_FLOAT4: fvf |= D3DFVF_XYZB4; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_BLENDWEIGHT register: unsupported type %s\n", VertexDecl9_DeclTypes[type]); + } + break; + + case D3DDECLUSAGE_BLENDINDICES: + switch (type) { + case D3DDECLTYPE_UBYTE4: fvf |= D3DFVF_LASTBETA_UBYTE4; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_BLENDINDINCES register: unsupported type %s\n", VertexDecl9_DeclTypes[type]); + } + break; + + case D3DDECLUSAGE_NORMAL: + if (0 < pToken->UsageIndex) { + invalid_fvf = TRUE; + TRACE("Mismatched UsageIndex (%u) in VertexDeclaration for D3DDECLUSAGE_NORMAL register: unsupported type %s\n", pToken->UsageIndex, VertexDecl9_DeclTypes[type]); + } + switch (type) { + case D3DDECLTYPE_FLOAT3: fvf |= D3DFVF_NORMAL; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_NORMAL register: unsupported type %s\n", VertexDecl9_DeclTypes[type]); + } + break; + + case D3DDECLUSAGE_PSIZE: + switch (type) { + case D3DDECLTYPE_FLOAT1: fvf |= D3DFVF_PSIZE; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_PSIZE register: unsupported type %s\n", VertexDecl9_DeclTypes[type]); + } + break; + + case D3DDECLUSAGE_TEXCOORD: + { + DWORD texNo = pToken->UsageIndex; + tex = max(tex, texNo); + switch (type) { + case D3DDECLTYPE_FLOAT1: fvf |= D3DFVF_TEXCOORDSIZE1(texNo); break; + case D3DDECLTYPE_FLOAT2: fvf |= D3DFVF_TEXCOORDSIZE2(texNo); break; + case D3DDECLTYPE_FLOAT3: fvf |= D3DFVF_TEXCOORDSIZE3(texNo); break; + case D3DDECLTYPE_FLOAT4: fvf |= D3DFVF_TEXCOORDSIZE4(texNo); break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_TEXCOORD[%lu] register: unsupported type %s\n", texNo, VertexDecl9_DeclTypes[type]); + } + } + break; + + case D3DDECLUSAGE_COLOR: + { + DWORD colorNo = pToken->UsageIndex; + switch (type) { + case D3DDECLTYPE_D3DCOLOR: + switch (pToken->UsageIndex) { + case 0: fvf |= D3DFVF_DIFFUSE; break; + case 1: fvf |= D3DFVF_SPECULAR; break; + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_COLOR[%lu] unsupported COLOR register\n", colorNo); + } + default: + /** Mismatched use of a register, invalid for fixed function fvf computing (ok for VS) */ + invalid_fvf = TRUE; + TRACE("Mismatched use in VertexDeclaration of D3DDECLUSAGE_COLOR[%lu] register: unsupported type %s\n", colorNo, VertexDecl9_DeclTypes[type]); + } + } + break; + + case D3DDECLUSAGE_TANGENT: + case D3DDECLUSAGE_BINORMAL: + case D3DDECLUSAGE_TESSFACTOR: + case D3DDECLUSAGE_POSITIONT: + case D3DDECLUSAGE_FOG: + case D3DDECLUSAGE_DEPTH: + case D3DDECLUSAGE_SAMPLE: + FIXME("%s Usage not supported yet by VertexDeclaration (type is %s)\n", VertexDecl9_DeclUsages[pToken->Usage], VertexDecl9_DeclTypes[type]); + break; + } + + ++len; + ++pToken; + } + ++len; /* D3DDECL_END() */ + + /* copy fvf if valid */ + if (FALSE == invalid_fvf) { + fvf |= tex << D3DFVF_TEXCOUNT_SHIFT; + object->fvf[stream] = fvf; + object->allFVF |= fvf; + } else { + object->fvf[stream] = 0; + } + + + TRACE("Completed, allFVF = %lx\n", object->allFVF); + + /* compute size */ + object->declaration9NumElements = len; + /* copy the declaration */ + object->pDeclaration8 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(D3DVERTEXELEMENT9)); + memcpy(object->pDeclaration9, pDecl, len * sizeof(D3DVERTEXELEMENT9)); + /* returns */ + return D3D_OK; +} /* ******************************************* IWineD3DVertexDeclaration IUnknown parts follow @@ -116,7 +707,7 @@ HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDevice(IWineD3DVertexDeclaration return D3D_OK; } -HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration8(IWineD3DVertexDeclaration* iface, DWORD* pData, DWORD* pSizeOfData) { +static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration8(IWineD3DVertexDeclaration* iface, DWORD* pData, DWORD* pSizeOfData) { IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; if (NULL == pData) { *pSizeOfData = This->declaration8Length; @@ -131,7 +722,7 @@ HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration8(IWineD3DVertexDecla return D3D_OK; } -HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration9(IWineD3DVertexDeclaration* iface, D3DVERTEXELEMENT9* pData, UINT* pNumElements) { +HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration9(IWineD3DVertexDeclaration* iface, D3DVERTEXELEMENT9* pData, DWORD* pNumElements) { IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; if (NULL == pData) { *pNumElements = This->declaration9NumElements; @@ -146,12 +737,18 @@ HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration9(IWineD3DVertexDecla return D3D_OK; } +HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration(IWineD3DVertexDeclaration* iface, UINT iDeclVersion, VOID* pData, DWORD* pSize) { + if (8 == iDeclVersion) { + return IWineD3DVertexDeclarationImpl_GetDeclaration8(iface, (DWORD*) pData, pSize); + } + return IWineD3DVertexDeclarationImpl_GetDeclaration9(iface, (D3DVERTEXELEMENT9*) pData, pSize); +} + IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl = { IWineD3DVertexDeclarationImpl_QueryInterface, IWineD3DVertexDeclarationImpl_AddRef, IWineD3DVertexDeclarationImpl_Release, IWineD3DVertexDeclarationImpl_GetDevice, - IWineD3DVertexDeclarationImpl_GetDeclaration8, - IWineD3DVertexDeclarationImpl_GetDeclaration9 + IWineD3DVertexDeclarationImpl_GetDeclaration, }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 23d2d7027dc..4ee61eb23f4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -642,6 +642,7 @@ typedef struct SAVEDSTATES { BOOL renderState[HIGHEST_RENDER_STATE]; BOOL textureState[8][HIGHEST_TEXTURE_STATE]; BOOL clipplane[MAX_CLIPPLANES]; + BOOL vertexDecl; } SAVEDSTATES; struct IWineD3DStateBlockImpl diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h index 98e5626feb7..eb8c60684b8 100644 --- a/include/wine/wined3d_interface.h +++ b/include/wine/wined3d_interface.h @@ -131,7 +131,9 @@ typedef struct IWineD3DVolumeTexture IWineD3DVolumeTexture; typedef struct IWineD3DStateBlock IWineD3DStateBlock; typedef struct IWineD3DSurface IWineD3DSurface; typedef struct IWineD3DVolume IWineD3DVolume; -typedef struct IWineD3DVertexDeclaration IWineD3DVertexDeclaration; +typedef struct IWineD3DVertexDeclaration IWineD3DVertexDeclaration; +typedef struct IWineD3DVertexShader IWineD3DVertexShader; +typedef struct IWineD3DPixelShader IWineD3DPixelShader; /***************************************************************************** * Callback functions required for predefining surfaces / stencils @@ -279,10 +281,11 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,INT baseVIdx, UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void * pIndexData,D3DFORMAT IndexDataFormat,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ UINT iDeclVersion, CONST VOID* pDeclaration, IWineD3DVertexDeclaration** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IWineD3DVertexDeclaration* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IWineD3DVertexDeclaration** ppDecl) PURE; /*** Internal use IWineD3D methods ***/ STDMETHOD_(void, SetupTextureStates)(THIS_ DWORD Stage, DWORD Flags); - - }; #undef INTERFACE @@ -873,10 +876,7 @@ DECLARE_INTERFACE_(IWineD3DVertexDeclaration,IUnknown) STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IWineD3DVertexDeclaration methods ***/ STDMETHOD(GetDevice)(THIS_ IWineD3DDevice ** ppDevice) PURE; - STDMETHOD(GetDeclaration8)(THIS_ DWORD*, DWORD* pSizeOfData) PURE; -#ifdef __WINE_D3D9_H - STDMETHOD(GetDeclaration9)(THIS_ D3DVERTEXELEMENT9*, UINT* pNumElements) PURE; -#endif + STDMETHOD(GetDeclaration)(THIS_ UINT iDeclVersion, VOID*, DWORD* pSize) PURE; }; #undef INTERFACE @@ -887,12 +887,11 @@ DECLARE_INTERFACE_(IWineD3DVertexDeclaration,IUnknown) #define IWineD3DVertexDeclaration_Release(p) (p)->lpVtbl->Release(p) /*** IWineD3DVertexDeclaration methods ***/ #define IWineD3DVertexDeclaration_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IWineD3DVertexDeclaration_GetDeclaration8(p,a,b) (p)->lpVtbl->GetDeclaration8(p,a,b) -#define IWineD3DVertexDeclaration_GetDeclaration9(p,a,b) (p)->lpVtbl->GetDeclaration9(p,a,b) +#define IWineD3DVertexDeclaration_GetDeclaration(p,a,b,c) (p)->lpVtbl->GetDeclaration8(p,a,b,c) #endif /***************************************************************************** - * WineD3DStateBlock interface + * IWineD3DStateBlock interface */ #define INTERFACE IWineD3DStateBlock DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown) @@ -918,76 +917,80 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown) #endif +/***************************************************************************** + * IWineD3DVertexShader interface + */ +#define INTERFACE IWineD3DVertexShader +DECLARE_INTERFACE_(IWineD3DVertexShader,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWineD3DVertexShader methods ***/ + STDMETHOD(GetFunction)(THIS_ VOID* pData, UINT* pSizeOfData) PURE; + STDMETHOD(SetConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE; + STDMETHOD(SetConstantI)(THIS_ UINT StartRegister, CONST INT* pConstantData, UINT Vector4iCount) PURE; + STDMETHOD(SetConstantF)(THIS_ UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount) PURE; + STDMETHOD(GetConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE; + STDMETHOD(GetConstantI)(THIS_ UINT StartRegister, INT* pConstantData, UINT Vector4iCount) PURE; + STDMETHOD(GetConstantF)(THIS_ UINT StartRegister, FLOAT* pConstantData, UINT Vector4fCount) PURE; + /* Internal Interfaces */ + STDMETHOD_(DWORD, GetVersion)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IWineD3DVertexShader_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IWineD3DVertexShader_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IWineD3DVertexShader_Release(p) (p)->lpVtbl->Release(p) +/*** IWineD3DVertexShader methods ***/ +#define IWineD3DVertexShader_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#define IWineD3DVertexShader_SetConstantB(p,a,b,c) (p)->lpVtbl->SetConstantB(p,a,b,c) +#define IWineD3DVertexShader_SetConstantI(p,a,b,c) (p)->lpVtbl->SetConstantI(p,a,b,c) +#define IWineD3DVertexShader_SetConstantF(p,a,b,c) (p)->lpVtbl->SetConstantF(p,a,b,c) +#define IWineD3DVertexShader_GetConstantB(p,a,b,c) (p)->lpVtbl->GetConstantB(p,a,b,c) +#define IWineD3DVertexShader_GetConstantI(p,a,b,c) (p)->lpVtbl->GetConstantI(p,a,b,c) +#define IWineD3DVertexShader_GetConstantF(p,a,b,c) (p)->lpVtbl->GetConstantF(p,a,b,c) +#define IWineD3DVertexShader_GetVersion(p) (p)->lpVtbl->GetVersion(p) +#endif + +/***************************************************************************** + * IWineD3DPixelShader interface + */ +#define INTERFACE IWineD3DPixelShader +DECLARE_INTERFACE_(IWineD3DPixelShader,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWineD3DPixelShader methods ***/ + STDMETHOD(GetFunction)(THIS_ VOID* pData, UINT* pSizeOfData) PURE; + STDMETHOD(SetConstantF)(THIS_ UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount) PURE; + STDMETHOD(GetConstantF)(THIS_ UINT StartRegister, FLOAT* pConstantData, UINT Vector4fCount) PURE; + /* Internal Interfaces */ + STDMETHOD_(DWORD, GetVersion)(THIS) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IWineD3DPixelShader_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IWineD3DPixelShader_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IWineD3DPixelShader_Release(p) (p)->lpVtbl->Release(p) +/*** IWineD3DPixelShader methods ***/ +#define IWineD3DPixelShader_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#define IWineD3DPixelShader_SetConstantF(p,a,b,c) (p)->lpVtbl->SetConstantF(p,a,b,c) +#define IWineD3DPixelShader_GetConstantF(p,a,b,c) (p)->lpVtbl->GetConstantF(p,a,b,c) +#define IWineD3DPixelShader_GetVersion(p) (p)->lpVtbl->GetVersion(p) +#endif + #if 0 /* FIXME: During porting in from d3d8 - the following will be used */ -/***************************************************************** - * Some defines - */ - -/* Device caps */ -#define MAX_PALETTES 256 -#define MAX_STREAMS 16 -#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES -#define MAX_LEVELS 256 - -/* Other useful values */ -#define HIGHEST_RENDER_STATE 174 -#define HIGHEST_TEXTURE_STATE 29 -#define HIGHEST_TRANSFORMSTATE 512 -#define D3DSBT_RECORDED 0xfffffffe - -#define D3D_VSHADER_MAX_CONSTANTS 96 -#define D3D_PSHADER_MAX_CONSTANTS 32 - -/***************************************************************** - * Some includes - */ - -#include "wine/wined3d_gl.h" -#include "wine/wined3d_types.h" - -#include -#include -#include - -/***************************************************************** - * Some defines - */ - -typedef struct IDirect3DImpl IDirect3DImpl; -typedef struct IDirect3DBaseTextureImpl IDirect3DBaseTextureImpl; -typedef struct IDirect3DVolumeTextureImpl IDirect3DVolumeTextureImpl; -typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl; -typedef struct IDirect3DTextureImpl IDirect3DTextureImpl; -typedef struct IDirect3DCubeTextureImpl IDirect3DCubeTextureImpl; -typedef struct IDirect3DIndexBufferImpl IDirect3DIndexBufferImpl; -typedef struct IDirect3DSurfaceImpl IDirect3DSurfaceImpl; -typedef struct IDirect3DSwapChainImpl IDirect3DSwapChainImpl; -typedef struct IDirect3DResourceImpl IDirect3DResourceImpl; -typedef struct IDirect3DVolumeImpl IDirect3DVolumeImpl; -typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl; -typedef struct IDirect3DStateBlockImpl IDirect3DStateBlockImpl; -typedef struct IDirect3DVertexDeclarationImpl IDirect3DVertexDeclarationImpl; -typedef struct IDirect3DVertexShaderImpl IDirect3DVertexShaderImpl; -typedef struct IDirect3DPixelShaderImpl IDirect3DPixelShaderImpl; - - -/************************************************************* - * d3dcore interfaces defs - */ - -/** Vertex Shader API */ extern HRESULT WINAPI IDirect3DVertexShaderImpl_ParseProgram(IDirect3DVertexShaderImpl* This, CONST DWORD* pFunction); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetFunction(IDirect3DVertexShaderImpl* This, VOID* pData, UINT* pSizeOfData); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST INT* pConstantData, UINT Vector4iCount); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_SetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantB(IDirect3DVertexShaderImpl* This, UINT StartRegister, BOOL* pConstantData, UINT BoolCount); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantI(IDirect3DVertexShaderImpl* This, UINT StartRegister, INT* pConstantData, UINT Vector4iCount); -extern HRESULT WINAPI IDirect3DVertexShaderImpl_GetConstantF(IDirect3DVertexShaderImpl* This, UINT StartRegister, FLOAT* pConstantData, UINT Vector4fCount); /* internal Interfaces */ -extern DWORD WINAPI IDirect3DVertexShaderImpl_GetVersion(IDirect3DVertexShaderImpl* This); extern HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* This, VSHADERINPUTDATA* input, VSHADEROUTPUTDATA* output); - #endif /* Temporary #if 0 */