[PATCH 1/3] d3dx9: Add is_param_type_sampler() helper function.

Paul Gofman gofmanp at gmail.com
Fri May 20 14:04:33 CDT 2016


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/d3dx9_36/d3dx9_private.h |  7 +++++++
 dlls/d3dx9_36/effect.c        | 12 +++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h
index a0e62f1..9938d83 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 823f79f..31aa2d6 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;
 
-- 
2.5.5




More information about the wine-patches mailing list