Module: wine Branch: master Commit: b31b9864d92c86ed04b26a7dfb25f4e202233888 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b31b9864d92c86ed04b26a7dfb...
Author: Józef Kucia joseph.kucia@gmail.com Date: Thu Aug 16 17:21:23 2012 +0200
d3dx9: Fix ID3DXConstantTable::SetMatrix.
---
dlls/d3dx9_36/shader.c | 36 ++---------------------------------- dlls/d3dx9_36/tests/shader.c | 12 ++++++------ 2 files changed, 8 insertions(+), 40 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index 900459e..9482518 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -1178,7 +1178,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix(ID3DXConstantTable *iface
TRACE("(%p)->(%p, %p, %p)\n", This, device, constant, matrix);
- return ID3DXConstantTable_SetMatrixArray(iface, device, constant, matrix, 1); + return set_matrix_array(iface, device, constant, matrix, 1, D3DXPT_FLOAT, 4, 4); }
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, @@ -1186,41 +1186,9 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable * { struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
- D3DXCONSTANT_DESC desc; - HRESULT hr; - UINT i, desc_count = 1; - D3DXMATRIX temp; - TRACE("(%p)->(%p, %p, %p, %d)\n", This, device, constant, matrix, count);
- hr = ID3DXConstantTable_GetConstantDesc(iface, constant, &desc, &desc_count); - if (FAILED(hr)) - { - TRACE("ID3DXConstantTable_GetConstantDesc failed: %08x\n", hr); - return D3DERR_INVALIDCALL; - } - - switch (desc.RegisterSet) - { - case D3DXRS_FLOAT4: - /* i * 4 + 3 is the last register we set. The conditional makes sure that we don't access - registers we're not supposed to */ - for (i = 0; i < count && i * 4 + 3 < desc.RegisterCount; i++) - { - if (desc.Class == D3DXPC_MATRIX_ROWS) - temp = matrix[i]; - else - D3DXMatrixTranspose(&temp, &matrix[i]); - - set_float_shader_constant(This, device, desc.RegisterIndex + i * 4, &temp.u.s._11, 4); - } - break; - default: - FIXME("Handle other register sets\n"); - return E_NOTIMPL; - } - - return D3D_OK; + return set_matrix_array(iface, device, constant, matrix, count, D3DXPT_FLOAT, 4, 4); }
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c index 18636d9..8bfea43 100644 --- a/dlls/d3dx9_36/tests/shader.c +++ b/dlls/d3dx9_36/tests/shader.c @@ -674,7 +674,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device) (int)S(U(fmatrix))._21, (int)S(U(fmatrix))._22, (int)S(U(fmatrix))._23, 0);
IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1); - todo_wine ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f, + ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f, "The variable fmatrix3x1 was not set correctly, out={%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n", out[0], out[1], out[2], out[3], S(U(fmatrix))._11, S(U(fmatrix))._21, S(U(fmatrix))._31, 0.0f); @@ -700,7 +700,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device) ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable c3x3: got %#x\n", res);
IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 3); - todo_wine ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == 0.0f && out[3] == 0.0f + ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == 0.0f && out[3] == 0.0f && out[4] == S(U(fmatrix))._12 && out[5] == S(U(fmatrix))._22 && out[6] == 0.0f && out[7] == 0.0f && out[8] == S(U(fmatrix))._13 && out[9] == S(U(fmatrix))._23 && 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}, " @@ -716,7 +716,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device) ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix failed on variable r4x4: got %#x\n", res);
IDirect3DDevice9_GetVertexShaderConstantF(device, 15, out, 2); - todo_wine ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == S(U(fmatrix))._13 && out[3] == 0.0f + ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == S(U(fmatrix))._13 && out[3] == 0.0f && out[4] == S(U(fmatrix))._21 && out[5] == S(U(fmatrix))._22 && out[6] == S(U(fmatrix))._23 && 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", @@ -725,7 +725,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device) S(U(fmatrix))._21, S(U(fmatrix))._22, S(U(fmatrix))._23, 0.0f);
IDirect3DDevice9_GetVertexShaderConstantF(device, 13, out, 2); - todo_wine ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f + 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 c3x2 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, " "should be {%f, %f, %f, %f; %f, %f, %f, %f}\n", @@ -734,7 +734,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device) S(U(fmatrix))._12, S(U(fmatrix))._22, S(U(fmatrix))._32, 0.0f);
IDirect3DDevice9_GetVertexShaderConstantF(device, 4, out, 3); - todo_wine ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._12 && out[2] == 0.0f && out[3] == 0.0f + 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 r3x2 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, " @@ -745,7 +745,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device) S(U(fmatrix))._31, S(U(fmatrix))._32, 0.0f, 0.0f);
IDirect3DDevice9_GetVertexShaderConstantF(device, 10, out, 3); - todo_wine ok(out[0] == S(U(fmatrix))._11 && out[1] == S(U(fmatrix))._21 && out[2] == S(U(fmatrix))._31 && out[3] == 0.0f + 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 && out[8] == S(U(fmatrix))._13 && out[9] == S(U(fmatrix))._23 && out[10] == S(U(fmatrix))._33 && out[11] == 0.0f, "The variable c3x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "