Stefan Dösinger : wined3d: Fix the num blend values -> type match.
Alexandre Julliard
julliard at winehq.org
Tue Nov 4 07:29:22 CST 2008
Module: wine
Branch: master
Commit: a8497a5545f45667e7959316e4ee17404e073b0d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8497a5545f45667e7959316e4ee17404e073b0d
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Nov 3 00:38:14 2008 +0100
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 42b46ce..4631248 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 6307950..83bc436 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++;
More information about the wine-cvs
mailing list