Travis Athougies : d3dx9_36: Implemented ID3DXConstantTable_SetMatrix and ID3DXConstantTable_SetMatrixArray .
Alexandre Julliard
julliard at winehq.org
Wed Jun 22 11:48:42 CDT 2011
Module: wine
Branch: master
Commit: 4a412c1b83de1e1d137f036e49b3c0f3d5f88076
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4a412c1b83de1e1d137f036e49b3c0f3d5f88076
Author: Travis Athougies <iammisc at gmail.com>
Date: Tue Jun 21 12:14:33 2011 -0700
d3dx9_36: Implemented ID3DXConstantTable_SetMatrix and ID3DXConstantTable_SetMatrixArray.
---
dlls/d3dx9_36/shader.c | 51 ++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 6448e65..0e0709d 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -980,24 +980,59 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetVectorArray(ID3DXConstantTable *
return D3D_OK;
}
-static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
- D3DXHANDLE constant, CONST D3DXMATRIX* matrix)
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrix(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
+ D3DXHANDLE constant, CONST D3DXMATRIX *matrix)
{
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 ID3DXConstantTable_SetMatrixArray(iface, device, constant, matrix, 1);
}
-static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
- D3DXHANDLE constant, CONST D3DXMATRIX* matrix, UINT count)
+static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
+ D3DXHANDLE constant, CONST D3DXMATRIX *matrix, UINT count)
{
ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
- FIXME("(%p)->(%p, %p, %p, %d): stub\n", This, device, constant, matrix, count);
+ D3DXCONSTANT_DESC desc;
+ HRESULT hr;
+ UINT i, desc_count = 1;
+ D3DXMATRIX temp;
- return E_NOTIMPL;
+ 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", 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]);
+
+ if (is_vertex_shader(This->desc.Version))
+ IDirect3DDevice9_SetVertexShaderConstantF(device, desc.RegisterIndex + i * 4, &temp._11, 4);
+ else
+ IDirect3DDevice9_SetPixelShaderConstantF(device, desc.RegisterIndex + i * 4, &temp._11, 4);
+ }
+ break;
+ default:
+ FIXME("Handle other register sets\n");
+ return E_NOTIMPL;
+ }
+
+ return D3D_OK;
}
static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray(ID3DXConstantTable* iface, LPDIRECT3DDEVICE9 device,
More information about the wine-cvs
mailing list