Skip to content

Commit ad6a52e

Browse files
committed
fix: improper device initialization
1 parent fbdcf2b commit ad6a52e

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

include/misc/struct_chainer.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ namespace Anvil
218218
true /* in_is_helper_struct */);
219219
}
220220

221-
std::unique_ptr<StructChain<StructType> > create_chain() const
221+
std::unique_ptr<StructChain<StructType> > create_chain(const void *pNextLast = nullptr) const
222222
{
223223
size_t helper_data_start_offset = 0;
224224
size_t n_bytes_used = 0;
@@ -260,12 +260,11 @@ namespace Anvil
260260
current_struct_data_size);
261261

262262
/* Adjust pNext pointer to point at the next struct, if defined. */
263+
VkStructHeader *header_ptr = reinterpret_cast<VkStructHeader *>(&result_ptr->raw_data.at(n_bytes_used));
263264
if (n_struct != (n_structs - 1) )
264-
{
265-
VkStructHeader* header_ptr = reinterpret_cast<VkStructHeader*>(&result_ptr->raw_data.at(n_bytes_used) );
266-
267265
header_ptr->next_ptr = &result_ptr->raw_data.at(0) + n_bytes_used + current_struct_data_size;
268-
}
266+
else
267+
header_ptr->next_ptr = pNextLast;
269268

270269
n_bytes_used += current_struct_data_size;
271270
}

src/wrappers/device.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ void Anvil::BaseDevice::create_device(const std::vector<const char*>& in_extensi
305305

306306
/* Issue the request */
307307
{
308-
auto struct_chain_ptr = struct_chainer.create_chain();
309-
310-
struct_chain_ptr->get_root_struct()->pNext = m_create_info_ptr->pNext;
308+
auto struct_chain_ptr = struct_chainer.create_chain(m_create_info_ptr->pNext);
311309

312310
result = Anvil::Vulkan::vkCreateDevice(physical_device_ptrs.at(0)->get_physical_device(),
313311
struct_chain_ptr->get_root_struct(),

0 commit comments

Comments
 (0)