File tree Expand file tree Collapse file tree 3 files changed +3
-12
lines changed Expand file tree Collapse file tree 3 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ namespace api {
20
20
class ParamsBuffer final {
21
21
private:
22
22
Context* context_p_;
23
- size_t nbytes_;
24
23
vkapi::VulkanBuffer vulkan_buffer_;
25
24
26
25
public:
@@ -29,14 +28,12 @@ class ParamsBuffer final {
29
28
template <typename Block>
30
29
ParamsBuffer (Context* context_p, const Block& block)
31
30
: context_p_(context_p),
32
- nbytes_ (sizeof (block)),
33
31
vulkan_buffer_ (
34
32
context_p_->adapter_ptr ()->vma().create_params_buffer(block)) {}
35
33
36
34
template <typename Block>
37
35
ParamsBuffer (Context* context_p, const VkDeviceSize nbytes)
38
36
: context_p_(context_p),
39
- nbytes_(nbytes),
40
37
vulkan_buffer_(
41
38
context_p_->adapter_ptr ()->vma().create_uniform_buffer(nbytes)) {}
42
39
@@ -70,7 +67,7 @@ class ParamsBuffer final {
70
67
template <typename T>
71
68
T read () const {
72
69
T val;
73
- if (sizeof (val) != nbytes_ ) {
70
+ if (sizeof (val) != vulkan_buffer_. mem_size () ) {
74
71
VK_THROW (
75
72
" Attempted to store value from ParamsBuffer to type of different size" );
76
73
}
Original file line number Diff line number Diff line change @@ -29,12 +29,7 @@ VulkanBuffer::VulkanBuffer(
29
29
const VmaAllocationCreateInfo& allocation_create_info,
30
30
const VkBufferUsageFlags usage,
31
31
const bool allocate_memory)
32
- : buffer_properties_({
33
- size,
34
- 0u ,
35
- size,
36
- usage,
37
- }),
32
+ : buffer_properties_({size, 0u , size}),
38
33
allocator_ (vma_allocator),
39
34
memory_{},
40
35
owns_memory_ (allocate_memory),
@@ -52,7 +47,7 @@ VulkanBuffer::VulkanBuffer(
52
47
nullptr , // pNext
53
48
0u , // flags
54
49
buffer_properties_.size , // size
55
- buffer_properties_. buffer_usage , // usage
50
+ usage , // usage
56
51
VK_SHARING_MODE_EXCLUSIVE, // sharingMode
57
52
0u , // queueFamilyIndexCount
58
53
nullptr , // pQueueFamilyIndices
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ class VulkanBuffer final {
48
48
VkDeviceSize size;
49
49
VkDeviceSize mem_offset;
50
50
VkDeviceSize mem_range;
51
- VkBufferUsageFlags buffer_usage;
52
51
};
53
52
54
53
explicit VulkanBuffer ();
You can’t perform that action at this time.
0 commit comments