=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d-shader: Simplify vkd3d_dxbc_compiler_get_register_id().

Alexandre Julliard julliard at winehq.org
Fri Feb 22 15:20:01 CST 2019


Module: vkd3d
Branch: master
Commit: 9c46011b4304420f9cb0715d57609a0309a9a36e
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=9c46011b4304420f9cb0715d57609a0309a9a36e

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Feb 21 12:32:49 2019 +0100

vkd3d-shader: Simplify vkd3d_dxbc_compiler_get_register_id().

Special casing is not needed.

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>

---

 libs/vkd3d-shader/spirv.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 2c58a47..510fcd3 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -2605,40 +2605,14 @@ static uint32_t vkd3d_dxbc_compiler_get_register_id(struct vkd3d_dxbc_compiler *
     struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
     struct vkd3d_shader_register_info register_info;
 
-    switch (reg->type)
+    if (vkd3d_dxbc_compiler_get_register_info(compiler, reg, &register_info))
     {
-        case VKD3DSPR_COLOROUT:
-        case VKD3DSPR_CONSTBUFFER:
-        case VKD3DSPR_DEPTHOUT:
-        case VKD3DSPR_DEPTHOUTGE:
-        case VKD3DSPR_DEPTHOUTLE:
-        case VKD3DSPR_IDXTEMP:
-        case VKD3DSPR_IMMCONSTBUFFER:
-        case VKD3DSPR_INCONTROLPOINT:
-        case VKD3DSPR_INPUT:
-        case VKD3DSPR_LOCALTHREADID:
-        case VKD3DSPR_LOCALTHREADINDEX:
-        case VKD3DSPR_OUTPUT:
-        case VKD3DSPR_SAMPLER:
-        case VKD3DSPR_TEMP:
-        case VKD3DSPR_THREADGROUPID:
-        case VKD3DSPR_THREADID:
-            if (vkd3d_dxbc_compiler_get_register_info(compiler, reg, &register_info))
-            {
-                vkd3d_dxbc_compiler_emit_dereference_register(compiler, reg, &register_info);
-                return register_info.id;
-            }
-            return vkd3d_dxbc_compiler_emit_variable(compiler, &builder->global_stream,
-                    SpvStorageClassPrivate, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
-        case VKD3DSPR_IMMCONST:
-            ERR("Unexpected register type %#x.\n", reg->type);
-            return vkd3d_dxbc_compiler_emit_variable(compiler, &builder->global_stream,
-                    SpvStorageClassPrivate, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
-        default:
-            FIXME("Unhandled register type %#x.\n", reg->type);
-            return vkd3d_dxbc_compiler_emit_variable(compiler, &builder->global_stream,
-                    SpvStorageClassPrivate, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
+        vkd3d_dxbc_compiler_emit_dereference_register(compiler, reg, &register_info);
+        return register_info.id;
     }
+
+    return vkd3d_dxbc_compiler_emit_variable(compiler, &builder->global_stream,
+            SpvStorageClassPrivate, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
 }
 
 static bool vkd3d_swizzle_is_equal(unsigned int dst_write_mask,




More information about the wine-cvs mailing list