[PATCH v2 2/5] wined3d: Get rid of unnecessary enum wined3d_data_type values.

Matteo Bruni mbruni at codeweavers.com
Wed Jun 20 17:48:23 CDT 2018


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
v2: Restore _UNORM and _SNORM for semantics / declarations.

 dlls/wined3d/glsl_shader.c     |  8 --------
 dlls/wined3d/shader.c          |  4 ----
 dlls/wined3d/shader_sm4.c      | 44 ++++++++++++++++++------------------------
 dlls/wined3d/wined3d_private.h |  4 ----
 4 files changed, 19 insertions(+), 41 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 86259ae4755..f1f3020d53d 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3093,8 +3093,6 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
                         case WINED3D_DATA_INT:
                             sprintf(register_name, "%#x", reg->u.immconst_data[0]);
                             break;
-                        case WINED3D_DATA_RESOURCE:
-                        case WINED3D_DATA_SAMPLER:
                         case WINED3D_DATA_UINT:
                             sprintf(register_name, "%#xu", reg->u.immconst_data[0]);
                             break;
@@ -3129,8 +3127,6 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
                                     reg->u.immconst_data[0], reg->u.immconst_data[1],
                                     reg->u.immconst_data[2], reg->u.immconst_data[3]);
                             break;
-                        case WINED3D_DATA_RESOURCE:
-                        case WINED3D_DATA_SAMPLER:
                         case WINED3D_DATA_UINT:
                             sprintf(register_name, "uvec4(%#xu, %#xu, %#xu, %#xu)",
                                     reg->u.immconst_data[0], reg->u.immconst_data[1],
@@ -3342,8 +3338,6 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
             case WINED3D_DATA_INT:
                 string_buffer_sprintf(dst_param, "floatBitsToInt(%s)", src_param);
                 return;
-            case WINED3D_DATA_RESOURCE:
-            case WINED3D_DATA_SAMPLER:
             case WINED3D_DATA_UINT:
                 string_buffer_sprintf(dst_param, "floatBitsToUint(%s)", src_param);
                 return;
@@ -3457,8 +3451,6 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer,
                 shader_addline(buffer, "%s%s = %sintBitsToFloat(",
                         glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
                 break;
-            case WINED3D_DATA_RESOURCE:
-            case WINED3D_DATA_SAMPLER:
             case WINED3D_DATA_UINT:
                 shader_addline(buffer, "%s%s = %suintBitsToFloat(",
                         glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 20d4f0773dd..44879f8b7c4 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2448,8 +2448,6 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
                     case WINED3D_DATA_INT:
                         shader_addline(buffer, "%d", reg->u.immconst_data[0]);
                         break;
-                    case WINED3D_DATA_RESOURCE:
-                    case WINED3D_DATA_SAMPLER:
                     case WINED3D_DATA_UINT:
                         shader_addline(buffer, "%u", reg->u.immconst_data[0]);
                         break;
@@ -2472,8 +2470,6 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
                                 reg->u.immconst_data[0], reg->u.immconst_data[1],
                                 reg->u.immconst_data[2], reg->u.immconst_data[3]);
                         break;
-                    case WINED3D_DATA_RESOURCE:
-                    case WINED3D_DATA_SAMPLER:
                     case WINED3D_DATA_UINT:
                         shader_addline(buffer, "%u, %u, %u, %u",
                                 reg->u.immconst_data[0], reg->u.immconst_data[1],
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index b119e8feaa8..acde7a56d1c 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -565,8 +565,8 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
 {
     enum wined3d_sm4_resource_type resource_type;
     enum wined3d_sm4_data_type data_type;
-    enum wined3d_data_type reg_data_type;
     DWORD components;
+    BOOL uav;
 
     resource_type = (opcode_token & WINED3D_SM4_RESOURCE_TYPE_MASK) >> WINED3D_SM4_RESOURCE_TYPE_SHIFT;
     if (!resource_type || (resource_type >= ARRAY_SIZE(resource_type_table)))
@@ -578,8 +578,8 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
     {
         ins->declaration.semantic.resource_type = resource_type_table[resource_type];
     }
-    reg_data_type = opcode == WINED3D_SM4_OP_DCL_RESOURCE ? WINED3D_DATA_RESOURCE : WINED3D_DATA_UAV;
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], reg_data_type, &ins->declaration.semantic.reg);
+    uav = opcode != WINED3D_SM4_OP_DCL_RESOURCE;
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.semantic.reg);
 
     components = *tokens++;
     if ((components & 0xfff0) != (components & 0xf) * 0x1110)
@@ -596,7 +596,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
         ins->declaration.semantic.resource_data_type = data_type_table[data_type];
     }
 
-    if (reg_data_type == WINED3D_DATA_UAV)
+    if (uav)
         ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
 }
 
