Commit d2bbbc71 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3dx9: Implement ID3DXConstantTable::SetBool.

parent 98fe3f1d
...@@ -857,7 +857,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantElement(ID3DXConstant ...@@ -857,7 +857,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantElement(ID3DXConstant
return NULL; return NULL;
} }
static HRESULT set_float_array(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, D3DXHANDLE constant, const void *data, static HRESULT set_scalar_array(ID3DXConstantTable *iface, IDirect3DDevice9 *device, D3DXHANDLE constant, const void *data,
UINT count, D3DXPARAMETER_TYPE type) UINT count, D3DXPARAMETER_TYPE type)
{ {
struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface); struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
...@@ -876,7 +876,7 @@ static HRESULT set_float_array(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 devi ...@@ -876,7 +876,7 @@ static HRESULT set_float_array(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 devi
switch (desc.RegisterSet) switch (desc.RegisterSet)
{ {
case D3DXRS_FLOAT4: case D3DXRS_FLOAT4:
for (i = 0; i < count && i < desc.RegisterCount; i++) for (i = 0; i < min(count, desc.RegisterCount); i++)
{ {
/* We need the for loop since each IDirect3DDevice9_Set*ShaderConstantF expects a float4 */ /* We need the for loop since each IDirect3DDevice9_Set*ShaderConstantF expects a float4 */
switch(type) switch(type)
...@@ -887,8 +887,11 @@ static HRESULT set_float_array(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 devi ...@@ -887,8 +887,11 @@ static HRESULT set_float_array(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 devi
case D3DXPT_INT: case D3DXPT_INT:
row[0] = (float)((int *)data)[i]; row[0] = (float)((int *)data)[i];
break; break;
case D3DXPT_BOOL:
row[0] = ((BOOL *)data)[i] ? 1.0f : 0.0f;
break;
default: default:
FIXME("Unhandled type passed to set_float_array\n"); FIXME("Unhandled type %#x\n", type);
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }
set_float_shader_constant(This, device, desc.RegisterIndex + i, row, 1); set_float_shader_constant(This, device, desc.RegisterIndex + i, row, 1);
...@@ -940,9 +943,9 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetBool(ID3DXConstantTable *iface, ...@@ -940,9 +943,9 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetBool(ID3DXConstantTable *iface,
{ {
struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface); struct ID3DXConstantTableImpl *This = impl_from_ID3DXConstantTable(iface);
FIXME("(%p)->(%p, %p, %d): stub\n", This, device, constant, b); TRACE("(%p)->(%p, %p, %d)\n", This, device, constant, b);
return E_NOTIMPL; return set_scalar_array(iface, device, constant, &b, 1, D3DXPT_BOOL);
} }
static HRESULT WINAPI ID3DXConstantTableImpl_SetBoolArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, static HRESULT WINAPI ID3DXConstantTableImpl_SetBoolArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
...@@ -961,7 +964,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetInt(ID3DXConstantTable *iface, L ...@@ -961,7 +964,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetInt(ID3DXConstantTable *iface, L
TRACE("(%p)->(%p, %p, %d)\n", This, device, constant, n); TRACE("(%p)->(%p, %p, %d)\n", This, device, constant, n);
return ID3DXConstantTable_SetIntArray(iface, device, constant, &n, 1); return set_scalar_array(iface, device, constant, &n, 1, D3DXPT_INT);
} }
static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
...@@ -971,7 +974,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable *ifa ...@@ -971,7 +974,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetIntArray(ID3DXConstantTable *ifa
TRACE("(%p)->(%p, %p, %p, %d)\n", This, device, constant, n, count); TRACE("(%p)->(%p, %p, %p, %d)\n", This, device, constant, n, count);
return set_float_array(iface, device, constant, n, count, D3DXPT_INT); return set_scalar_array(iface, device, constant, n, count, D3DXPT_INT);
} }
static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
...@@ -981,7 +984,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable *iface, ...@@ -981,7 +984,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetFloat(ID3DXConstantTable *iface,
TRACE("(%p)->(%p, %p, %f)\n", This, device, constant, f); TRACE("(%p)->(%p, %p, %f)\n", This, device, constant, f);
return ID3DXConstantTable_SetFloatArray(iface, device, constant, &f, 1); return set_scalar_array(iface, device, constant, &f, 1, D3DXPT_FLOAT);
} }
static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
...@@ -991,7 +994,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable *i ...@@ -991,7 +994,7 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetFloatArray(ID3DXConstantTable *i
TRACE("(%p)->(%p, %p, %p, %d)\n", This, device, constant, f, count); TRACE("(%p)->(%p, %p, %p, %d)\n", This, device, constant, f, count);
return set_float_array(iface, device, constant, f, count, D3DXPT_FLOAT); return set_scalar_array(iface, device, constant, f, count, D3DXPT_FLOAT);
} }
static HRESULT WINAPI ID3DXConstantTableImpl_SetVector(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device, static HRESULT WINAPI ID3DXConstantTableImpl_SetVector(ID3DXConstantTable *iface, LPDIRECT3DDEVICE9 device,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment