Module: wine Branch: master Commit: 978971e1ac364ba3734eb7290ae3747dc0cadf17 URL: http://source.winehq.org/git/wine.git/?a=commit;h=978971e1ac364ba3734eb7290a...
Author: Józef Kucia joseph.kucia@gmail.com Date: Tue Aug 21 14:52:14 2012 +0200
d3dx9: ID3DXConstantTable::SetMatrix should set scalar constants.
---
dlls/d3dx9_36/shader.c | 6 ++++++ dlls/d3dx9_36/tests/shader.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index 9482518..faab0a4 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -988,6 +988,12 @@ static HRESULT set_matrix_array(ID3DXConstantTable *iface, IDirect3DDevice9 *dev row_offset = 4; registers_per_matrix = desc.Rows; } + else if (desc.Class == D3DXPC_SCALAR) + { + column_offset = 1; + row_offset = 1; + registers_per_matrix = 1; + } else { FIXME("Unhandled variable class %#x\n", desc.Class); diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c index 8bfea43..916136e 100644 --- a/dlls/d3dx9_36/tests/shader.c +++ b/dlls/d3dx9_36/tests/shader.c @@ -636,6 +636,16 @@ static void test_setting_basic_table(IDirect3DDevice9 *device) "The variable f was not set correctly by ID3DXConstantTable_SetVector, got %f, should be %f\n", out[0], f4.x);
+ memset(out, 0, sizeof(out)); + IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1); + res = ID3DXConstantTable_SetMatrix(ctable, device, "f", &mvp); + ok(res == D3D_OK, "ID3DXConstantTable_SetMatrix 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_SetMatrix, got %f, should be %f\n", + out[0], U(S(mvp))._11); + refcnt = ID3DXConstantTable_Release(ctable); ok(refcnt == 0, "The constant table reference count was %u, should be 0\n", refcnt); }