diff options
Diffstat (limited to 'src/vulkan/vertex_buffer.h')
-rw-r--r-- | src/vulkan/vertex_buffer.h | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/vulkan/vertex_buffer.h b/src/vulkan/vertex_buffer.h index e7b216e..2837a9e 100644 --- a/src/vulkan/vertex_buffer.h +++ b/src/vulkan/vertex_buffer.h @@ -40,47 +40,28 @@ class VertexBuffer { Result SendVertexData(CommandBuffer* command); bool VertexDataSent() const { return !is_vertex_data_pending_; } - void SetData(uint8_t location, Buffer* buffer); + void SetData(uint8_t location, Buffer* buffer, InputRate rate); const std::vector<VkVertexInputAttributeDescription>& GetVkVertexInputAttr() const { return vertex_attr_desc_; } - - VkVertexInputBindingDescription GetVkVertexInputBinding() const { - VkVertexInputBindingDescription vertex_binding_desc = - VkVertexInputBindingDescription(); - vertex_binding_desc.binding = 0; - vertex_binding_desc.stride = Get4BytesAlignedStride(); - vertex_binding_desc.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; - return vertex_binding_desc; - } - - uint32_t GetVertexCount() const { - if (data_.empty()) - return 0; - return data_[0]->ElementCount(); + const std::vector<VkVertexInputBindingDescription>& GetVkVertexInputBinding() + const { + return vertex_binding_desc_; } void BindToCommandBuffer(CommandBuffer* command); - void SetBufferForTest(std::unique_ptr<TransferBuffer> buffer); - private: - Result FillVertexBufferWithData(CommandBuffer* command); - - uint32_t Get4BytesAlignedStride() const { - return ((stride_in_bytes_ + 3) / 4) * 4; - } - Device* device_ = nullptr; bool is_vertex_data_pending_ = true; - std::unique_ptr<TransferBuffer> transfer_buffer_; - uint32_t stride_in_bytes_ = 0; + std::vector<std::unique_ptr<TransferBuffer>> transfer_buffers_; std::vector<Buffer*> data_; + std::vector<VkVertexInputBindingDescription> vertex_binding_desc_; std::vector<VkVertexInputAttributeDescription> vertex_attr_desc_; }; |