From 6aa2fd140461e58536c317a2503406d5ed507af5 Mon Sep 17 00:00:00 2001 From: Dunfan Lu Date: Fri, 22 Oct 2021 09:22:00 +0100 Subject: [PATCH] [vulkan] Support for ti.u8 in vulkan (#3247) * u8 * remove legacy comments --- taichi/backends/vulkan/data_type_utils.h | 4 +--- taichi/backends/vulkan/spirv_ir_builder.cpp | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/taichi/backends/vulkan/data_type_utils.h b/taichi/backends/vulkan/data_type_utils.h index c837a9d6d39d3..8d95e33bfde44 100644 --- a/taichi/backends/vulkan/data_type_utils.h +++ b/taichi/backends/vulkan/data_type_utils.h @@ -10,9 +10,7 @@ namespace lang { namespace vulkan { inline std::size_t vk_data_type_size(DataType dt) { - // Vulkan buffers require a minimum alignment of 4 bytes. - // https://vulkan-tutorial.com/Uniform_buffers/Descriptor_pool_and_sets#page_Alignment-requirements - return std::max(data_type_size(dt), 4); + return data_type_size(dt); } } // namespace vulkan diff --git a/taichi/backends/vulkan/spirv_ir_builder.cpp b/taichi/backends/vulkan/spirv_ir_builder.cpp index 0203558c36ff1..725ca8964396d 100644 --- a/taichi/backends/vulkan/spirv_ir_builder.cpp +++ b/taichi/backends/vulkan/spirv_ir_builder.cpp @@ -260,6 +260,9 @@ SType IRBuilder::get_primitive_buffer_type(const bool struct_compiled, } else if (dt->is_primitive(PrimitiveTypeID::i64) && device_->get_cap(cap::spirv_has_atomic_i64)) { return t_int64_; + } else if (dt->is_primitive(PrimitiveTypeID::u8) && + device_->get_cap(cap::spirv_has_int8)) { + return t_uint8_; } } return t_int32_;