Commit 4569cbe8 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Move set_number() into d3dx9_private.h.

parent 74d93d9b
......@@ -123,8 +123,88 @@ const char *debug_d3dxparameter_type(D3DXPARAMETER_TYPE t) DECLSPEC_HIDDEN;
const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) DECLSPEC_HIDDEN;
/* parameter type conversion helpers */
void set_number(void *outdata, D3DXPARAMETER_TYPE outtype,
const void *indata, D3DXPARAMETER_TYPE intype) DECLSPEC_HIDDEN;
static inline BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)
{
switch (type)
{
case D3DXPT_FLOAT:
case D3DXPT_INT:
case D3DXPT_BOOL:
return !!*(DWORD *)data;
case D3DXPT_VOID:
return *(BOOL *)data;
default:
return FALSE;
}
}
static inline int get_int(D3DXPARAMETER_TYPE type, const void *data)
{
switch (type)
{
case D3DXPT_FLOAT:
return (int)(*(float *)data);
case D3DXPT_INT:
case D3DXPT_VOID:
return *(int *)data;
case D3DXPT_BOOL:
return get_bool(type, data);
default:
return 0;
}
}
static inline float get_float(D3DXPARAMETER_TYPE type, const void *data)
{
switch (type)
{
case D3DXPT_FLOAT:
case D3DXPT_VOID:
return *(float *)data;
case D3DXPT_INT:
return (float)(*(int *)data);
case D3DXPT_BOOL:
return (float)get_bool(type, data);
default:
return 0.0f;
}
}
static inline void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
{
if (outtype == intype)
{
*(DWORD *)outdata = *(DWORD *)indata;
return;
}
switch (outtype)
{
case D3DXPT_FLOAT:
*(float *)outdata = get_float(intype, indata);
break;
case D3DXPT_BOOL:
*(BOOL *)outdata = get_bool(intype, indata);
break;
case D3DXPT_INT:
*(int *)outdata = get_int(intype, indata);
break;
default:
*(DWORD *)outdata = 0;
break;
}
}
static inline BOOL is_param_type_sampler(D3DXPARAMETER_TYPE type)
{
......
......@@ -291,95 +291,6 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r)
#undef WINE_D3DX_TO_STR
/* parameter type conversion helpers */
static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)
{
switch (type)
{
case D3DXPT_FLOAT:
case D3DXPT_INT:
case D3DXPT_BOOL:
return *(DWORD *)data != 0;
case D3DXPT_VOID:
return *(BOOL *)data;
default:
FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type));
return FALSE;
}
}
static INT get_int(D3DXPARAMETER_TYPE type, const void *data)
{
switch (type)
{
case D3DXPT_FLOAT:
return (INT)(*(FLOAT *)data);
case D3DXPT_INT:
case D3DXPT_VOID:
return *(INT *)data;
case D3DXPT_BOOL:
return get_bool(type, data);
default:
FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type));
return 0;
}
}
static FLOAT get_float(D3DXPARAMETER_TYPE type, const void *data)
{
switch (type)
{
case D3DXPT_FLOAT:
case D3DXPT_VOID:
return *(FLOAT *)data;
case D3DXPT_INT:
return (FLOAT)(*(INT *)data);
case D3DXPT_BOOL:
return (FLOAT)get_bool(type, data);
default:
FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(type));
return 0.0f;
}
}
void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
{
if (outtype == intype)
{
*(DWORD *)outdata = *(DWORD *)indata;
return;
}
switch (outtype)
{
case D3DXPT_FLOAT:
*(FLOAT *)outdata = get_float(intype, indata);
break;
case D3DXPT_BOOL:
*(BOOL *)outdata = get_bool(intype, indata);
break;
case D3DXPT_INT:
*(INT *)outdata = get_int(intype, indata);
break;
default:
FIXME("Unhandled type %s.\n", debug_d3dxparameter_type(outtype));
*(DWORD *)outdata = 0;
break;
}
}
/***********************************************************************
* D3DXDebugMute
* Returns always FALSE for us.
......
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