From a8497a5545f45667e7959316e4ee17404e073b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 3 Nov 2008 00:38:14 +0100 Subject: [PATCH] wined3d: Fix the num blend values -> type match. --- dlls/d3d9/vertexdeclaration.c | 12 ++++++++++-- dlls/wined3d/device.c | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index 42b46ce1610..4631248a0f1 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -106,8 +106,16 @@ HRESULT vdecl_convert_fvf( if (has_blend && (num_blends > 0)) { if (((fvf & D3DFVF_XYZB5) == D3DFVF_XYZB2) && (fvf & D3DFVF_LASTBETA_D3DCOLOR)) elements[idx].Type = D3DDECLTYPE_D3DCOLOR; - else - elements[idx].Type = D3DDECLTYPE_FLOAT1 + num_blends - 1; + else { + switch(num_blends) { + case 1: elements[idx].Type = D3DDECLTYPE_FLOAT1; break; + case 2: elements[idx].Type = D3DDECLTYPE_FLOAT2; break; + case 3: elements[idx].Type = D3DDECLTYPE_FLOAT3; break; + case 4: elements[idx].Type = D3DDECLTYPE_FLOAT4; break; + default: + ERR("Unexpected amount of blend values: %u\n", num_blends); + } + } elements[idx].Usage = D3DDECLUSAGE_BLENDWEIGHT; elements[idx].UsageIndex = 0; idx++; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6307950f760..83bc436dce9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1792,8 +1792,16 @@ static unsigned int ConvertFvfToDeclaration(IWineD3DDeviceImpl *This, /* For the if (has_blend && (num_blends > 0)) { if (((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2) && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR)) elements[idx].Type = WINED3DDECLTYPE_D3DCOLOR; - else - elements[idx].Type = WINED3DDECLTYPE_FLOAT1 + num_blends - 1; + else { + switch(num_blends) { + case 1: elements[idx].Type = WINED3DDECLTYPE_FLOAT1; break; + case 2: elements[idx].Type = WINED3DDECLTYPE_FLOAT2; break; + case 3: elements[idx].Type = WINED3DDECLTYPE_FLOAT3; break; + case 4: elements[idx].Type = WINED3DDECLTYPE_FLOAT4; break; + default: + ERR("Unexpected amount of blend values: %u\n", num_blends); + } + } elements[idx].Usage = WINED3DDECLUSAGE_BLENDWEIGHT; elements[idx].UsageIndex = 0; idx++;