=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3dx9: Improve ID3DXConstantTable:: SetDefaults().
Alexandre Julliard
julliard at winehq.org
Mon Jul 29 14:01:19 CDT 2013
Module: wine
Branch: master
Commit: 1099bb5e76de05718e3cbd43a3d0326883f39cfe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1099bb5e76de05718e3cbd43a3d0326883f39cfe
Author: Rico Schüller <kgbricola at web.de>
Date: Mon Jul 29 11:13:54 2013 +0200
d3dx9: Improve ID3DXConstantTable::SetDefaults().
---
dlls/d3dx9_36/shader.c | 53 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 457036b..16395e8 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -750,15 +750,6 @@ static inline struct ctab_constant *get_valid_constant(struct ID3DXConstantTable
return get_constant_by_name(table, NULL, handle);
}
-static inline void set_float_shader_constant(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device,
- UINT register_index, const FLOAT *data, UINT count)
-{
- if (is_vertex_shader(table->desc.Version))
- IDirect3DDevice9_SetVertexShaderConstantF(device, register_index, data, count);
- else
- IDirect3DDevice9_SetPixelShaderConstantF(device, register_index, data, count);
-}
-
/*** IUnknown methods ***/
static HRESULT WINAPI ID3DXConstantTableImpl_QueryInterface(ID3DXConstantTable *iface, REFIID riid, void **out)
{
@@ -1434,19 +1425,59 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetDefaults(struct ID3DXConstantTab
struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
UINT i;
- TRACE("(%p)->(%p)\n", This, device);
+ TRACE("iface %p, device %p\n", iface, device);
if (!device)
+ {
+ WARN("Invalid argument specified\n");
return D3DERR_INVALIDCALL;
+ }
for (i = 0; i < This->desc.Constants; i++)
{
D3DXCONSTANT_DESC *desc = &This->constants[i].desc;
+ HRESULT hr;
if (!desc->DefaultValue)
continue;
- set_float_shader_constant(This, device, desc->RegisterIndex, desc->DefaultValue, desc->RegisterCount);
+ switch (desc->RegisterSet)
+ {
+ case D3DXRS_BOOL:
+ if (is_vertex_shader(This->desc.Version))
+ hr = IDirect3DDevice9_SetVertexShaderConstantB(device, desc->RegisterIndex, desc->DefaultValue,
+ desc->RegisterCount);
+ else
+ hr = IDirect3DDevice9_SetPixelShaderConstantB(device, desc->RegisterIndex, desc->DefaultValue,
+ desc->RegisterCount);
+ break;
+
+ case D3DXRS_INT4:
+ if (is_vertex_shader(This->desc.Version))
+ hr = IDirect3DDevice9_SetVertexShaderConstantI(device, desc->RegisterIndex, desc->DefaultValue,
+ desc->RegisterCount);
+ else
+ hr = IDirect3DDevice9_SetPixelShaderConstantI(device, desc->RegisterIndex, desc->DefaultValue,
+ desc->RegisterCount);
+ break;
+
+ case D3DXRS_FLOAT4:
+ if (is_vertex_shader(This->desc.Version))
+ hr = IDirect3DDevice9_SetVertexShaderConstantF(device, desc->RegisterIndex, desc->DefaultValue,
+ desc->RegisterCount);
+ else
+ hr = IDirect3DDevice9_SetPixelShaderConstantF(device, desc->RegisterIndex, desc->DefaultValue,
+ desc->RegisterCount);
+ break;
+
+ default:
+ FIXME("Unhandled register set %s\n", debug_d3dxparameter_registerset(desc->RegisterSet));
+ hr = E_NOTIMPL;
+ break;
+ }
+
+ if (hr != D3D_OK)
+ return hr;
}
return D3D_OK;
More information about the wine-cvs
mailing list