Add sample Template; some generalization in utils; some minor improvements in some samples. (#349)
* Add samples SecondaryCommandBuffer and SeparateImageSampler. + made some helper functions more explicit. * Add sample Template, some generalizations in utils, some minor improvements in various samples.
This commit is contained in:
committed by
Markus Tavenrath
parent
89a56017a8
commit
d811c3a7e2
@@ -31,11 +31,10 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
vk::UniqueDebugReportCallbackEXT debugReportCallback = vk::su::createDebugReportCallback(instance);
|
||||
#endif
|
||||
|
||||
std::vector<vk::PhysicalDevice> physicalDevices = instance->enumeratePhysicalDevices();
|
||||
assert(!physicalDevices.empty());
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
|
||||
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex(physicalDevices[0].getQueueFamilyProperties());
|
||||
vk::UniqueDevice device = vk::su::createDevice(physicalDevices[0], graphicsQueueFamilyIndex);
|
||||
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex(physicalDevice.getQueueFamilyProperties());
|
||||
vk::UniqueDevice device = vk::su::createDevice(physicalDevice, graphicsQueueFamilyIndex);
|
||||
|
||||
/* VULKAN_HPP_KEY_START */
|
||||
|
||||
@@ -43,7 +42,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
vk::UniqueCommandPool commandPool = device->createCommandPoolUnique(vk::CommandPoolCreateInfo(vk::CommandPoolCreateFlags(), graphicsQueueFamilyIndex));
|
||||
|
||||
// allocate a CommandBuffer from the CommandPool
|
||||
std::vector<vk::UniqueCommandBuffer> commandBuffers = device->allocateCommandBuffersUnique(vk::CommandBufferAllocateInfo(commandPool.get(), vk::CommandBufferLevel::ePrimary, 1));
|
||||
vk::UniqueCommandBuffer commandBuffer = std::move(device->allocateCommandBuffersUnique(vk::CommandBufferAllocateInfo(commandPool.get(), vk::CommandBufferLevel::ePrimary, 1)).front());
|
||||
|
||||
// Note: No need to explicitly free the CommandBuffer or destroy the CommandPool, as the corresponding free and destroy
|
||||
// functions are called by the destructor of the UniqueCommandBuffer and the UniqueCommandPool on leaving this scope.
|
||||
|
||||
Reference in New Issue
Block a user