11 #ifndef VKU_FRAMEWORK_HPP 12 #define VKU_FRAMEWORK_HPP 15 #define VK_USE_PLATFORM_WIN32_KHR 16 #define GLFW_EXPOSE_NATIVE_WIN32 17 #define VKU_SURFACE "VK_KHR_win32_surface" 18 #pragma warning(disable : 4005) 20 #define VK_USE_PLATFORM_XLIB_KHR 21 #define GLFW_EXPOSE_NATIVE_X11 22 #define VKU_SURFACE "VK_KHR_xlib_surface" 26 #define GLFW_INCLUDE_VULKAN 27 #include <GLFW/glfw3.h> 28 #include <GLFW/glfw3native.h> 40 #include <unordered_map> 47 #include <vulkan/vulkan.hpp> 48 #include <vku/vku.hpp> 63 std::vector<const char *> layers;
64 layers.push_back(
"VK_LAYER_LUNARG_standard_validation");
66 std::vector<const char *> instance_extensions;
67 instance_extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
68 instance_extensions.push_back(VKU_SURFACE);
69 instance_extensions.push_back(
"VK_KHR_surface");
71 auto appinfo = vk::ApplicationInfo{};
72 instance_ = vk::createInstanceUnique(vk::InstanceCreateInfo{
73 {}, &appinfo, (uint32_t)layers.size(),
74 layers.data(), (uint32_t)instance_extensions.size(),
75 instance_extensions.data()});
77 auto ci = vk::DebugReportCallbackCreateInfoEXT{
79 vk::DebugReportFlagBitsEXT::eWarning |
80 vk::DebugReportFlagBitsEXT::ePerformanceWarning |
81 vk::DebugReportFlagBitsEXT::eError,
84 const VkDebugReportCallbackCreateInfoEXT &cir = ci;
86 auto vkCreateDebugReportCallbackEXT =
87 (PFN_vkCreateDebugReportCallbackEXT)instance_->getProcAddr(
88 "vkCreateDebugReportCallbackEXT");
90 VkDebugReportCallbackEXT cb;
91 vkCreateDebugReportCallbackEXT(
92 *instance_, &(
const VkDebugReportCallbackCreateInfoEXT &)ci,
96 auto pds = instance_->enumeratePhysicalDevices();
97 physical_device_ = pds[0];
98 auto qprops = physical_device_.getQueueFamilyProperties();
99 const auto badQueue = ~(uint32_t)0;
100 graphicsQueueFamilyIndex_ = badQueue;
101 computeQueueFamilyIndex_ = badQueue;
102 vk::QueueFlags search = vk::QueueFlagBits::eGraphics|vk::QueueFlagBits::eCompute;
112 for (uint32_t qi = 0; qi != qprops.size(); ++qi) {
113 auto &qprop = qprops[qi];
115 if ((qprop.queueFlags & search) == search) {
116 graphicsQueueFamilyIndex_ = qi;
117 computeQueueFamilyIndex_ = qi;
122 if (graphicsQueueFamilyIndex_ == badQueue || computeQueueFamilyIndex_ == badQueue) {
123 std::cout <<
"oops, missing a queue\n";
127 memprops_ = physical_device_.getMemoryProperties();
132 std::vector<const char *> device_extensions;
133 device_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
135 float queue_priorities[] = {0.0f};
136 std::vector<vk::DeviceQueueCreateInfo> qci;
138 qci.emplace_back(vk::DeviceQueueCreateFlags{}, graphicsQueueFamilyIndex_, 1,
141 if (computeQueueFamilyIndex_ != graphicsQueueFamilyIndex_) {
142 qci.emplace_back(vk::DeviceQueueCreateFlags{}, computeQueueFamilyIndex_, 1,
146 float graphicsQueue_priorities[] = {0.0f};
147 device_ = physical_device_.createDeviceUnique(vk::DeviceCreateInfo{
148 {}, (uint32_t)qci.size(), qci.data(),
149 (uint32_t)layers.size(), layers.data(),
150 (uint32_t)device_extensions.size(), device_extensions.data()});
155 vk::PipelineCacheCreateInfo pipelineCacheInfo{};
156 pipelineCache_ = device_->createPipelineCacheUnique(pipelineCacheInfo);
158 std::vector<vk::DescriptorPoolSize> poolSizes;
159 poolSizes.emplace_back(vk::DescriptorType::eUniformBuffer, 128);
160 poolSizes.emplace_back(vk::DescriptorType::eCombinedImageSampler, 128);
161 poolSizes.emplace_back(vk::DescriptorType::eStorageBuffer, 128);
165 vk::DescriptorPoolCreateInfo descriptorPoolInfo{};
166 descriptorPoolInfo.flags = vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet;
167 descriptorPoolInfo.maxSets = 256;
168 descriptorPoolInfo.poolSizeCount = (uint32_t)poolSizes.size();
169 descriptorPoolInfo.pPoolSizes = poolSizes.data();
170 descriptorPool_ = device_->createDescriptorPoolUnique(descriptorPoolInfo);
175 void dumpCaps(std::ostream &os)
const {
176 os <<
"Memory Types\n";
177 for (uint32_t i = 0; i != memprops_.memoryTypeCount; ++i) {
178 os <<
" type" << i <<
" heap" << memprops_.memoryTypes[i].heapIndex <<
" " << vk::to_string(memprops_.memoryTypes[i].propertyFlags) <<
"\n";
181 for (uint32_t i = 0; i != memprops_.memoryHeapCount; ++i) {
182 os <<
" heap" << vk::to_string(memprops_.memoryHeaps[i].flags) <<
" " << memprops_.memoryHeaps[i].size <<
"\n";
187 const vk::Instance
instance()
const {
return *instance_; }
190 const vk::Device
device()
const {
return *device_; }
193 const vk::Queue
graphicsQueue()
const {
return device_->getQueue(graphicsQueueFamilyIndex_, 0); }
196 const vk::Queue
computeQueue()
const {
return device_->getQueue(computeQueueFamilyIndex_, 0); }
213 const vk::PhysicalDeviceMemoryProperties &memprops()
const {
return memprops_; }
219 if (pipelineCache_) {
220 pipelineCache_.reset();
222 if (descriptorPool_) {
223 descriptorPool_.reset();
229 auto vkDestroyDebugReportCallbackEXT =
230 (PFN_vkDestroyDebugReportCallbackEXT)instance_->getProcAddr(
231 "vkDestroyDebugReportCallbackEXT");
232 vkDestroyDebugReportCallbackEXT(*instance_, callback_,
nullptr);
240 bool ok()
const {
return ok_; }
244 static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
245 VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType,
246 uint64_t
object,
size_t location, int32_t messageCode,
247 const char *pLayerPrefix,
const char *pMessage,
void *pUserData) {
248 printf(
"%08x debugCallback: %s\n", flags, pMessage);
252 vk::UniqueInstance instance_;
253 vk::UniqueDevice device_;
254 vk::DebugReportCallbackEXT callback_;
255 vk::PhysicalDevice physical_device_;
256 vk::UniquePipelineCache pipelineCache_;
257 vk::UniqueDescriptorPool descriptorPool_;
258 uint32_t graphicsQueueFamilyIndex_;
259 uint32_t computeQueueFamilyIndex_;
260 vk::PhysicalDeviceMemoryProperties memprops_;
273 #ifdef VK_USE_PLATFORM_WIN32_KHR 274 auto module = GetModuleHandle(
nullptr);
275 auto handle = glfwGetWin32Window(window);
276 auto ci = vk::Win32SurfaceCreateInfoKHR{{}, module, handle};
277 auto surface = instance.createWin32SurfaceKHR(ci);
279 #ifdef VK_USE_PLATFORM_XLIB_KHR 280 auto display = glfwGetX11Display();
281 auto x11window = glfwGetX11Window(window);
282 auto ci = vk::XlibSurfaceCreateInfoKHR{{}, display, x11window};
283 auto surface = instance.createXlibSurfaceKHR(ci);
285 init(instance, device, physicalDevice, graphicsQueueFamilyIndex, surface);
289 Window(
const vk::Instance &instance,
const vk::Device &device,
const vk::PhysicalDevice &physicalDevice, uint32_t graphicsQueueFamilyIndex, vk::SurfaceKHR surface) {
290 init(instance, device, physicalDevice, graphicsQueueFamilyIndex, surface);
293 void init(
const vk::Instance &instance,
const vk::Device &device,
const vk::PhysicalDevice &physicalDevice, uint32_t graphicsQueueFamilyIndex, vk::SurfaceKHR surface) {
299 presentQueueFamily_ = 0;
301 auto qprops = pd.getQueueFamilyProperties();
303 for (uint32_t qi = 0; qi != qprops.size(); ++qi) {
304 if (pd.getSurfaceSupportKHR(qi, surface_)) {
305 presentQueueFamily_ = qi;
312 std::cout <<
"No Vulkan present queues found\n";
316 auto fmts = pd.getSurfaceFormatsKHR(surface_);
317 swapchainImageFormat_ = fmts[0].format;
318 swapchainColorSpace_ = fmts[0].colorSpace;
319 if (fmts.size() == 1 && swapchainImageFormat_ == vk::Format::eUndefined) {
320 swapchainImageFormat_ = vk::Format::eB8G8R8A8Unorm;
321 swapchainColorSpace_ = vk::ColorSpaceKHR::eSrgbNonlinear;
323 for (
auto &fmt : fmts) {
324 if (fmt.format == vk::Format::eB8G8R8A8Unorm) {
325 swapchainImageFormat_ = fmt.format;
326 swapchainColorSpace_ = fmt.colorSpace;
331 auto surfaceCaps = pd.getSurfaceCapabilitiesKHR(surface_);
332 width_ = surfaceCaps.currentExtent.width;
333 height_ = surfaceCaps.currentExtent.height;
335 auto pms = pd.getSurfacePresentModesKHR(surface_);
336 vk::PresentModeKHR presentMode = pms[0];
337 if (std::find(pms.begin(), pms.end(), vk::PresentModeKHR::eFifo) != pms.end()) {
338 presentMode = vk::PresentModeKHR::eFifo;
340 std::cout <<
"No fifo mode available\n";
346 vk::SwapchainCreateInfoKHR swapinfo{};
348 bool sameQueues = queueFamilyIndices[0] == queueFamilyIndices[1];
349 vk::SharingMode sharingMode = !sameQueues ? vk::SharingMode::eConcurrent : vk::SharingMode::eExclusive;
350 swapinfo.imageExtent = surfaceCaps.currentExtent;
351 swapinfo.surface = surface_;
352 swapinfo.minImageCount = surfaceCaps.minImageCount + 1;
353 swapinfo.imageFormat = swapchainImageFormat_;
354 swapinfo.imageColorSpace = swapchainColorSpace_;
355 swapinfo.imageExtent = surfaceCaps.currentExtent;
356 swapinfo.imageArrayLayers = 1;
357 swapinfo.imageUsage = vk::ImageUsageFlagBits::eColorAttachment;
358 swapinfo.imageSharingMode = sharingMode;
359 swapinfo.queueFamilyIndexCount = !sameQueues ? 2 : 0;
360 swapinfo.pQueueFamilyIndices = queueFamilyIndices.data();
361 swapinfo.preTransform = surfaceCaps.currentTransform;;
362 swapinfo.compositeAlpha = vk::CompositeAlphaFlagBitsKHR::eOpaque;
363 swapinfo.presentMode = presentMode;
364 swapinfo.clipped = 1;
365 swapinfo.oldSwapchain = vk::SwapchainKHR{};
366 swapchain_ = device.createSwapchainKHRUnique(swapinfo);
368 images_ = device.getSwapchainImagesKHR(*swapchain_);
369 for (
auto &img : images_) {
370 vk::ImageViewCreateInfo ci{};
372 ci.viewType = vk::ImageViewType::e2D;
373 ci.format = swapchainImageFormat_;
374 ci.subresourceRange = {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1};
375 imageViews_.emplace_back(device.createImageView(ci));
378 auto memprops = physicalDevice.getMemoryProperties();
386 rpm.attachmentLoadOp(vk::AttachmentLoadOp::eClear);
387 rpm.attachmentStoreOp(vk::AttachmentStoreOp::eStore);
388 rpm.attachmentFinalLayout(vk::ImageLayout::ePresentSrcKHR);
392 rpm.attachmentLoadOp(vk::AttachmentLoadOp::eClear);
393 rpm.attachmentStencilLoadOp(vk::AttachmentLoadOp::eDontCare);
394 rpm.attachmentFinalLayout(vk::ImageLayout::eDepthStencilAttachmentOptimal);
398 rpm.subpassColorAttachment(vk::ImageLayout::eColorAttachmentOptimal, 0);
399 rpm.subpassDepthStencilAttachment(vk::ImageLayout::eDepthStencilAttachmentOptimal, 1);
402 rpm.dependencyBegin(VK_SUBPASS_EXTERNAL, 0);
403 rpm.dependencySrcStageMask(vk::PipelineStageFlagBits::eColorAttachmentOutput);
404 rpm.dependencyDstStageMask(vk::PipelineStageFlagBits::eColorAttachmentOutput);
405 rpm.dependencyDstAccessMask(vk::AccessFlagBits::eColorAttachmentRead|vk::AccessFlagBits::eColorAttachmentWrite);
408 renderPass_ = rpm.createUnique(device);
410 for (
int i = 0; i != imageViews_.size(); ++i) {
411 vk::ImageView attachments[2] = {imageViews_[i], depthStencilImage_.imageView()};
412 vk::FramebufferCreateInfo fbci{{}, *renderPass_, 2, attachments, width_, height_, 1 };
413 framebuffers_.push_back(device.createFramebufferUnique(fbci));
416 vk::SemaphoreCreateInfo sci;
417 imageAcquireSemaphore_ = device.createSemaphoreUnique(sci);
418 commandCompleteSemaphore_ = device.createSemaphoreUnique(sci);
419 dynamicSemaphore_ = device.createSemaphoreUnique(sci);
421 typedef vk::CommandPoolCreateFlagBits ccbits;
423 vk::CommandPoolCreateInfo cpci{ ccbits::eTransient|ccbits::eResetCommandBuffer, graphicsQueueFamilyIndex };
424 commandPool_ = device.createCommandPoolUnique(cpci);
427 vk::CommandBufferAllocateInfo cbai{ *commandPool_, vk::CommandBufferLevel::ePrimary, (uint32_t)framebuffers_.size() };
428 staticDrawBuffers_ = device.allocateCommandBuffersUnique(cbai);
429 dynamicDrawBuffers_ = device.allocateCommandBuffersUnique(cbai);
432 for (
int i = 0; i != staticDrawBuffers_.size(); ++i) {
433 vk::FenceCreateInfo fci;
434 fci.flags = vk::FenceCreateFlagBits::eSignaled;
435 commandBufferFences_.emplace_back(device.createFence(fci));
438 for (
int i = 0; i != staticDrawBuffers_.size(); ++i) {
439 vk::CommandBuffer cb = *staticDrawBuffers_[i];
440 vk::CommandBufferBeginInfo bi{};
449 void dumpCaps(std::ostream &os, vk::PhysicalDevice pd)
const {
450 os <<
"Surface formats\n";
451 auto fmts = pd.getSurfaceFormatsKHR(surface_);
452 for (
auto &fmt : fmts) {
453 auto fmtstr = vk::to_string(fmt.format);
454 auto cstr = vk::to_string(fmt.colorSpace);
455 os <<
"format=" << fmtstr <<
" colorSpace=" << cstr <<
"\n";
458 os <<
"Present Modes\n";
459 auto presentModes = pd.getSurfacePresentModesKHR(surface_);
460 for (
auto pm : presentModes) {
461 std::cout << vk::to_string(pm) <<
"\n";
465 static void defaultRenderFunc(vk::CommandBuffer cb,
int imageIndex, vk::RenderPassBeginInfo &rpbi) {
466 vk::CommandBufferBeginInfo bi{};
471 typedef void (renderFunc_t)(vk::CommandBuffer cb,
int imageIndex, vk::RenderPassBeginInfo &rpbi);
475 for (
int i = 0; i != staticDrawBuffers_.size(); ++i) {
476 vk::CommandBuffer cb = *staticDrawBuffers_[i];
478 std::array<float, 4> clearColorValue{0.75f, 0.75f, 0.75f, 1};
479 vk::ClearDepthStencilValue clearDepthValue{ 1.0f, 0 };
480 std::array<vk::ClearValue, 2> clearColours{vk::ClearValue{clearColorValue}, clearDepthValue};
481 vk::RenderPassBeginInfo rpbi;
482 rpbi.renderPass = *renderPass_;
483 rpbi.framebuffer = *framebuffers_[i];
484 rpbi.renderArea = vk::Rect2D{{0, 0}, {width_, height_}};
485 rpbi.clearValueCount = (uint32_t)clearColours.size();
486 rpbi.pClearValues = clearColours.data();
494 void draw(
const vk::Device &device,
const vk::Queue &
graphicsQueue,
const std::function<
void (vk::CommandBuffer cb,
int imageIndex, vk::RenderPassBeginInfo &rpbi)> &dynamic = defaultRenderFunc) {
495 static auto start = std::chrono::high_resolution_clock::now();
496 auto time = std::chrono::high_resolution_clock::now();
497 auto delta = time - start;
502 auto umax = std::numeric_limits<uint64_t>::max();
503 uint32_t imageIndex = 0;
504 device.acquireNextImageKHR(*swapchain_, umax, *imageAcquireSemaphore_, vk::Fence(), &imageIndex);
506 vk::PipelineStageFlags waitStages = vk::PipelineStageFlagBits::eColorAttachmentOutput;
507 vk::Semaphore ccSema = *commandCompleteSemaphore_;
508 vk::Semaphore iaSema = *imageAcquireSemaphore_;
509 vk::Semaphore psSema = *dynamicSemaphore_;
510 vk::CommandBuffer cb = *staticDrawBuffers_[imageIndex];
511 vk::CommandBuffer pscb = *dynamicDrawBuffers_[imageIndex];
513 vk::Fence cbFence = commandBufferFences_[imageIndex];
514 device.waitForFences(cbFence, 1, umax);
515 device.resetFences(cbFence);
517 std::array<float, 4> clearColorValue{0.75f, 0.75f, 0.75f, 1};
518 vk::ClearDepthStencilValue clearDepthValue{ 1.0f, 0 };
519 std::array<vk::ClearValue, 2> clearColours{vk::ClearValue{clearColorValue}, clearDepthValue};
520 vk::RenderPassBeginInfo rpbi;
521 rpbi.renderPass = *renderPass_;
522 rpbi.framebuffer = *framebuffers_[imageIndex];
523 rpbi.renderArea = vk::Rect2D{{0, 0}, {width_, height_}};
524 rpbi.clearValueCount = (uint32_t)clearColours.size();
525 rpbi.pClearValues = clearColours.data();
526 dynamic(pscb, imageIndex, rpbi);
528 vk::SubmitInfo submit;
529 submit.waitSemaphoreCount = 1;
530 submit.pWaitSemaphores = &iaSema;
531 submit.pWaitDstStageMask = &waitStages;
532 submit.commandBufferCount = 1;
533 submit.pCommandBuffers = &pscb;
534 submit.signalSemaphoreCount = 1;
535 submit.pSignalSemaphores = &psSema;
536 graphicsQueue.submit(1, &submit, vk::Fence{});
538 submit.waitSemaphoreCount = 1;
539 submit.pWaitSemaphores = &psSema;
540 submit.pWaitDstStageMask = &waitStages;
541 submit.commandBufferCount = 1;
542 submit.pCommandBuffers = &cb;
543 submit.signalSemaphoreCount = 1;
544 submit.pSignalSemaphores = &ccSema;
545 graphicsQueue.submit(1, &submit, cbFence);
547 vk::PresentInfoKHR presentInfo;
548 vk::SwapchainKHR swapchain = *swapchain_;
549 presentInfo.pSwapchains = &swapchain;
550 presentInfo.swapchainCount = 1;
551 presentInfo.pImageIndices = &imageIndex;
552 presentInfo.waitSemaphoreCount = 1;
553 presentInfo.pWaitSemaphores = &ccSema;
554 presentQueue().presentKHR(presentInfo);
561 const vk::Queue
presentQueue()
const {
return device_.getQueue(presentQueueFamily_, 0); }
564 bool ok()
const {
return ok_; }
570 const std::vector<vk::UniqueFramebuffer> &
framebuffers()
const {
return framebuffers_; }
574 for (
auto &iv : imageViews_) {
575 device_.destroyImageView(iv);
577 for (
auto &f : commandBufferFences_) {
578 device_.destroyFence(f);
580 swapchain_ = vk::UniqueSwapchainKHR{};
586 uint32_t
width()
const {
return width_; }
589 uint32_t
height()
const {
return height_; }
598 const vk::SwapchainKHR
swapchain()
const {
return *swapchain_; }
601 const std::vector<vk::ImageView> &
imageViews()
const {
return imageViews_; }
604 const std::vector<vk::Image> &
images()
const {
return images_; }
607 const std::vector<vk::UniqueCommandBuffer> &
commandBuffers()
const {
return staticDrawBuffers_; }
625 vk::Instance instance_;
626 vk::SurfaceKHR surface_;
627 vk::UniqueSwapchainKHR swapchain_;
628 vk::UniqueRenderPass renderPass_;
629 vk::UniqueSemaphore imageAcquireSemaphore_;
630 vk::UniqueSemaphore commandCompleteSemaphore_;
631 vk::UniqueSemaphore dynamicSemaphore_;
632 vk::UniqueCommandPool commandPool_;
634 std::vector<vk::ImageView> imageViews_;
635 std::vector<vk::Image> images_;
636 std::vector<vk::Fence> commandBufferFences_;
637 std::vector<vk::UniqueFramebuffer> framebuffers_;
638 std::vector<vk::UniqueCommandBuffer> staticDrawBuffers_;
639 std::vector<vk::UniqueCommandBuffer> dynamicDrawBuffers_;
643 uint32_t presentQueueFamily_ = 0;
646 vk::Format swapchainImageFormat_ = vk::Format::eB8G8R8A8Unorm;
647 vk::ColorSpaceKHR swapchainColorSpace_ = vk::ColorSpaceKHR::eSrgbNonlinear;
654 #endif // VKU_FRAMEWORK_HPP void setStaticCommands(const std::function< renderFunc_t > &func)
Build a static draw buffer. This will be rendered after any dynamic content generated in draw() ...
Definition: vku_framework.hpp:474
const vk::PipelineCache pipelineCache() const
Get the default pipeline cache (you can use your own if you like).
Definition: vku_framework.hpp:202
This class wraps a window, a surface and a swap chain for that surface.
Definition: vku_framework.hpp:265
vk::RenderPass renderPass() const
Return the renderpass used by this window.
Definition: vku_framework.hpp:567
uint32_t height() const
Return the height of the display.
Definition: vku_framework.hpp:589
const std::vector< vk::Image > & images() const
Return the swap chain images.
Definition: vku_framework.hpp:604
const std::vector< vk::ImageView > & imageViews() const
Return the views of the swap chain images.
Definition: vku_framework.hpp:601
const vk::PhysicalDevice & physicalDevice() const
Get the physical device.
Definition: vku_framework.hpp:199
const vk::Instance instance() const
Get the Vulkan instance.
Definition: vku_framework.hpp:187
vk::ColorSpaceKHR swapchainColorSpace() const
Return the colour space of the back buffer (Usually sRGB)
Definition: vku_framework.hpp:595
void subpassBegin(vk::PipelineBindPoint bp)
Definition: vku.hpp:334
~Window()
Destroy resources when shutting down.
Definition: vku_framework.hpp:573
const vk::Queue computeQueue() const
Get the queue used to submit compute jobs.
Definition: vku_framework.hpp:196
uint32_t width() const
Return the width of the display.
Definition: vku_framework.hpp:586
const vk::Queue graphicsQueue() const
Get the queue used to submit graphics jobs.
Definition: vku_framework.hpp:193
const std::vector< vk::UniqueCommandBuffer > & commandBuffers() const
Return the static command buffers.
Definition: vku_framework.hpp:607
bool ok() const
Returns true if the Framework has been built correctly.
Definition: vku_framework.hpp:240
uint32_t computeQueueFamilyIndex() const
Get the family index for the compute queues.
Definition: vku_framework.hpp:211
const vk::DescriptorPool descriptorPool() const
Get the default descriptor pool (you can use your own if you like).
Definition: vku_framework.hpp:205
void dumpCaps(std::ostream &os, vk::PhysicalDevice pd) const
Dump the capabilities of the physical device used by this window.
Definition: vku_framework.hpp:449
void attachmentBegin(vk::Format format)
Definition: vku.hpp:316
const vk::Queue presentQueue() const
Get the queue used to submit graphics jobs.
Definition: vku_framework.hpp:561
bool ok() const
Return true if this window was created sucessfully.
Definition: vku_framework.hpp:564
~Framework()
Clean up the framework satisfying the Vulkan verification layers.
Definition: vku_framework.hpp:216
void draw(const vk::Device &device, const vk::Queue &graphicsQueue, const std::function< void(vk::CommandBuffer cb, int imageIndex, vk::RenderPassBeginInfo &rpbi)> &dynamic=defaultRenderFunc)
Definition: vku_framework.hpp:494
uint32_t graphicsQueueFamilyIndex() const
Get the family index for the graphics queues.
Definition: vku_framework.hpp:208
const vk::Device device() const
Get the Vulkan device.
Definition: vku_framework.hpp:190
const vk::SwapchainKHR swapchain() const
Return the swapchain object.
Definition: vku_framework.hpp:598
vk::Format swapchainImageFormat() const
Return the format of the back buffer.
Definition: vku_framework.hpp:592
vk::Semaphore commandCompleteSemaphore() const
Return the semaphore signalled when the command buffers are finished.
Definition: vku_framework.hpp:616
Definition: vku_framework.hpp:56
vk::Semaphore imageAcquireSemaphore() const
Return the semaphore signalled when an image is acquired.
Definition: vku_framework.hpp:613
const std::vector< vk::UniqueFramebuffer > & framebuffers() const
Return the frame buffers used by this window.
Definition: vku_framework.hpp:570
uint32_t presentQueueFamily() const
Return the queue family index used to present the surface to the display.
Definition: vku_framework.hpp:558
int numImageIndices() const
Return the number of swap chain images.
Definition: vku_framework.hpp:622
vk::CommandPool commandPool() const
Return a defult command Pool to use to create new command buffers.
Definition: vku_framework.hpp:619
const std::vector< vk::Fence > & commandBufferFences() const
Return the fences used to control the static buffers.
Definition: vku_framework.hpp:610
An image to use as a depth buffer on a renderpass.
Definition: vku.hpp:1460
Vookoo high level C++ Vulkan interface.
Definition: vku.hpp:34