Matteo Bruni : d3dx9: Always use type-> Rows as D3DXPC_MATRIX_ROWS parameters size.

Alexandre Julliard julliard at winehq.org
Mon Mar 3 13:20:11 CST 2014


Module: wine
Branch: master
Commit: 8b5cd9edbcc94267d5ed6ae0ba6b8d34b19ee341
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8b5cd9edbcc94267d5ed6ae0ba6b8d34b19ee341

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Mon Mar  3 17:48:12 2014 +0100

d3dx9: Always use type->Rows as D3DXPC_MATRIX_ROWS parameters size.

---

 dlls/d3dx9_36/shader.c       |    8 ++++----
 dlls/d3dx9_36/tests/shader.c |    7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 955c2ad..68e7474 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -1775,7 +1775,7 @@ static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl =
 };
 
 static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, struct ctab_constant *constant,
-        BOOL is_element, WORD index, WORD max, DWORD *offset, DWORD nameoffset, UINT regset)
+        BOOL is_element, WORD index, WORD max_index, DWORD *offset, DWORD nameoffset, UINT regset)
 {
     const D3DXSHADER_TYPEINFO *type = (LPD3DXSHADER_TYPEINFO)(ctab + typeoffset);
     const D3DXSHADER_STRUCTMEMBERINFO *memberinfo = NULL;
@@ -1824,7 +1824,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru
         for (i = 0; i < count; ++i)
         {
             hr = parse_ctab_constant_type(ctab, memberinfo ? memberinfo[i].TypeInfo : typeoffset,
-                    &constant->constants[i], memberinfo == NULL, index + size, max, offset,
+                    &constant->constants[i], memberinfo == NULL, index + size, max_index, offset,
                     memberinfo ? memberinfo[i].Name : nameoffset, regset);
             if (hr != D3D_OK)
                 goto error;
@@ -1859,7 +1859,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru
 
                     case D3DXPC_MATRIX_ROWS:
                         offsetdiff = type->Rows * 4;
-                        size = is_element ? type->Rows : max(type->Rows, type->Columns);
+                        size = type->Rows;
                         break;
 
                     case D3DXPC_MATRIX_COLUMNS:
@@ -1893,7 +1893,7 @@ static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, stru
         if (offset) *offset += offsetdiff * 4;
     }
 
-    constant->desc.RegisterCount = max(0, min(max - index, size));
+    constant->desc.RegisterCount = max(0, min(max_index - index, size));
     constant->desc.Bytes = 4 * constant->desc.Elements * type->Rows * type->Columns;
 
     return D3D_OK;
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 74ada6e..80c0f64 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -120,7 +120,7 @@ static const DWORD ctab_matrices[] = {
     0x000000ac,
     0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000,             /* Constant 1 desc (fmatrix3x1) */
     0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000,             /* Constant 2 desc (fmatrix4x4) */
-    0x00000090, 0x00040002, 0x00000003, 0x0000009c, 0x00000000,             /* Constant 3 desc (imatrix2x3) */
+    0x00000090, 0x00040002, 0x00000002, 0x0000009c, 0x00000000,             /* Constant 3 desc (imatrix2x3) */
     0x74616D66, 0x33786972, 0xab003178,                                     /* Constant 1 name              */
     0x00030003, 0x00010003, 0x00000001, 0x00000000,                         /* Constant 1 type desc         */
     0x74616D66, 0x34786972, 0xab003478,                                     /* Constant 2 name              */
@@ -133,8 +133,9 @@ static const DWORD ctab_matrices[] = {
 
 static const D3DXCONSTANT_DESC ctab_matrices_expected[] = {
     {"fmatrix4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL},
-    {"imatrix2x3", D3DXRS_FLOAT4, 4, 3, D3DXPC_MATRIX_ROWS,    D3DXPT_INT,   2, 3, 1, 0, 24, NULL},
-    {"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}};
+    {"imatrix2x3", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_ROWS,    D3DXPT_INT,   2, 3, 1, 0, 24, NULL},
+    {"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL},
+};
 
 static const DWORD ctab_matrices2[] = {
     0xfffe0200,                                                             /* vs_2_0                        */




More information about the wine-cvs mailing list