=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Handle structured thread group shared memory declarations.

Alexandre Julliard julliard at winehq.org
Wed Mar 1 16:45:11 CST 2017


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Feb 28 14:42:38 2017 +0100

wined3d: Handle structured thread group shared memory declarations.

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     |  2 +-
 dlls/wined3d/shader.c          | 27 +++++++++++++++++++++++++++
 dlls/wined3d/shader_sm4.c      |  2 ++
 dlls/wined3d/wined3d_private.h |  1 +
 4 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index a034ba2..3f73201 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -9462,7 +9462,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE */ NULL,
     /* WINED3DSIH_DCL_TESSELLATOR_PARTITIONING     */ NULL,
     /* WINED3DSIH_DCL_TGSM_RAW                     */ shader_glsl_nop,
-    /* WINED3DSIH_DCL_TGSM_STRUCTURED              */ NULL,
+    /* WINED3DSIH_DCL_TGSM_STRUCTURED              */ shader_glsl_nop,
     /* WINED3DSIH_DCL_THREAD_GROUP                 */ shader_glsl_nop,
     /* WINED3DSIH_DCL_UAV_RAW                      */ shader_glsl_nop,
     /* WINED3DSIH_DCL_UAV_STRUCTURED               */ shader_glsl_nop,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 1b245d4..f79a922 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1065,6 +1065,33 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
                 reg_maps->tgsm_count = reg_idx + 1;
                 tgsm = &reg_maps->tgsm[reg_idx];
                 tgsm->size = ins.declaration.tgsm_raw.byte_count / 4;
+                tgsm->stride = 0;
+            }
+            else
+            {
+                FIXME("Invalid instruction %#x for shader type %#x.\n",
+                        ins.handler_idx, shader_version.type);
+            }
+        }
+        else if (ins.handler_idx == WINED3DSIH_DCL_TGSM_STRUCTURED)
+        {
+            unsigned int reg_idx = ins.declaration.tgsm_structured.reg.reg.idx[0].offset;
+            if (reg_idx >= MAX_TGSM_REGISTERS)
+            {
+                ERR("Invalid TGSM register index %u.\n", reg_idx);
+                break;
+            }
+            if (shader_version.type == WINED3D_SHADER_TYPE_COMPUTE)
+            {
+                struct wined3d_shader_tgsm *tgsm;
+
+                if (!wined3d_array_reserve((void **)&reg_maps->tgsm, &reg_maps->tgsm_capacity,
+                        reg_idx + 1, sizeof(*reg_maps->tgsm)))
+                    return E_OUTOFMEMORY;
+                reg_maps->tgsm_count = reg_idx + 1;
+                tgsm = &reg_maps->tgsm[reg_idx];
+                tgsm->stride = ins.declaration.tgsm_structured.byte_stride / 4;
+                tgsm->size = tgsm->stride * ins.declaration.tgsm_structured.structure_count;
             }
             else
             {
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 5cc0136..a934cdb 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -774,6 +774,8 @@ static void shader_sm5_read_dcl_tgsm_structured(struct wined3d_shader_instructio
     shader_sm4_read_dst_param(priv, &tokens, WINED3D_DATA_FLOAT, &ins->declaration.tgsm_structured.reg);
     ins->declaration.tgsm_structured.byte_stride = *tokens++;
     ins->declaration.tgsm_structured.structure_count = *tokens;
+    if (ins->declaration.tgsm_structured.byte_stride % 4)
+        FIXME("Byte stride %u is not multiple of 4.\n", ins->declaration.tgsm_structured.byte_stride);
 }
 
 static void shader_sm5_read_dcl_resource_structured(struct wined3d_shader_instruction *ins,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3d06962..675dd50 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1006,6 +1006,7 @@ struct wined3d_shader_structured_resource
 struct wined3d_shader_tgsm
 {
     unsigned int size;
+    unsigned int stride;
 };
 
 struct wined3d_shader_tgsm_raw




More information about the wine-cvs mailing list