d3dx9: Implement ID3DXConstantTable::SetMatrixTransposePointerArray.
This commit is contained in:
parent
9fec159abc
commit
cda7633775
|
@ -1138,10 +1138,21 @@ static HRESULT set_matrix_pointer_array(ID3DXConstantTable *iface, IDirect3DDevi
|
|||
else if (desc.Class == D3DXPC_VECTOR)
|
||||
{
|
||||
registers_per_matrix = 1;
|
||||
column_offset = 1;
|
||||
row_offset = 4;
|
||||
num_rows = desc.Rows;
|
||||
num_columns = desc.Columns;
|
||||
|
||||
if (class == D3DXPC_MATRIX_ROWS)
|
||||
{
|
||||
column_offset = 1;
|
||||
row_offset = 4;
|
||||
num_rows = desc.Rows;
|
||||
num_columns = desc.Columns;
|
||||
}
|
||||
else
|
||||
{
|
||||
column_offset = 4;
|
||||
row_offset = 1;
|
||||
num_rows = desc.Columns;
|
||||
num_columns = desc.Rows;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1366,9 +1377,9 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixTransposePointerArray(ID3D
|
|||
{
|
||||
struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
|
||||
|
||||
FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
|
||||
TRACE("(%p)->(%p, %p, %p, %d)\n", This, device, constant, matrix, count);
|
||||
|
||||
return E_NOTIMPL;
|
||||
return set_matrix_pointer_array(iface, device, constant, matrix, count, D3DXPC_MATRIX_COLUMNS);
|
||||
}
|
||||
|
||||
static const struct ID3DXConstantTableVtbl ID3DXConstantTable_Vtbl =
|
||||
|
|
|
@ -734,6 +734,27 @@ static void test_setting_basic_table(IDirect3DDevice9 *device)
|
|||
out[0], out[1], out[2], out[3],
|
||||
U(S(mvp))._11, U(S(mvp))._12, U(S(mvp))._13, U(S(mvp))._14);
|
||||
|
||||
memset(out, 0, sizeof(out));
|
||||
IDirect3DDevice9_SetVertexShaderConstantF(device, 6, out, 1);
|
||||
res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "f", matrix_pointer, 1);
|
||||
ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable f: got %#x\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_SetMatrixTransposePointerArray, "
|
||||
"got %f, should be %f\n",
|
||||
out[0], U(S(mvp))._11);
|
||||
|
||||
res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "f4", matrix_pointer, 1);
|
||||
ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable f4: got %#x\n", res);
|
||||
|
||||
IDirect3DDevice9_GetVertexShaderConstantF(device, 7, out, 1);
|
||||
ok(out[0] == U(S(mvp))._11 && out[1] == U(S(mvp))._21 && out[2] == U(S(mvp))._31 && out[3] == U(S(mvp))._41,
|
||||
"The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixTransposePointerArray, "
|
||||
"got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}\n",
|
||||
out[0], out[1], out[2], out[3],
|
||||
U(S(mvp))._11, U(S(mvp))._21, U(S(mvp))._31, U(S(mvp))._41);
|
||||
|
||||
refcnt = ID3DXConstantTable_Release(ctable);
|
||||
ok(refcnt == 0, "The constant table reference count was %u, should be 0\n", refcnt);
|
||||
}
|
||||
|
@ -927,6 +948,35 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device)
|
|||
S(U(fmatrix))._11, S(U(fmatrix))._12, S(U(fmatrix))._13, 0.0f,
|
||||
S(U(fmatrix))._21, S(U(fmatrix))._22, S(U(fmatrix))._23, 0.0f);
|
||||
|
||||
/* SetMatrixTransposePointerArray */
|
||||
res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "c2x3", matrix_pointer, 1);
|
||||
ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray failed on variable c2x3: got %#x\n", res);
|
||||
|
||||
res = ID3DXConstantTable_SetMatrixTransposePointerArray(ctable, device, "r2x3", matrix_pointer, 1);
|
||||
ok(res == D3D_OK, "ID3DXConstantTable_SetMatrixTransposePointerArray 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue