d3dx9: Add is_param_type_sampler() helper function.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2016-05-23 13:40:55 +03:00 committed by Alexandre Julliard
parent 4786f53ef8
commit dca016d7dc
2 changed files with 10 additions and 9 deletions

View File

@ -108,6 +108,13 @@ const char *debug_d3dxparameter_registerset(D3DXREGISTER_SET r) DECLSPEC_HIDDEN;
void set_number(void *outdata, D3DXPARAMETER_TYPE outtype,
const void *indata, D3DXPARAMETER_TYPE intype) DECLSPEC_HIDDEN;
static inline BOOL is_param_type_sampler(D3DXPARAMETER_TYPE type)
{
return type == D3DXPT_SAMPLER
|| type == D3DXPT_SAMPLER1D || type == D3DXPT_SAMPLER2D
|| type == D3DXPT_SAMPLER3D || type == D3DXPT_SAMPLERCUBE;
}
struct d3dx_parameter;
enum pres_reg_tables

View File

@ -1326,9 +1326,7 @@ static HRESULT d3dx9_base_effect_set_value(struct d3dx9_base_effect *base,
}
/* samplers don't touch data */
if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
|| param->type == D3DXPT_SAMPLER1D || param->type == D3DXPT_SAMPLER2D
|| param->type == D3DXPT_SAMPLER3D || param->type == D3DXPT_SAMPLERCUBE))
if (param->class == D3DXPC_OBJECT && is_param_type_sampler(param->type))
{
TRACE("Sampler: returning E_FAIL\n");
return E_FAIL;
@ -1391,9 +1389,7 @@ static HRESULT d3dx9_base_effect_get_value(struct d3dx9_base_effect *base,
}
/* samplers don't touch data */
if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
|| param->type == D3DXPT_SAMPLER1D || param->type == D3DXPT_SAMPLER2D
|| param->type == D3DXPT_SAMPLER3D || param->type == D3DXPT_SAMPLERCUBE))
if (param->class == D3DXPC_OBJECT && is_param_type_sampler(param->type))
{
TRACE("Sampler: returning E_FAIL\n");
return E_FAIL;
@ -2743,9 +2739,7 @@ static HRESULT d3dx_set_shader_constants(struct ID3DXEffectImpl *effect, struct
ret = D3D_OK;
for (i = 0; i < parameters_count; ++i)
{
if (params[i] && params[i]->class == D3DXPC_OBJECT && (params[i]->type == D3DXPT_SAMPLER
|| params[i]->type == D3DXPT_SAMPLER1D || params[i]->type == D3DXPT_SAMPLER2D
|| params[i]->type == D3DXPT_SAMPLER3D || params[i]->type == D3DXPT_SAMPLERCUBE))
if (params[i] && params[i]->class == D3DXPC_OBJECT && is_param_type_sampler(params[i]->type))
{
struct d3dx_sampler *sampler;