[PATCH] d3dx9: Fix register index for the scalar op case in parse_preshader().

Matteo Bruni mbruni at codeweavers.com
Thu Apr 27 17:10:15 CDT 2017


From: Paul Gofman <gofmanp at gmail.com>

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3dx9_36/preshader.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 896aca5..0f23488 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -758,9 +758,12 @@ static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, u
 
             if (pres->ins[i].inputs[j].index_reg.table == PRES_REGTAB_COUNT)
             {
+                unsigned int last_component_index = pres->ins[i].scalar_op && !j ? 0
+                        : pres->ins[i].component_count - 1;
+
                 table = pres->ins[i].inputs[j].reg.table;
                 reg_idx = get_reg_offset(table, pres->ins[i].inputs[j].reg.offset
-                        + pres->ins[i].component_count - 1);
+                        + last_component_index);
             }
             else
             {
-- 
2.10.2




More information about the wine-patches mailing list