[PATCH v2 1/4] wined3d: Fix SM4 pixel shader output registers mapping.

Józef Kucia jkucia at codeweavers.com
Tue Mar 1 15:19:59 CST 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
AFAIK the output registers are used just for color output. There are
separate registers for depth and coverage: oDepth and oMask.
An output signature entry for SV_Depth and SV_Coverage has the register_idx
field set to 0xffffffff.

The removed WINED3D_SV_TARGET[0-7] and WINED3D_SV_DEPTH
correspond to register_idx in output signatures.

Version 2:
* Avoid semantic name comparision.
* Remove WINED3D_SV_TARGET[0-7] and WINED3D_SV_DEPTH.
---
 dlls/wined3d/shader_sm4.c | 42 +++++-------------------------------------
 include/wine/wined3d.h    | 10 ----------
 2 files changed, 5 insertions(+), 47 deletions(-)

diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 45bd9f0..a741f66 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -266,11 +266,7 @@ struct wined3d_sm4_data
     struct wined3d_shader_version shader_version;
     const DWORD *end;
 
-    struct
-    {
-        enum wined3d_shader_register_type register_type;
-        UINT register_idx;
-    } output_map[MAX_REG_OUTPUT];
+    unsigned int output_map[MAX_REG_OUTPUT];
 
     struct wined3d_shader_src_param src_param[5];
     struct wined3d_shader_dst_param dst_param[2];
@@ -287,13 +283,6 @@ struct wined3d_sm4_opcode_info
     const char *src_info;
 };
 
-struct sysval_map
-{
-    enum wined3d_sysval_semantic sysval;
-    enum wined3d_shader_register_type register_type;
-    UINT register_idx;
-};
-
 /*
  * F -> WINED3D_DATA_FLOAT
  * I -> WINED3D_DATA_INT
@@ -429,19 +418,6 @@ static const enum wined3d_primitive_type input_primitive_type_table[] =
     /* WINED3D_SM4_INPUT_PT_TRIANGLEADJ */      WINED3D_PT_TRIANGLELIST_ADJ,
 };
 
-static const struct sysval_map sysval_map[] =
-{
-    {WINED3D_SV_DEPTH,      WINED3DSPR_DEPTHOUT,    0},
-    {WINED3D_SV_TARGET0,    WINED3DSPR_COLOROUT,    0},
-    {WINED3D_SV_TARGET1,    WINED3DSPR_COLOROUT,    1},
-    {WINED3D_SV_TARGET2,    WINED3DSPR_COLOROUT,    2},
-    {WINED3D_SV_TARGET3,    WINED3DSPR_COLOROUT,    3},
-    {WINED3D_SV_TARGET4,    WINED3DSPR_COLOROUT,    4},
-    {WINED3D_SV_TARGET5,    WINED3DSPR_COLOROUT,    5},
-    {WINED3D_SV_TARGET6,    WINED3DSPR_COLOROUT,    6},
-    {WINED3D_SV_TARGET7,    WINED3DSPR_COLOROUT,    7},
-};
-
 static const enum wined3d_shader_resource_type resource_type_table[] =
 {
     /* 0 */                                         WINED3D_SHADER_RESOURCE_NONE,
@@ -496,8 +472,8 @@ static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_sha
                     break;
                 }
 
-                reg->type = priv->output_map[reg_idx].register_type;
-                reg->idx[0].offset = priv->output_map[reg_idx].register_idx;
+                reg->type = WINED3DSPR_COLOROUT;
+                reg->idx[0].offset = priv->output_map[reg_idx];
             }
             break;
 
@@ -529,7 +505,7 @@ static enum wined3d_data_type map_data_type(char t)
 static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature)
 {
     struct wined3d_sm4_data *priv;
-    unsigned int i, j;
+    unsigned int i;
 
     if (!(priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv))))
     {
@@ -548,15 +524,7 @@ static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader
             continue;
         }
 
-        for (j = 0; j < ARRAY_SIZE(sysval_map); ++j)
-        {
-            if (e->sysval_semantic == sysval_map[j].sysval)
-            {
-                priv->output_map[e->register_idx].register_type = sysval_map[j].register_type;
-                priv->output_map[e->register_idx].register_idx = sysval_map[j].register_idx;
-                break;
-            }
-        }
+        priv->output_map[e->register_idx] = e->semantic_idx;
     }
 
     list_init(&priv->src_free);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 1af0d52..a4b2a30 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -752,16 +752,6 @@ enum wined3d_sysval_semantic
     WINED3D_SV_INSTANCEID = 8,
     WINED3D_SV_ISFRONTFACE = 9,
     WINED3D_SV_SAMPLEINDEX = 10,
-
-    WINED3D_SV_DEPTH = 0xffffffff,
-    WINED3D_SV_TARGET0 = 0,
-    WINED3D_SV_TARGET1 = 1,
-    WINED3D_SV_TARGET2 = 2,
-    WINED3D_SV_TARGET3 = 3,
-    WINED3D_SV_TARGET4 = 4,
-    WINED3D_SV_TARGET5 = 5,
-    WINED3D_SV_TARGET6 = 6,
-    WINED3D_SV_TARGET7 = 7,
 };
 
 enum wined3d_scanline_ordering
-- 
2.4.10




More information about the wine-patches mailing list