EDIT: folder structure refactoring (src/core)
This commit is contained in:
53
src/core/util/debug.cpp
Normal file
53
src/core/util/debug.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include <core/util/debug.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace vkdebug {
|
||||
|
||||
static inline PFN_vkCmdBeginDebugUtilsLabelEXT get_begin_fn(VkDevice device)
|
||||
{
|
||||
static PFN_vkCmdBeginDebugUtilsLabelEXT fn = nullptr;
|
||||
static VkDevice cached = VK_NULL_HANDLE;
|
||||
if (device != cached)
|
||||
{
|
||||
cached = device;
|
||||
fn = reinterpret_cast<PFN_vkCmdBeginDebugUtilsLabelEXT>(
|
||||
vkGetDeviceProcAddr(device, "vkCmdBeginDebugUtilsLabelEXT"));
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
static inline PFN_vkCmdEndDebugUtilsLabelEXT get_end_fn(VkDevice device)
|
||||
{
|
||||
static PFN_vkCmdEndDebugUtilsLabelEXT fn = nullptr;
|
||||
static VkDevice cached = VK_NULL_HANDLE;
|
||||
if (device != cached)
|
||||
{
|
||||
cached = device;
|
||||
fn = reinterpret_cast<PFN_vkCmdEndDebugUtilsLabelEXT>(
|
||||
vkGetDeviceProcAddr(device, "vkCmdEndDebugUtilsLabelEXT"));
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
void cmd_begin_label(VkDevice device, VkCommandBuffer cmd, const char* name,
|
||||
float r, float g, float b, float a)
|
||||
{
|
||||
auto fn = get_begin_fn(device);
|
||||
if (!fn) return;
|
||||
VkDebugUtilsLabelEXT label{};
|
||||
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
|
||||
label.pLabelName = name;
|
||||
label.color[0] = r; label.color[1] = g; label.color[2] = b; label.color[3] = a;
|
||||
fn(cmd, &label);
|
||||
}
|
||||
|
||||
void cmd_end_label(VkDevice device, VkCommandBuffer cmd)
|
||||
{
|
||||
auto fn = get_end_fn(device);
|
||||
if (!fn) return;
|
||||
fn(cmd);
|
||||
}
|
||||
|
||||
} // namespace vkdebug
|
||||
|
||||
14
src/core/util/debug.h
Normal file
14
src/core/util/debug.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/types.h>
|
||||
|
||||
namespace vkdebug
|
||||
{
|
||||
// Begin a debug label on a command buffer if VK_EXT_debug_utils is available.
|
||||
void cmd_begin_label(VkDevice device, VkCommandBuffer cmd, const char *name,
|
||||
float r = 0.2f, float g = 0.6f, float b = 0.9f, float a = 1.0f);
|
||||
|
||||
// End a debug label on a command buffer if VK_EXT_debug_utils is available.
|
||||
void cmd_end_label(VkDevice device, VkCommandBuffer cmd);
|
||||
}
|
||||
|
||||
411
src/core/util/initializers.cpp
Normal file
411
src/core/util/initializers.cpp
Normal file
@@ -0,0 +1,411 @@
|
||||
#include <core/util/initializers.h>
|
||||
|
||||
//> init_cmd
|
||||
VkCommandPoolCreateInfo vkinit::command_pool_create_info(uint32_t queueFamilyIndex,
|
||||
VkCommandPoolCreateFlags flags /*= 0*/)
|
||||
{
|
||||
VkCommandPoolCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
info.queueFamilyIndex = queueFamilyIndex;
|
||||
info.flags = flags;
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
VkCommandBufferAllocateInfo vkinit::command_buffer_allocate_info(
|
||||
VkCommandPool pool, uint32_t count /*= 1*/)
|
||||
{
|
||||
VkCommandBufferAllocateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.commandPool = pool;
|
||||
info.commandBufferCount = count;
|
||||
info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||
return info;
|
||||
}
|
||||
|
||||
//< init_cmd
|
||||
//
|
||||
//> init_cmd_draw
|
||||
VkCommandBufferBeginInfo vkinit::command_buffer_begin_info(VkCommandBufferUsageFlags flags /*= 0*/)
|
||||
{
|
||||
VkCommandBufferBeginInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.pInheritanceInfo = nullptr;
|
||||
info.flags = flags;
|
||||
return info;
|
||||
}
|
||||
|
||||
//< init_cmd_draw
|
||||
|
||||
//> init_sync
|
||||
VkFenceCreateInfo vkinit::fence_create_info(VkFenceCreateFlags flags /*= 0*/)
|
||||
{
|
||||
VkFenceCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.flags = flags;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
VkSemaphoreCreateInfo vkinit::semaphore_create_info(VkSemaphoreCreateFlags flags /*= 0*/)
|
||||
{
|
||||
VkSemaphoreCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
info.flags = flags;
|
||||
return info;
|
||||
}
|
||||
|
||||
//< init_sync
|
||||
|
||||
//> init_submit
|
||||
VkSemaphoreSubmitInfo vkinit::semaphore_submit_info(VkPipelineStageFlags2 stageMask, VkSemaphore semaphore)
|
||||
{
|
||||
VkSemaphoreSubmitInfo submitInfo{};
|
||||
submitInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO;
|
||||
submitInfo.pNext = nullptr;
|
||||
submitInfo.semaphore = semaphore;
|
||||
submitInfo.stageMask = stageMask;
|
||||
submitInfo.deviceIndex = 0;
|
||||
submitInfo.value = 1;
|
||||
|
||||
return submitInfo;
|
||||
}
|
||||
|
||||
VkCommandBufferSubmitInfo vkinit::command_buffer_submit_info(VkCommandBuffer cmd)
|
||||
{
|
||||
VkCommandBufferSubmitInfo info{};
|
||||
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO;
|
||||
info.pNext = nullptr;
|
||||
info.commandBuffer = cmd;
|
||||
info.deviceMask = 0;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
VkSubmitInfo2 vkinit::submit_info(VkCommandBufferSubmitInfo *cmd, VkSemaphoreSubmitInfo *signalSemaphoreInfo,
|
||||
VkSemaphoreSubmitInfo *waitSemaphoreInfo)
|
||||
{
|
||||
VkSubmitInfo2 info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO_2;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.waitSemaphoreInfoCount = waitSemaphoreInfo == nullptr ? 0 : 1;
|
||||
info.pWaitSemaphoreInfos = waitSemaphoreInfo;
|
||||
|
||||
info.signalSemaphoreInfoCount = signalSemaphoreInfo == nullptr ? 0 : 1;
|
||||
info.pSignalSemaphoreInfos = signalSemaphoreInfo;
|
||||
|
||||
info.commandBufferInfoCount = 1;
|
||||
info.pCommandBufferInfos = cmd;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
//< init_submit
|
||||
|
||||
VkPresentInfoKHR vkinit::present_info()
|
||||
{
|
||||
VkPresentInfoKHR info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
|
||||
info.pNext = 0;
|
||||
|
||||
info.swapchainCount = 0;
|
||||
info.pSwapchains = nullptr;
|
||||
info.pWaitSemaphores = nullptr;
|
||||
info.waitSemaphoreCount = 0;
|
||||
info.pImageIndices = nullptr;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
//> color_info
|
||||
VkRenderingAttachmentInfo vkinit::attachment_info(
|
||||
VkImageView view, VkClearValue *clear, VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/)
|
||||
{
|
||||
VkRenderingAttachmentInfo colorAttachment{};
|
||||
colorAttachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
|
||||
colorAttachment.pNext = nullptr;
|
||||
|
||||
colorAttachment.imageView = view;
|
||||
colorAttachment.imageLayout = layout;
|
||||
colorAttachment.loadOp = clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
colorAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
if (clear)
|
||||
{
|
||||
colorAttachment.clearValue = *clear;
|
||||
}
|
||||
|
||||
return colorAttachment;
|
||||
}
|
||||
|
||||
//< color_info
|
||||
//> depth_info
|
||||
VkRenderingAttachmentInfo vkinit::depth_attachment_info(
|
||||
VkImageView view, VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/)
|
||||
{
|
||||
VkRenderingAttachmentInfo depthAttachment{};
|
||||
depthAttachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
|
||||
depthAttachment.pNext = nullptr;
|
||||
|
||||
depthAttachment.imageView = view;
|
||||
depthAttachment.imageLayout = layout;
|
||||
depthAttachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
// Reverse-Z path clears to 0.0
|
||||
depthAttachment.clearValue.depthStencil.depth = 0.f;
|
||||
|
||||
return depthAttachment;
|
||||
}
|
||||
|
||||
//< depth_info
|
||||
//> render_info
|
||||
VkRenderingInfo vkinit::rendering_info(VkExtent2D renderExtent, VkRenderingAttachmentInfo *colorAttachment,
|
||||
VkRenderingAttachmentInfo *depthAttachment)
|
||||
{
|
||||
VkRenderingInfo renderInfo{};
|
||||
renderInfo.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
|
||||
renderInfo.pNext = nullptr;
|
||||
|
||||
renderInfo.renderArea = VkRect2D{VkOffset2D{0, 0}, renderExtent};
|
||||
renderInfo.layerCount = 1;
|
||||
renderInfo.colorAttachmentCount = 1;
|
||||
renderInfo.pColorAttachments = colorAttachment;
|
||||
renderInfo.pDepthAttachment = depthAttachment;
|
||||
renderInfo.pStencilAttachment = nullptr;
|
||||
|
||||
return renderInfo;
|
||||
}
|
||||
|
||||
VkRenderingInfo vkinit::rendering_info_multi(VkExtent2D renderExtent, uint32_t colorCount,
|
||||
VkRenderingAttachmentInfo *colorAttachments,
|
||||
VkRenderingAttachmentInfo *depthAttachment)
|
||||
{
|
||||
VkRenderingInfo renderInfo{};
|
||||
renderInfo.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
|
||||
renderInfo.pNext = nullptr;
|
||||
|
||||
renderInfo.renderArea = VkRect2D{VkOffset2D{0, 0}, renderExtent};
|
||||
renderInfo.layerCount = 1;
|
||||
renderInfo.colorAttachmentCount = colorCount;
|
||||
renderInfo.pColorAttachments = colorAttachments;
|
||||
renderInfo.pDepthAttachment = depthAttachment;
|
||||
renderInfo.pStencilAttachment = nullptr;
|
||||
|
||||
return renderInfo;
|
||||
}
|
||||
|
||||
//< render_info
|
||||
//> subresource
|
||||
VkImageSubresourceRange vkinit::image_subresource_range(VkImageAspectFlags aspectMask)
|
||||
{
|
||||
VkImageSubresourceRange subImage{};
|
||||
subImage.aspectMask = aspectMask;
|
||||
subImage.baseMipLevel = 0;
|
||||
subImage.levelCount = VK_REMAINING_MIP_LEVELS;
|
||||
subImage.baseArrayLayer = 0;
|
||||
subImage.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
||||
|
||||
return subImage;
|
||||
}
|
||||
|
||||
//< subresource
|
||||
|
||||
|
||||
VkDescriptorSetLayoutBinding vkinit::descriptorset_layout_binding(VkDescriptorType type, VkShaderStageFlags stageFlags,
|
||||
uint32_t binding)
|
||||
{
|
||||
VkDescriptorSetLayoutBinding setbind = {};
|
||||
setbind.binding = binding;
|
||||
setbind.descriptorCount = 1;
|
||||
setbind.descriptorType = type;
|
||||
setbind.pImmutableSamplers = nullptr;
|
||||
setbind.stageFlags = stageFlags;
|
||||
|
||||
return setbind;
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutCreateInfo vkinit::descriptorset_layout_create_info(VkDescriptorSetLayoutBinding *bindings,
|
||||
uint32_t bindingCount)
|
||||
{
|
||||
VkDescriptorSetLayoutCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.pBindings = bindings;
|
||||
info.bindingCount = bindingCount;
|
||||
info.flags = 0;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
VkWriteDescriptorSet vkinit::write_descriptor_image(VkDescriptorType type, VkDescriptorSet dstSet,
|
||||
VkDescriptorImageInfo *imageInfo, uint32_t binding)
|
||||
{
|
||||
VkWriteDescriptorSet write = {};
|
||||
write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
write.pNext = nullptr;
|
||||
|
||||
write.dstBinding = binding;
|
||||
write.dstSet = dstSet;
|
||||
write.descriptorCount = 1;
|
||||
write.descriptorType = type;
|
||||
write.pImageInfo = imageInfo;
|
||||
|
||||
return write;
|
||||
}
|
||||
|
||||
VkWriteDescriptorSet vkinit::write_descriptor_buffer(VkDescriptorType type, VkDescriptorSet dstSet,
|
||||
VkDescriptorBufferInfo *bufferInfo, uint32_t binding)
|
||||
{
|
||||
VkWriteDescriptorSet write = {};
|
||||
write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
write.pNext = nullptr;
|
||||
|
||||
write.dstBinding = binding;
|
||||
write.dstSet = dstSet;
|
||||
write.descriptorCount = 1;
|
||||
write.descriptorType = type;
|
||||
write.pBufferInfo = bufferInfo;
|
||||
|
||||
return write;
|
||||
}
|
||||
|
||||
VkDescriptorBufferInfo vkinit::buffer_info(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
|
||||
{
|
||||
VkDescriptorBufferInfo binfo{};
|
||||
binfo.buffer = buffer;
|
||||
binfo.offset = offset;
|
||||
binfo.range = range;
|
||||
return binfo;
|
||||
}
|
||||
|
||||
//> image_set
|
||||
VkImageCreateInfo vkinit::image_create_info(VkFormat format, VkImageUsageFlags usageFlags, VkExtent3D extent)
|
||||
{
|
||||
VkImageCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.imageType = VK_IMAGE_TYPE_2D;
|
||||
|
||||
info.format = format;
|
||||
info.extent = extent;
|
||||
|
||||
info.mipLevels = 1;
|
||||
info.arrayLayers = 1;
|
||||
|
||||
//for MSAA. we will not be using it by default, so default it to 1 sample per pixel.
|
||||
info.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
|
||||
//optimal tiling, which means the image is stored on the best gpu format
|
||||
info.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||
info.usage = usageFlags;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
VkImageCreateInfo vkinit::image_create_info(VkFormat format,
|
||||
VkImageUsageFlags usageFlags,
|
||||
VkExtent3D extent,
|
||||
uint32_t mipLevels,
|
||||
uint32_t arrayLayers,
|
||||
VkImageCreateFlags flags)
|
||||
{
|
||||
VkImageCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.flags = flags;
|
||||
info.imageType = VK_IMAGE_TYPE_2D;
|
||||
info.format = format;
|
||||
info.extent = extent;
|
||||
info.mipLevels = mipLevels > 0 ? mipLevels : 1;
|
||||
info.arrayLayers = arrayLayers > 0 ? arrayLayers : 1;
|
||||
info.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
info.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||
info.usage = usageFlags;
|
||||
return info;
|
||||
}
|
||||
|
||||
VkImageViewCreateInfo vkinit::imageview_create_info(VkFormat format, VkImage image, VkImageAspectFlags aspectFlags)
|
||||
{
|
||||
// build a image-view for the depth image to use for rendering
|
||||
VkImageViewCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
info.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
info.image = image;
|
||||
info.format = format;
|
||||
info.subresourceRange.baseMipLevel = 0;
|
||||
info.subresourceRange.levelCount = 1;
|
||||
info.subresourceRange.baseArrayLayer = 0;
|
||||
info.subresourceRange.layerCount = 1;
|
||||
info.subresourceRange.aspectMask = aspectFlags;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
VkImageViewCreateInfo vkinit::imageview_create_info(VkImageViewType viewType,
|
||||
VkFormat format,
|
||||
VkImage image,
|
||||
VkImageAspectFlags aspectFlags,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t levelCount,
|
||||
uint32_t baseArrayLayer,
|
||||
uint32_t layerCount)
|
||||
{
|
||||
VkImageViewCreateInfo info = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
info.viewType = viewType;
|
||||
info.image = image;
|
||||
info.format = format;
|
||||
info.subresourceRange.aspectMask = aspectFlags;
|
||||
info.subresourceRange.baseMipLevel = baseMipLevel;
|
||||
info.subresourceRange.levelCount = levelCount;
|
||||
info.subresourceRange.baseArrayLayer = baseArrayLayer;
|
||||
info.subresourceRange.layerCount = layerCount;
|
||||
return info;
|
||||
}
|
||||
|
||||
//< image_set
|
||||
VkPipelineLayoutCreateInfo vkinit::pipeline_layout_create_info()
|
||||
{
|
||||
VkPipelineLayoutCreateInfo info{};
|
||||
info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
// empty defaults
|
||||
info.flags = 0;
|
||||
info.setLayoutCount = 0;
|
||||
info.pSetLayouts = nullptr;
|
||||
info.pushConstantRangeCount = 0;
|
||||
info.pPushConstantRanges = nullptr;
|
||||
return info;
|
||||
}
|
||||
|
||||
VkPipelineShaderStageCreateInfo vkinit::pipeline_shader_stage_create_info(VkShaderStageFlagBits stage,
|
||||
VkShaderModule shaderModule,
|
||||
const char *entry)
|
||||
{
|
||||
VkPipelineShaderStageCreateInfo info{};
|
||||
info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
info.pNext = nullptr;
|
||||
|
||||
// shader stage
|
||||
info.stage = stage;
|
||||
// module containing the code for this shader stage
|
||||
info.module = shaderModule;
|
||||
// the entry point of the shader
|
||||
info.pName = entry;
|
||||
return info;
|
||||
}
|
||||
89
src/core/util/initializers.h
Normal file
89
src/core/util/initializers.h
Normal file
@@ -0,0 +1,89 @@
|
||||
// vulkan_engine.h : Include file for standard system include files,
|
||||
// or project specific include files.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/types.h>
|
||||
|
||||
namespace vkinit
|
||||
{
|
||||
//> init_cmd
|
||||
VkCommandPoolCreateInfo command_pool_create_info(uint32_t queueFamilyIndex, VkCommandPoolCreateFlags flags = 0);
|
||||
|
||||
VkCommandBufferAllocateInfo command_buffer_allocate_info(VkCommandPool pool, uint32_t count = 1);
|
||||
|
||||
//< init_cmd
|
||||
|
||||
VkCommandBufferBeginInfo command_buffer_begin_info(VkCommandBufferUsageFlags flags = 0);
|
||||
|
||||
VkCommandBufferSubmitInfo command_buffer_submit_info(VkCommandBuffer cmd);
|
||||
|
||||
VkFenceCreateInfo fence_create_info(VkFenceCreateFlags flags = 0);
|
||||
|
||||
VkSemaphoreCreateInfo semaphore_create_info(VkSemaphoreCreateFlags flags = 0);
|
||||
|
||||
VkSubmitInfo2 submit_info(VkCommandBufferSubmitInfo *cmd, VkSemaphoreSubmitInfo *signalSemaphoreInfo,
|
||||
VkSemaphoreSubmitInfo *waitSemaphoreInfo);
|
||||
|
||||
VkPresentInfoKHR present_info();
|
||||
|
||||
VkRenderingAttachmentInfo attachment_info(VkImageView view, VkClearValue *clear,
|
||||
VkImageLayout layout /*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/);
|
||||
|
||||
VkRenderingAttachmentInfo depth_attachment_info(VkImageView view,
|
||||
VkImageLayout layout
|
||||
/*= VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL*/);
|
||||
|
||||
VkRenderingInfo rendering_info(VkExtent2D renderExtent, VkRenderingAttachmentInfo *colorAttachment,
|
||||
VkRenderingAttachmentInfo *depthAttachment);
|
||||
|
||||
VkRenderingInfo rendering_info_multi(VkExtent2D renderExtent, uint32_t colorCount,
|
||||
VkRenderingAttachmentInfo *colorAttachments,
|
||||
VkRenderingAttachmentInfo *depthAttachment);
|
||||
|
||||
VkImageSubresourceRange image_subresource_range(VkImageAspectFlags aspectMask);
|
||||
|
||||
VkSemaphoreSubmitInfo semaphore_submit_info(VkPipelineStageFlags2 stageMask, VkSemaphore semaphore);
|
||||
|
||||
VkDescriptorSetLayoutBinding descriptorset_layout_binding(VkDescriptorType type, VkShaderStageFlags stageFlags,
|
||||
uint32_t binding);
|
||||
|
||||
VkDescriptorSetLayoutCreateInfo descriptorset_layout_create_info(VkDescriptorSetLayoutBinding *bindings,
|
||||
uint32_t bindingCount);
|
||||
|
||||
VkWriteDescriptorSet write_descriptor_image(VkDescriptorType type, VkDescriptorSet dstSet,
|
||||
VkDescriptorImageInfo *imageInfo, uint32_t binding);
|
||||
|
||||
VkWriteDescriptorSet write_descriptor_buffer(VkDescriptorType type, VkDescriptorSet dstSet,
|
||||
VkDescriptorBufferInfo *bufferInfo, uint32_t binding);
|
||||
|
||||
VkDescriptorBufferInfo buffer_info(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range);
|
||||
|
||||
VkImageCreateInfo image_create_info(VkFormat format, VkImageUsageFlags usageFlags, VkExtent3D extent);
|
||||
|
||||
VkImageViewCreateInfo imageview_create_info(VkFormat format, VkImage image, VkImageAspectFlags aspectFlags);
|
||||
|
||||
// Overload: explicit mip/array counts and image flags (e.g., cube compatible)
|
||||
VkImageCreateInfo image_create_info(VkFormat format,
|
||||
VkImageUsageFlags usageFlags,
|
||||
VkExtent3D extent,
|
||||
uint32_t mipLevels,
|
||||
uint32_t arrayLayers,
|
||||
VkImageCreateFlags flags);
|
||||
|
||||
// Overload: explicit view type and subresource counts for layered/cubemap views
|
||||
VkImageViewCreateInfo imageview_create_info(VkImageViewType viewType,
|
||||
VkFormat format,
|
||||
VkImage image,
|
||||
VkImageAspectFlags aspectFlags,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t levelCount,
|
||||
uint32_t baseArrayLayer,
|
||||
uint32_t layerCount);
|
||||
|
||||
VkPipelineLayoutCreateInfo pipeline_layout_create_info();
|
||||
|
||||
VkPipelineShaderStageCreateInfo pipeline_shader_stage_create_info(VkShaderStageFlagBits stage,
|
||||
VkShaderModule shaderModule,
|
||||
const char *entry = "main");
|
||||
} // namespace vkinit
|
||||
Reference in New Issue
Block a user