Commit 823d1fbc authored by Rico Schüller's avatar Rico Schüller Committed by Alexandre Julliard

d3dx9: Move bool cropping into helper function.

parent 65c651e3
...@@ -1649,8 +1649,6 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHA ...@@ -1649,8 +1649,6 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHA
if (param && !param->element_count && param->rows == 1 && param->columns == 1) if (param && !param->element_count && param->rows == 1 && param->columns == 1)
{ {
/* crop input */
b = b != 0;
set_number(param->data, param->type, &b, D3DXPT_BOOL); set_number(param->data, param->type, &b, D3DXPT_BOOL);
return D3D_OK; return D3D_OK;
} }
...@@ -1699,7 +1697,8 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D ...@@ -1699,7 +1697,8 @@ static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D
case D3DXPC_MATRIX_ROWS: case D3DXPC_MATRIX_ROWS:
for (i = 0; i < size; ++i) for (i = 0; i < size; ++i)
{ {
set_number((DWORD *)param->data + i, param->type, &b[i], D3DXPT_BOOL); /* don't crop the input, use D3DXPT_INT instead of D3DXPT_BOOL */
set_number((DWORD *)param->data + i, param->type, &b[i], D3DXPT_INT);
} }
return D3D_OK; return D3D_OK;
......
...@@ -271,6 +271,11 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) ...@@ -271,6 +271,11 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r)
#undef WINE_D3DX_TO_STR #undef WINE_D3DX_TO_STR
/* parameter type conversion helpers */ /* parameter type conversion helpers */
BOOL get_bool(LPCVOID data)
{
return (*(DWORD *)data) != 0;
}
INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
{ {
INT i; INT i;
...@@ -286,7 +291,7 @@ INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data) ...@@ -286,7 +291,7 @@ INT get_int(D3DXPARAMETER_TYPE type, LPCVOID data)
break; break;
case D3DXPT_BOOL: case D3DXPT_BOOL:
i = *(BOOL *)data; i = get_bool(data);
break; break;
default: default:
...@@ -313,7 +318,7 @@ FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) ...@@ -313,7 +318,7 @@ FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
break; break;
case D3DXPT_BOOL: case D3DXPT_BOOL:
f = *(BOOL *)data; f = get_bool(data);
break; break;
default: default:
...@@ -325,15 +330,16 @@ FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data) ...@@ -325,15 +330,16 @@ FLOAT get_float(D3DXPARAMETER_TYPE type, LPCVOID data)
return f; return f;
} }
BOOL get_bool(LPCVOID data)
{
return (*(DWORD *)data) != 0;
}
void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype) void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID indata, D3DXPARAMETER_TYPE intype)
{ {
TRACE("Changing from type %s to type %s\n", debug_d3dxparameter_type(intype), debug_d3dxparameter_type(outtype)); TRACE("Changing from type %s to type %s\n", debug_d3dxparameter_type(intype), debug_d3dxparameter_type(outtype));
if (outtype == intype)
{
*(DWORD *)outdata = *(DWORD *)indata;
return;
}
switch (outtype) switch (outtype)
{ {
case D3DXPT_FLOAT: case D3DXPT_FLOAT:
......
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