From 9c46011b4304420f9cb0715d57609a0309a9a36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 21 Feb 2019 12:32:49 +0100 Subject: [PATCH] vkd3d-shader: Simplify vkd3d_dxbc_compiler_get_register_id(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Special casing is not needed. Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 2c58a470..510fcd3e 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, ®ister_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, ®ister_info)) - { - vkd3d_dxbc_compiler_emit_dereference_register(compiler, reg, ®ister_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, ®ister_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,