|
|
|
@ -231,7 +231,7 @@ public: |
|
|
|
const VkIndexType index_type_ = index_type; |
|
|
|
const size_t sub_first_offset = static_cast<size_t>(first % 4) * GetQuadsNum(num_indices); |
|
|
|
const size_t offset = |
|
|
|
(sub_first_offset + GetQuadsNum(first)) * 6ULL * BytesPerIndex(index_type); |
|
|
|
(sub_first_offset + GetFirstOffsetQuads(first)) * 6ULL * BytesPerIndex(index_type); |
|
|
|
scheduler.Record([buffer_ = *buffer, index_type_, offset](vk::CommandBuffer cmdbuf) { |
|
|
|
cmdbuf.BindIndexBuffer(buffer_, offset, index_type_); |
|
|
|
}); |
|
|
|
@ -240,6 +240,8 @@ public: |
|
|
|
protected: |
|
|
|
virtual u32 GetQuadsNum(u32 num_indices) const = 0; |
|
|
|
|
|
|
|
virtual u32 GetFirstOffsetQuads(u32 first) const = 0; |
|
|
|
|
|
|
|
virtual void MakeAndUpdateIndices(u8* staging_data, size_t quad_size, u32 quad, u32 first) = 0; |
|
|
|
|
|
|
|
const Device& device; |
|
|
|
@ -266,6 +268,10 @@ private: |
|
|
|
return num_indices_ / 4; |
|
|
|
} |
|
|
|
|
|
|
|
u32 GetFirstOffsetQuads(u32 first) const override { |
|
|
|
return first / 4; |
|
|
|
} |
|
|
|
|
|
|
|
template <typename T> |
|
|
|
static std::array<T, 6> MakeIndices(u32 quad, u32 first) { |
|
|
|
std::array<T, 6> indices{0, 1, 2, 0, 2, 3}; |
|
|
|
@ -306,6 +312,10 @@ private: |
|
|
|
return num_indices_ >= 4 ? (num_indices_ - 2) / 2 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
u32 GetFirstOffsetQuads(u32 first) const override { |
|
|
|
return (first / 4) * 2; |
|
|
|
} |
|
|
|
|
|
|
|
template <typename T> |
|
|
|
static std::array<T, 6> MakeIndices(u32 quad, u32 first) { |
|
|
|
std::array<T, 6> indices{0, 3, 1, 0, 2, 3}; |
|
|
|
|