=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Implement temporary registers per phase.

Alexandre Julliard julliard at winehq.org
Mon May 22 15:54:03 CDT 2017


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Sat May 20 13:46:03 2017 +0200

wined3d: Implement temporary registers per phase.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/glsl_shader.c     |  3 +++
 dlls/wined3d/shader.c          | 22 ++++++++++++++++------
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index dd96703..27f089f 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -7509,10 +7509,13 @@ static HRESULT shader_glsl_generate_shader_phase(const struct wined3d_shader *sh
         struct shader_glsl_ctx_priv *priv_ctx, const struct wined3d_shader_phase *phase,
         const char *phase_name, unsigned phase_idx)
 {
+    unsigned int i;
     HRESULT hr;
 
     shader_addline(buffer, "void hs_%s_phase%u(%s)\n{\n",
             phase_name, phase_idx, phase->instance_count ? "int phase_instance_id" : "");
+    for (i = 0; i < phase->temporary_count; ++i)
+        shader_addline(buffer, "vec4 R%u;\n", i);
     hr = shader_generate_code(shader, buffer, reg_maps, priv_ctx, phase->start, phase->end);
     shader_addline(buffer, "}\n");
     return hr;
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index a4d3a59..74cb92e 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1105,13 +1105,20 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
         }
         else if (ins.handler_idx == WINED3DSIH_DCL_INDEXABLE_TEMP)
         {
-            struct wined3d_shader_indexable_temp *reg;
+            if (phase)
+            {
+                FIXME("Indexable temporary registers not supported.\n");
+            }
+            else
+            {
+                struct wined3d_shader_indexable_temp *reg;
 
-            if (!(reg = HeapAlloc(GetProcessHeap(), 0, sizeof(*reg))))
-                return E_OUTOFMEMORY;
+                if (!(reg = HeapAlloc(GetProcessHeap(), 0, sizeof(*reg))))
+                    return E_OUTOFMEMORY;
 
-            *reg = ins.declaration.indexable_temp;
-            list_add_tail(&reg_maps->indexable_temps, &reg->entry);
+                *reg = ins.declaration.indexable_temp;
+                list_add_tail(&reg_maps->indexable_temps, &reg->entry);
+            }
         }
         else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE)
         {
@@ -1168,7 +1175,10 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
         }
         else if (ins.handler_idx == WINED3DSIH_DCL_TEMPS)
         {
-            reg_maps->temporary_count = ins.declaration.count;
+            if (phase)
+                phase->temporary_count = ins.declaration.count;
+            else
+                reg_maps->temporary_count = ins.declaration.count;
         }
         else if (ins.handler_idx == WINED3DSIH_DCL_TESSELLATOR_DOMAIN)
         {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d177976..4f2916b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3738,6 +3738,7 @@ struct wined3d_shader_phase
     const DWORD *start;
     const DWORD *end;
     unsigned int instance_count;
+    unsigned int temporary_count;
 };
 
 struct wined3d_vertex_shader




More information about the wine-cvs mailing list