Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- libs/vkd3d-shader/spirv.c | 55 +++++++++++++++++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 57 ------------------------ 2 files changed, 55 insertions(+), 57 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index d746a35a..89b16305 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -168,6 +168,61 @@ static void vkd3d_spirv_validate(const struct vkd3d_shader_code *spirv,
#endif /* HAVE_SPIRV_TOOLS */
+static enum vkd3d_shader_component_type vkd3d_component_type_from_data_type(enum vkd3d_data_type data_type) +{ + switch (data_type) + { + case VKD3D_DATA_FLOAT: + case VKD3D_DATA_UNORM: + case VKD3D_DATA_SNORM: + return VKD3D_SHADER_COMPONENT_FLOAT; + case VKD3D_DATA_UINT: + return VKD3D_SHADER_COMPONENT_UINT; + case VKD3D_DATA_INT: + return VKD3D_SHADER_COMPONENT_INT; + case VKD3D_DATA_DOUBLE: + return VKD3D_SHADER_COMPONENT_DOUBLE; + default: + FIXME("Unhandled data type %#x.\n", data_type); + /* fall-through */ + case VKD3D_DATA_MIXED: + return VKD3D_SHADER_COMPONENT_UINT; + } +} + +static enum vkd3d_data_type vkd3d_data_type_from_component_type(enum vkd3d_shader_component_type component_type) +{ + switch (component_type) + { + case VKD3D_SHADER_COMPONENT_FLOAT: + return VKD3D_DATA_FLOAT; + case VKD3D_SHADER_COMPONENT_UINT: + return VKD3D_DATA_UINT; + case VKD3D_SHADER_COMPONENT_INT: + return VKD3D_DATA_INT; + case VKD3D_SHADER_COMPONENT_DOUBLE: + return VKD3D_DATA_DOUBLE; + default: + FIXME("Unhandled component type %#x.\n", component_type); + return VKD3D_DATA_FLOAT; + } +} + +static unsigned int vkd3d_write_mask_get_component_idx(DWORD write_mask) +{ + unsigned int i; + + assert(write_mask); + for (i = 0; i < VKD3D_VEC4_SIZE; ++i) + { + if (write_mask & (VKD3DSP_WRITEMASK_0 << i)) + return i; + } + + FIXME("Invalid write mask %#x.\n", write_mask); + return 0; +} + static enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval_indexed(enum vkd3d_shader_sysval_semantic sysval, unsigned int index) { diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 29e178cc..5d3c3e49 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1102,63 +1102,6 @@ int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info, int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
-static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_type( - enum vkd3d_data_type data_type) -{ - switch (data_type) - { - case VKD3D_DATA_FLOAT: - case VKD3D_DATA_UNORM: - case VKD3D_DATA_SNORM: - return VKD3D_SHADER_COMPONENT_FLOAT; - case VKD3D_DATA_UINT: - return VKD3D_SHADER_COMPONENT_UINT; - case VKD3D_DATA_INT: - return VKD3D_SHADER_COMPONENT_INT; - case VKD3D_DATA_DOUBLE: - return VKD3D_SHADER_COMPONENT_DOUBLE; - default: - FIXME("Unhandled data type %#x.\n", data_type); - /* fall-through */ - case VKD3D_DATA_MIXED: - return VKD3D_SHADER_COMPONENT_UINT; - } -} - -static inline enum vkd3d_data_type vkd3d_data_type_from_component_type( - enum vkd3d_shader_component_type component_type) -{ - switch (component_type) - { - case VKD3D_SHADER_COMPONENT_FLOAT: - return VKD3D_DATA_FLOAT; - case VKD3D_SHADER_COMPONENT_UINT: - return VKD3D_DATA_UINT; - case VKD3D_SHADER_COMPONENT_INT: - return VKD3D_DATA_INT; - case VKD3D_SHADER_COMPONENT_DOUBLE: - return VKD3D_DATA_DOUBLE; - default: - FIXME("Unhandled component type %#x.\n", component_type); - return VKD3D_DATA_FLOAT; - } -} - -static inline unsigned int vkd3d_write_mask_get_component_idx(DWORD write_mask) -{ - unsigned int i; - - assert(write_mask); - for (i = 0; i < VKD3D_VEC4_SIZE; ++i) - { - if (write_mask & (VKD3DSP_WRITEMASK_0 << i)) - return i; - } - - FIXME("Invalid write mask %#x.\n", write_mask); - return 0; -} - static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask) { unsigned int count = vkd3d_popcount(write_mask & VKD3DSP_WRITEMASK_ALL);