[5/7] d3dx9: Implement ID3DXConstantTable::SetMatrixTranspose. (try 2)

Józef Kucia joseph.kucia at gmail.com
Tue Aug 21 07:52:18 CDT 2012


try 2: Add more tests.
---
 dlls/d3dx9_36/shader.c       |    4 +-
 dlls/d3dx9_36/tests/shader.c |   49 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 11835eb..01b2e7c 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -1252,9 +1252,9 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTranspose(ID3DXConstantTab
 {
     struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
 
-    FIXME("(%p)->(%p, %p, %p): stub\n", This, device, constant, matrix);
+    TRACE("(%p)->(%p, %p, %p)\n", This, device, constant, matrix);
 
-    return E_NOTIMPL;
+    return set_matrix_array(iface, device, constant, matrix, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4);
 }
 
 static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposeArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 2ecb802..caa0f0b 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -649,6 +649,7 @@ static void test_setting_basic_table(IDirect3DDevice9 *device)
     /* Clear registers */
     memset(out, 0, sizeof(out));
     IDirect3DDevice9_SetVertexShaderConstantF(device, 0, out, 4);
+    IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
     IDirect3DDevice9_SetVertexShaderConstantF(device, 7, out, 1);
 
     /* SetVector shouldn't change the value of a matrix constant */
@@ -693,6 +694,24 @@ static void test_setting_basic_table(IDirect3DDevice9 *device)
             "got {%f, %f, %f, %f}, should be all 0.0f\n",
             out[0], out[1], out[2], out[3]);
 
+    res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "f", &mvp);
+    ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable f: 0x%08x\n", res);
+
+    IDirect3DDevice9_GetVertexShaderConstantF(device, 6, out, 1);
+    ok(out[0] == U(S(mvp))._11 && out[1] == 0.0f && out[2] == 0.0f && out[3] == 0.0f,
+            "The variable f was not set correctly by ID3DXConstantTable_SetMatrixTranspose, got %f, should be %f\n",
+            out[0], U(S(mvp))._11);
+
+    res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "f4", &mvp);
+    ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable f4: 0x%08x\n", res);
+
+    IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
+    todo_wine ok(out[0] == S(U(mvp))._11 && out[1] == S(U(mvp))._21 && out[2] == S(U(mvp))._31 && out[3] == S(U(mvp))._41,
+            "The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixTranspose, "
+            "got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
+            out[0], out[1], out[2], out[3],
+            S(U(mvp))._11, S(U(mvp))._21, S(U(mvp))._31, S(U(mvp))._41);
+
     refcnt = ID3DXConstantTable_Release(ctable);
     ok(refcnt == 0, "The constant table reference count was %u, should be 0\n", refcnt);
 }
@@ -741,6 +760,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device)
     res = D3DXGetShaderConstantTable(ctab_matrices2, &ctable);
     ok(res == D3D_OK, "D3DXGetShaderConstantTable failed: got %#x\n", res);
 
+    /* SetMatrix */
     res = ID3DXConstantTable_SetMatrix(ctable, device, "c2x3", &fmatrix);
     ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c2x3: got %#x\n", res);
 
@@ -826,6 +846,35 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device)
             S(U(fmatrix))._31, S(U(fmatrix))._32, S(U(fmatrix))._33, S(U(fmatrix))._34,
             S(U(fmatrix))._41, S(U(fmatrix))._42, S(U(fmatrix))._43, S(U(fmatrix))._44);
 
+    /* SetMatrixTranspose */
+    res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "c2x3", &fmatrix);
+    ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable c2x3: got %#x\n", res);
+
+    res = ID3DXConstantTable_SetMatrixTranspose(ctable, device, "r2x3", &fmatrix);
+    ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTranspose failed on variable r2x3: got %#x\n", res);
+
+    IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3);
+    ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == 0.0f && out[3] == 0.0f
+            && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f
+            && out[8] == S(U(fmatrix))._31 && out[9] == S(U(fmatrix))._32 && out[10] == 0.0f && out[11] == 0.0f,
+            "The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
+            "should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}\n",
+            out[0], out[1], out[2], out[3],
+            out[4], out[5], out[6], out[7],
+            out[8], out[9], out[10], out[11],
+            S(U(fmatrix))._11, S(U(fmatrix))._12, 0.0f, 0.0f,
+            S(U(fmatrix))._21, S(U(fmatrix))._22, 0.0f, 0.0f,
+            S(U(fmatrix))._31, S(U(fmatrix))._32, 0.0f, 0.0f);
+
+    IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2);
+    ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f
+            && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._32 && out[7] == 0.0f,
+            "The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
+            "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n",
+            out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
+            S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f,
+            S(U(fmatrix))._12, S(U(fmatrix))._22, S(U(fmatrix))._32, 0.0f);
+
     ID3DXConstantTable_Release(ctable);
 }
 
-- 
1.7.8.6




More information about the wine-patches mailing list