Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ET-VK] Removing unnecessary and redundant members from VulkanBuffer and ParamsBuffer. #7144

Open
wants to merge 2 commits into
base: gh/trivedivivek/16/base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions backends/vulkan/runtime/api/containers/ParamsBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace api {
class ParamsBuffer final {
private:
Context* context_p_;
size_t nbytes_;
vkapi::VulkanBuffer vulkan_buffer_;

public:
Expand All @@ -29,14 +28,12 @@ class ParamsBuffer final {
template <typename Block>
ParamsBuffer(Context* context_p, const Block& block)
: context_p_(context_p),
nbytes_(sizeof(block)),
vulkan_buffer_(
context_p_->adapter_ptr()->vma().create_params_buffer(block)) {}

template <typename Block>
ParamsBuffer(Context* context_p, const VkDeviceSize nbytes)
: context_p_(context_p),
nbytes_(nbytes),
vulkan_buffer_(
context_p_->adapter_ptr()->vma().create_uniform_buffer(nbytes)) {}

Expand Down Expand Up @@ -70,7 +67,7 @@ class ParamsBuffer final {
template <typename T>
T read() const {
T val;
if (sizeof(val) != nbytes_) {
if (sizeof(val) != vulkan_buffer_.mem_size()) {
VK_THROW(
"Attempted to store value from ParamsBuffer to type of different size");
}
Expand Down
5 changes: 2 additions & 3 deletions backends/vulkan/runtime/vk_api/memory/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ VulkanBuffer::VulkanBuffer(
: buffer_properties_({
size,
0u,
size,
usage,
size
}),
allocator_(vma_allocator),
memory_{},
Expand All @@ -52,7 +51,7 @@ VulkanBuffer::VulkanBuffer(
nullptr, // pNext
0u, // flags
buffer_properties_.size, // size
buffer_properties_.buffer_usage, // usage
usage, // usage
VK_SHARING_MODE_EXCLUSIVE, // sharingMode
0u, // queueFamilyIndexCount
nullptr, // pQueueFamilyIndices
Expand Down
1 change: 0 additions & 1 deletion backends/vulkan/runtime/vk_api/memory/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class VulkanBuffer final {
VkDeviceSize size;
VkDeviceSize mem_offset;
VkDeviceSize mem_range;
VkBufferUsageFlags buffer_usage;
};

explicit VulkanBuffer();
Expand Down
Loading