@@ -616,14 +616,14 @@ static void shader_sm4_read_dcl_sampler(struct wined3d_shader_instruction *ins,
     ins->flags = (opcode_token & WINED3D_SM4_SAMPLER_MODE_MASK) >> WINED3D_SM4_SAMPLER_MODE_SHIFT;
     if (ins->flags & ~WINED3D_SM4_SAMPLER_COMPARISON)
         FIXME("Unhandled sampler mode %#x.\n", ins->flags);
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_SAMPLER, &ins->declaration.dst);
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
 }
 
 static void shader_sm4_read_dcl_index_range(struct wined3d_shader_instruction *ins,
         DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
         struct wined3d_sm4_data *priv)
 {
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_OPAQUE,
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
             &ins->declaration.index_range.first_register);
     ins->declaration.index_range.last_register = *tokens;
 }
@@ -731,7 +731,7 @@ static void shader_sm5_read_fcall(struct wined3d_shader_instruction *ins,
         struct wined3d_sm4_data *priv)
 {
     priv->src_param[0].reg.u.fp_body_idx = *tokens++;
-    shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_OPAQUE, &priv->src_param[0]);
+    shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &priv->src_param[0]);
 }
 
 static void shader_sm5_read_dcl_function_body(struct wined3d_shader_instruction *ins,
@@ -812,7 +812,7 @@ static void shader_sm5_read_dcl_uav_raw(struct wined3d_shader_instruction *ins,
         DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
         struct wined3d_sm4_data *priv)
 {
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UAV, &ins->declaration.dst);
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
     ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
 }
 
@@ -820,7 +820,7 @@ static void shader_sm5_read_dcl_uav_structured(struct wined3d_shader_instruction
         DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
         struct wined3d_sm4_data *priv)
 {
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UAV,
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
             &ins->declaration.structured_resource.reg);
     ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
     ins->declaration.structured_resource.byte_stride = *tokens;
@@ -854,7 +854,7 @@ static void shader_sm5_read_dcl_resource_structured(struct wined3d_shader_instru
         DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
         struct wined3d_sm4_data *priv)
 {
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_RESOURCE,
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
             &ins->declaration.structured_resource.reg);
     ins->declaration.structured_resource.byte_stride = *tokens;
     if (ins->declaration.structured_resource.byte_stride % 4)
@@ -865,7 +865,7 @@ static void shader_sm5_read_dcl_resource_raw(struct wined3d_shader_instruction *
         DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
         struct wined3d_sm4_data *priv)
 {
-    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_RESOURCE, &ins->declaration.dst);
+    shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
 }
 
 static void shader_sm5_read_sync(struct wined3d_shader_instruction *ins,
@@ -875,15 +875,13 @@ static void shader_sm5_read_sync(struct wined3d_shader_instruction *ins,
     ins->flags = (opcode_token & WINED3D_SM5_SYNC_FLAGS_MASK) >> WINED3D_SM5_SYNC_FLAGS_SHIFT;
 }
 
-/*
- * f -> WINED3D_DATA_FLOAT
- * i -> WINED3D_DATA_INT
- * u -> WINED3D_DATA_UINT
- * O -> WINED3D_DATA_OPAQUE
- * R -> WINED3D_DATA_RESOURCE
- * S -> WINED3D_DATA_SAMPLER
- * U -> WINED3D_DATA_UAV
- */
+/* f -> FLOAT
+ * i -> INT
+ * u -> UINT
+ * O -> OPAQUE
+ * R -> RESOURCE
+ * S -> SAMPLER
+ * U -> UAV */
 static const struct wined3d_sm4_opcode_info opcode_table[] =
 {
     {WINED3D_SM4_OP_ADD,                              WINED3DSIH_ADD,                              "f",    "ff"},
@@ -1207,15 +1205,11 @@ static enum wined3d_data_type map_data_type(char t)
         case 'i':
             return WINED3D_DATA_INT;
         case 'u':
-            return WINED3D_DATA_UINT;
         case 'O':
-            return WINED3D_DATA_OPAQUE;
         case 'R':
-            return WINED3D_DATA_RESOURCE;
         case 'S':
-            return WINED3D_DATA_SAMPLER;
         case 'U':
-            return WINED3D_DATA_UAV;
+            return WINED3D_DATA_UINT;
         default:
             ERR("Invalid data type '%c'.\n", t);
             return WINED3D_DATA_FLOAT;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9aa70817f5d..b65288dc415 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -504,13 +504,9 @@ enum wined3d_data_type
 {
     WINED3D_DATA_FLOAT,
     WINED3D_DATA_INT,
-    WINED3D_DATA_RESOURCE,
-    WINED3D_DATA_SAMPLER,
-    WINED3D_DATA_UAV,
     WINED3D_DATA_UINT,
     WINED3D_DATA_UNORM,
     WINED3D_DATA_SNORM,
-    WINED3D_DATA_OPAQUE,
 };
 
 enum wined3d_immconst_type
-- 
2.16.4




More information about the wine-devel mailing list