Paul Gofman : d3dx9: Support arrays of samplers.

Alexandre Julliard julliard at winehq.org
Wed Jul 5 15:41:02 CDT 2017


Module: wine
Branch: master
Commit: 8f9bbdf9ad38985f499943eafe81764579c16778
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8f9bbdf9ad38985f499943eafe81764579c16778

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Wed Jun 28 14:28:23 2017 +0300

d3dx9: Support arrays of samplers.

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/effect.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index e9b139e..c3647d3 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -2928,15 +2928,20 @@ static HRESULT d3dx_set_shader_constants(struct ID3DXEffectImpl *effect, struct
         if (params[i] && params[i]->class == D3DXPC_OBJECT && is_param_type_sampler(params[i]->type))
         {
             struct d3dx_sampler *sampler;
+            unsigned int sampler_idx;
 
-            sampler = (struct d3dx_sampler *)params[i]->data;
-            TRACE("sampler %s, register index %u, state count %u.\n", debugstr_a(params[i]->name),
-                    cdesc[i].RegisterIndex, sampler->state_count);
-            for (j = 0; j < sampler->state_count; ++j)
+            for (sampler_idx = 0; sampler_idx < cdesc[i].RegisterCount; ++sampler_idx)
             {
-                if (FAILED(hr = d3dx9_apply_state(effect, pass, &sampler->states[j],
-                        cdesc[i].RegisterIndex + (vs ? D3DVERTEXTEXTURESAMPLER0 : 0), update_all)))
-                    ret = hr;
+                sampler = params[i]->element_count ? params[i]->members[sampler_idx].data : params[i]->data;
+                TRACE("sampler %s, register index %u, state count %u.\n", debugstr_a(params[i]->name),
+                        cdesc[i].RegisterIndex, sampler->state_count);
+                for (j = 0; j < sampler->state_count; ++j)
+                {
+                    if (FAILED(hr = d3dx9_apply_state(effect, pass, &sampler->states[j],
+                            cdesc[i].RegisterIndex + sampler_idx + (vs ? D3DVERTEXTEXTURESAMPLER0 : 0),
+                            update_all)))
+                        ret = hr;
+                }
             }
         }
     }
@@ -4000,12 +4005,17 @@ static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_
     if (param->class == D3DXPC_OBJECT && is_param_type_sampler(param->type))
     {
         struct d3dx_sampler *sampler;
+        unsigned int sampler_idx;
+        unsigned int samplers_count = max(param->element_count, 1);
 
-        sampler = (struct d3dx_sampler *)param->data;
-        for (i = 0; i < sampler->state_count; ++i)
+        for (sampler_idx = 0; sampler_idx < samplers_count; ++sampler_idx)
         {
-            if (walk_state_dep(&sampler->states[i], param_func, data))
-                return TRUE;
+            sampler = param->element_count ? param->members[sampler_idx].data : param->data;
+            for (i = 0; i < sampler->state_count; ++i)
+            {
+                if (walk_state_dep(&sampler->states[i], param_func, data))
+                    return TRUE;
+            }
         }
         return FALSE;
     }




More information about the wine-cvs mailing list