H. Verbeet : wined3d: glTypeLookup cleanup.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Mar 22 15:09:04 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 46b13aaa585ebdd1c418a9df03bf3851190eebfd
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=46b13aaa585ebdd1c418a9df03bf3851190eebfd
Author: H. Verbeet <hverbeet at gmail.com>
Date: Wed Mar 22 19:46:59 2006 +0000
wined3d: glTypeLookup cleanup.
Use a struct instead of an UINT array as entries in the glTypeLookup
table.
---
dlls/wined3d/vertexdeclaration.c | 2 +-
dlls/wined3d/wined3d_private.h | 20 ++++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index 5d216af..653f2b7 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -297,7 +297,7 @@ IWineD3DVertexDeclarationImpl *This = (I
convToW[nTokens].Type = type;
convToW[nTokens].Offset = offset;
convToW[nTokens].Reg = reg;
- offset += glTypeLookup[type][1] * glTypeLookup[type][4];
+ offset += glTypeLookup[type].size * glTypeLookup[type].typesize;
++nTokens;
} else if (D3DVSD_TOKEN_STREAMDATA == tokentype && 0x10000000 & tokentype ) {
TRACE(" 0x%08lx SKIP(%lu)\n", tokentype, ((tokentype & D3DVSD_SKIPCOUNTMASK) >> D3DVSD_SKIPCOUNTSHIFT));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d6e851a..9afa988 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -81,8 +81,16 @@ extern DWORD *stateLookup[MAX_LOOKUPS];
extern DWORD minMipLookup[D3DTEXF_ANISOTROPIC + 1][D3DTEXF_LINEAR + 1];
+typedef struct _WINED3DGLTYPE {
+ int d3dType;
+ GLint size;
+ GLenum glType;
+ GLboolean normalized;
+ int typesize;
+} WINED3DGLTYPE;
+
/* NOTE: Make sure these are in the correct numerical order. (see /include/d3d9types.h typedef enum _D3DDECLTYPE) */
-UINT static const glTypeLookup[D3DDECLTYPE_UNUSED][5] = {
+WINED3DGLTYPE static const glTypeLookup[D3DDECLTYPE_UNUSED] = {
{D3DDECLTYPE_FLOAT1, 1, GL_FLOAT , GL_FALSE ,sizeof(float)},
{D3DDECLTYPE_FLOAT2, 2, GL_FLOAT , GL_FALSE ,sizeof(float)},
{D3DDECLTYPE_FLOAT3, 3, GL_FLOAT , GL_FALSE ,sizeof(float)},
@@ -101,11 +109,11 @@ UINT static const glTypeLookup[D3DDECLTY
{D3DDECLTYPE_FLOAT16_2, 2, GL_FLOAT , GL_FALSE ,sizeof(short int)},
{D3DDECLTYPE_FLOAT16_4, 4, GL_FLOAT , GL_FALSE ,sizeof(short int)}};
-#define WINED3D_ATR_TYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][0]
-#define WINED3D_ATR_SIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][1]
-#define WINED3D_ATR_GLTYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][2]
-#define WINED3D_ATR_NORMALIZED(_attribute) glTypeLookup[sd->u.s._attribute.dwType][3]
-#define WINED3D_ATR_TYPESIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType][4]
+#define WINED3D_ATR_TYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType].d3dType
+#define WINED3D_ATR_SIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType].size
+#define WINED3D_ATR_GLTYPE(_attribute) glTypeLookup[sd->u.s._attribute.dwType].glType
+#define WINED3D_ATR_NORMALIZED(_attribute) glTypeLookup[sd->u.s._attribute.dwType].normalized
+#define WINED3D_ATR_TYPESIZE(_attribute) glTypeLookup[sd->u.s._attribute.dwType].typesize
/**
* Settings
More information about the wine-cvs
mailing list