Skip to content

Commit

Permalink
Add pnext support to buffer creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Jan 24, 2024
1 parent ef1feed commit f2d5d2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions vulkan/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct BufferCreateInfo
BufferMiscFlags misc = 0;
VkMemoryRequirements allocation_requirements = {};
ExternalHandle external;
void *pnext = nullptr;
};

class Buffer;
Expand Down
4 changes: 4 additions & 0 deletions vulkan/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4279,6 +4279,8 @@ BufferHandle Device::create_imported_host_buffer(const BufferCreateInfo &create_
info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
info.pNext = &external_info;

external_info.pNext = create_info.pnext;

uint32_t sharing_indices[QUEUE_INDEX_COUNT];
fill_buffer_sharing_indices(info, sharing_indices);

Expand Down Expand Up @@ -4406,6 +4408,7 @@ BufferHandle Device::create_buffer(const BufferCreateInfo &create_info, const vo
if (get_device_features().vk12_features.bufferDeviceAddress)
info.usage |= VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT;
info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
info.pNext = create_info.pnext;

uint32_t sharing_indices[QUEUE_INDEX_COUNT];
fill_buffer_sharing_indices(info, sharing_indices);
Expand Down Expand Up @@ -4447,6 +4450,7 @@ BufferHandle Device::create_buffer(const BufferCreateInfo &create_info, const vo
}

external_info.handleTypes = create_info.external.memory_handle_type;
external_info.pNext = info.pNext;
info.pNext = &external_info;
}

Expand Down

0 comments on commit f2d5d2b

Please sign in to comment.