diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h index a0e62f1b881..9938d83a70a 100644 --- a/dlls/d3dx9_36/d3dx9_private.h +++ b/dlls/d3dx9_36/d3dx9_private.h @@ -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 diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index da7de540e50..7d5e612c3bc 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -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;