Moved initializers to separate header, code cleanup in general for initializers
This commit is contained in:
parent
b2f224341f
commit
c4e50f76ee
5 changed files with 547 additions and 721 deletions
542
base/VulkanInitializers.hpp
Normal file
542
base/VulkanInitializers.hpp
Normal file
|
|
@ -0,0 +1,542 @@
|
||||||
|
/*
|
||||||
|
* Initializers for Vulkan structures and objects used by the examples
|
||||||
|
* Saves lot of VK_STRUCTURE_TYPE assignments
|
||||||
|
* Some initializers are parameterized for convenience
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
|
||||||
|
*
|
||||||
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "vulkan/vulkan.h"
|
||||||
|
|
||||||
|
namespace vkTools
|
||||||
|
{
|
||||||
|
namespace initializers
|
||||||
|
{
|
||||||
|
|
||||||
|
inline VkMemoryAllocateInfo memoryAllocateInfo()
|
||||||
|
{
|
||||||
|
VkMemoryAllocateInfo memAllocInfo {};
|
||||||
|
memAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||||
|
return memAllocInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkMappedMemoryRange mappedMemoryRange()
|
||||||
|
{
|
||||||
|
VkMappedMemoryRange mappedMemoryRange {};
|
||||||
|
mappedMemoryRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
||||||
|
return mappedMemoryRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkCommandBufferAllocateInfo commandBufferAllocateInfo(
|
||||||
|
VkCommandPool commandPool,
|
||||||
|
VkCommandBufferLevel level,
|
||||||
|
uint32_t bufferCount)
|
||||||
|
{
|
||||||
|
VkCommandBufferAllocateInfo commandBufferAllocateInfo {};
|
||||||
|
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||||
|
commandBufferAllocateInfo.commandPool = commandPool;
|
||||||
|
commandBufferAllocateInfo.level = level;
|
||||||
|
commandBufferAllocateInfo.commandBufferCount = bufferCount;
|
||||||
|
return commandBufferAllocateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkCommandPoolCreateInfo commandPoolCreateInfo()
|
||||||
|
{
|
||||||
|
VkCommandPoolCreateInfo cmdPoolCreateInfo {};
|
||||||
|
cmdPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||||
|
return cmdPoolCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkCommandBufferBeginInfo commandBufferBeginInfo()
|
||||||
|
{
|
||||||
|
VkCommandBufferBeginInfo cmdBufferBeginInfo {};
|
||||||
|
cmdBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||||
|
return cmdBufferBeginInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkCommandBufferInheritanceInfo commandBufferInheritanceInfo()
|
||||||
|
{
|
||||||
|
VkCommandBufferInheritanceInfo cmdBufferInheritanceInfo {};
|
||||||
|
cmdBufferInheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
|
||||||
|
return cmdBufferInheritanceInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkRenderPassBeginInfo renderPassBeginInfo()
|
||||||
|
{
|
||||||
|
VkRenderPassBeginInfo renderPassBeginInfo {};
|
||||||
|
renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||||
|
return renderPassBeginInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkRenderPassCreateInfo renderPassCreateInfo()
|
||||||
|
{
|
||||||
|
VkRenderPassCreateInfo renderPassCreateInfo {};
|
||||||
|
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||||
|
return renderPassCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief Initialize an image memory barrier with no image transfer ownership */
|
||||||
|
inline VkImageMemoryBarrier imageMemoryBarrier()
|
||||||
|
{
|
||||||
|
VkImageMemoryBarrier imageMemoryBarrier {};
|
||||||
|
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||||
|
imageMemoryBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
imageMemoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
return imageMemoryBarrier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief Initialize a buffer memory barrier with no image transfer ownership */
|
||||||
|
inline VkBufferMemoryBarrier bufferMemoryBarrier()
|
||||||
|
{
|
||||||
|
VkBufferMemoryBarrier bufferMemoryBarrier {};
|
||||||
|
bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
||||||
|
bufferMemoryBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
bufferMemoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||||
|
return bufferMemoryBarrier;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkMemoryBarrier memoryBarrier()
|
||||||
|
{
|
||||||
|
VkMemoryBarrier memoryBarrier {};
|
||||||
|
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
||||||
|
return memoryBarrier;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkImageCreateInfo imageCreateInfo()
|
||||||
|
{
|
||||||
|
VkImageCreateInfo imageCreateInfo {};
|
||||||
|
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||||
|
return imageCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkSamplerCreateInfo samplerCreateInfo()
|
||||||
|
{
|
||||||
|
VkSamplerCreateInfo samplerCreateInfo {};
|
||||||
|
samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||||
|
return samplerCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkImageViewCreateInfo imageViewCreateInfo()
|
||||||
|
{
|
||||||
|
VkImageViewCreateInfo imageViewCreateInfo {};
|
||||||
|
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||||
|
return imageViewCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkFramebufferCreateInfo framebufferCreateInfo()
|
||||||
|
{
|
||||||
|
VkFramebufferCreateInfo framebufferCreateInfo {};
|
||||||
|
framebufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
||||||
|
return framebufferCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkSemaphoreCreateInfo semaphoreCreateInfo()
|
||||||
|
{
|
||||||
|
VkSemaphoreCreateInfo semaphoreCreateInfo {};
|
||||||
|
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||||
|
return semaphoreCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkFenceCreateInfo fenceCreateInfo(VkFenceCreateFlags flags = 0)
|
||||||
|
{
|
||||||
|
VkFenceCreateInfo fenceCreateInfo {};
|
||||||
|
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||||
|
fenceCreateInfo.flags = flags;
|
||||||
|
return fenceCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkEventCreateInfo eventCreateInfo()
|
||||||
|
{
|
||||||
|
VkEventCreateInfo eventCreateInfo {};
|
||||||
|
eventCreateInfo.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
|
||||||
|
return eventCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkSubmitInfo submitInfo()
|
||||||
|
{
|
||||||
|
VkSubmitInfo submitInfo {};
|
||||||
|
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||||
|
return submitInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkViewport viewport(
|
||||||
|
float width,
|
||||||
|
float height,
|
||||||
|
float minDepth,
|
||||||
|
float maxDepth)
|
||||||
|
{
|
||||||
|
VkViewport viewport {};
|
||||||
|
viewport.width = width;
|
||||||
|
viewport.height = height;
|
||||||
|
viewport.minDepth = minDepth;
|
||||||
|
viewport.maxDepth = maxDepth;
|
||||||
|
return viewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkRect2D rect2D(
|
||||||
|
int32_t width,
|
||||||
|
int32_t height,
|
||||||
|
int32_t offsetX,
|
||||||
|
int32_t offsetY)
|
||||||
|
{
|
||||||
|
VkRect2D rect2D {};
|
||||||
|
rect2D.extent.width = width;
|
||||||
|
rect2D.extent.height = height;
|
||||||
|
rect2D.offset.x = offsetX;
|
||||||
|
rect2D.offset.y = offsetY;
|
||||||
|
return rect2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkBufferCreateInfo bufferCreateInfo()
|
||||||
|
{
|
||||||
|
VkBufferCreateInfo bufCreateInfo {};
|
||||||
|
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
||||||
|
return bufCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkBufferCreateInfo bufferCreateInfo(
|
||||||
|
VkBufferUsageFlags usage,
|
||||||
|
VkDeviceSize size)
|
||||||
|
{
|
||||||
|
VkBufferCreateInfo bufCreateInfo {};
|
||||||
|
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
||||||
|
bufCreateInfo.usage = usage;
|
||||||
|
bufCreateInfo.size = size;
|
||||||
|
return bufCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkDescriptorPoolCreateInfo descriptorPoolCreateInfo(
|
||||||
|
uint32_t poolSizeCount,
|
||||||
|
VkDescriptorPoolSize* pPoolSizes,
|
||||||
|
uint32_t maxSets)
|
||||||
|
{
|
||||||
|
VkDescriptorPoolCreateInfo descriptorPoolInfo {};
|
||||||
|
descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||||
|
descriptorPoolInfo.poolSizeCount = poolSizeCount;
|
||||||
|
descriptorPoolInfo.pPoolSizes = pPoolSizes;
|
||||||
|
descriptorPoolInfo.maxSets = maxSets;
|
||||||
|
return descriptorPoolInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkDescriptorPoolSize descriptorPoolSize(
|
||||||
|
VkDescriptorType type,
|
||||||
|
uint32_t descriptorCount)
|
||||||
|
{
|
||||||
|
VkDescriptorPoolSize descriptorPoolSize {};
|
||||||
|
descriptorPoolSize.type = type;
|
||||||
|
descriptorPoolSize.descriptorCount = descriptorCount;
|
||||||
|
return descriptorPoolSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkDescriptorSetLayoutBinding descriptorSetLayoutBinding(
|
||||||
|
VkDescriptorType type,
|
||||||
|
VkShaderStageFlags stageFlags,
|
||||||
|
uint32_t binding,
|
||||||
|
uint32_t descriptorCount = 1)
|
||||||
|
{
|
||||||
|
VkDescriptorSetLayoutBinding setLayoutBinding {};
|
||||||
|
setLayoutBinding.descriptorType = type;
|
||||||
|
setLayoutBinding.stageFlags = stageFlags;
|
||||||
|
setLayoutBinding.binding = binding;
|
||||||
|
setLayoutBinding.descriptorCount = descriptorCount;
|
||||||
|
return setLayoutBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo(
|
||||||
|
const VkDescriptorSetLayoutBinding* pBindings,
|
||||||
|
uint32_t bindingCount)
|
||||||
|
{
|
||||||
|
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo {};
|
||||||
|
descriptorSetLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||||
|
descriptorSetLayoutCreateInfo.pBindings = pBindings;
|
||||||
|
descriptorSetLayoutCreateInfo.bindingCount = bindingCount;
|
||||||
|
return descriptorSetLayoutCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo(
|
||||||
|
const VkDescriptorSetLayout* pSetLayouts,
|
||||||
|
uint32_t setLayoutCount = 1)
|
||||||
|
{
|
||||||
|
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo {};
|
||||||
|
pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||||
|
pipelineLayoutCreateInfo.setLayoutCount = setLayoutCount;
|
||||||
|
pipelineLayoutCreateInfo.pSetLayouts = pSetLayouts;
|
||||||
|
return pipelineLayoutCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo(
|
||||||
|
uint32_t setLayoutCount = 1)
|
||||||
|
{
|
||||||
|
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{};
|
||||||
|
pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||||
|
pipelineLayoutCreateInfo.setLayoutCount = setLayoutCount;
|
||||||
|
return pipelineLayoutCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkDescriptorSetAllocateInfo descriptorSetAllocateInfo(
|
||||||
|
VkDescriptorPool descriptorPool,
|
||||||
|
const VkDescriptorSetLayout* pSetLayouts,
|
||||||
|
uint32_t descriptorSetCount)
|
||||||
|
{
|
||||||
|
VkDescriptorSetAllocateInfo descriptorSetAllocateInfo {};
|
||||||
|
descriptorSetAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||||
|
descriptorSetAllocateInfo.descriptorPool = descriptorPool;
|
||||||
|
descriptorSetAllocateInfo.pSetLayouts = pSetLayouts;
|
||||||
|
descriptorSetAllocateInfo.descriptorSetCount = descriptorSetCount;
|
||||||
|
return descriptorSetAllocateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkDescriptorImageInfo descriptorImageInfo(VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout)
|
||||||
|
{
|
||||||
|
VkDescriptorImageInfo descriptorImageInfo {};
|
||||||
|
descriptorImageInfo.sampler = sampler;
|
||||||
|
descriptorImageInfo.imageView = imageView;
|
||||||
|
descriptorImageInfo.imageLayout = imageLayout;
|
||||||
|
return descriptorImageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkWriteDescriptorSet writeDescriptorSet(
|
||||||
|
VkDescriptorSet dstSet,
|
||||||
|
VkDescriptorType type,
|
||||||
|
uint32_t binding,
|
||||||
|
VkDescriptorBufferInfo* bufferInfo,
|
||||||
|
uint32_t descriptorCount = 1)
|
||||||
|
{
|
||||||
|
VkWriteDescriptorSet writeDescriptorSet {};
|
||||||
|
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
|
writeDescriptorSet.dstSet = dstSet;
|
||||||
|
writeDescriptorSet.descriptorType = type;
|
||||||
|
writeDescriptorSet.dstBinding = binding;
|
||||||
|
writeDescriptorSet.pBufferInfo = bufferInfo;
|
||||||
|
writeDescriptorSet.descriptorCount = descriptorCount;
|
||||||
|
return writeDescriptorSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkWriteDescriptorSet writeDescriptorSet(
|
||||||
|
VkDescriptorSet dstSet,
|
||||||
|
VkDescriptorType type,
|
||||||
|
uint32_t binding,
|
||||||
|
VkDescriptorImageInfo *imageInfo,
|
||||||
|
uint32_t descriptorCount = 1)
|
||||||
|
{
|
||||||
|
VkWriteDescriptorSet writeDescriptorSet {};
|
||||||
|
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
|
writeDescriptorSet.dstSet = dstSet;
|
||||||
|
writeDescriptorSet.descriptorType = type;
|
||||||
|
writeDescriptorSet.dstBinding = binding;
|
||||||
|
writeDescriptorSet.pImageInfo = imageInfo;
|
||||||
|
writeDescriptorSet.descriptorCount = descriptorCount;
|
||||||
|
return writeDescriptorSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkVertexInputBindingDescription vertexInputBindingDescription(
|
||||||
|
uint32_t binding,
|
||||||
|
uint32_t stride,
|
||||||
|
VkVertexInputRate inputRate)
|
||||||
|
{
|
||||||
|
VkVertexInputBindingDescription vInputBindDescription {};
|
||||||
|
vInputBindDescription.binding = binding;
|
||||||
|
vInputBindDescription.stride = stride;
|
||||||
|
vInputBindDescription.inputRate = inputRate;
|
||||||
|
return vInputBindDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkVertexInputAttributeDescription vertexInputAttributeDescription(
|
||||||
|
uint32_t binding,
|
||||||
|
uint32_t location,
|
||||||
|
VkFormat format,
|
||||||
|
uint32_t offset)
|
||||||
|
{
|
||||||
|
VkVertexInputAttributeDescription vInputAttribDescription {};
|
||||||
|
vInputAttribDescription.location = location;
|
||||||
|
vInputAttribDescription.binding = binding;
|
||||||
|
vInputAttribDescription.format = format;
|
||||||
|
vInputAttribDescription.offset = offset;
|
||||||
|
return vInputAttribDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo()
|
||||||
|
{
|
||||||
|
VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo {};
|
||||||
|
pipelineVertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
||||||
|
return pipelineVertexInputStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo(
|
||||||
|
VkPrimitiveTopology topology,
|
||||||
|
VkPipelineInputAssemblyStateCreateFlags flags,
|
||||||
|
VkBool32 primitiveRestartEnable)
|
||||||
|
{
|
||||||
|
VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo {};
|
||||||
|
pipelineInputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
||||||
|
pipelineInputAssemblyStateCreateInfo.topology = topology;
|
||||||
|
pipelineInputAssemblyStateCreateInfo.flags = flags;
|
||||||
|
pipelineInputAssemblyStateCreateInfo.primitiveRestartEnable = primitiveRestartEnable;
|
||||||
|
return pipelineInputAssemblyStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo(
|
||||||
|
VkPolygonMode polygonMode,
|
||||||
|
VkCullModeFlags cullMode,
|
||||||
|
VkFrontFace frontFace,
|
||||||
|
VkPipelineRasterizationStateCreateFlags flags)
|
||||||
|
{
|
||||||
|
VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo {};
|
||||||
|
pipelineRasterizationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||||
|
pipelineRasterizationStateCreateInfo.polygonMode = polygonMode;
|
||||||
|
pipelineRasterizationStateCreateInfo.cullMode = cullMode;
|
||||||
|
pipelineRasterizationStateCreateInfo.frontFace = frontFace;
|
||||||
|
pipelineRasterizationStateCreateInfo.flags = flags;
|
||||||
|
pipelineRasterizationStateCreateInfo.depthClampEnable = VK_FALSE;
|
||||||
|
pipelineRasterizationStateCreateInfo.lineWidth = 1.0f;
|
||||||
|
return pipelineRasterizationStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState(
|
||||||
|
VkColorComponentFlags colorWriteMask,
|
||||||
|
VkBool32 blendEnable)
|
||||||
|
{
|
||||||
|
VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState {};
|
||||||
|
pipelineColorBlendAttachmentState.colorWriteMask = colorWriteMask;
|
||||||
|
pipelineColorBlendAttachmentState.blendEnable = blendEnable;
|
||||||
|
return pipelineColorBlendAttachmentState;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo(
|
||||||
|
uint32_t attachmentCount,
|
||||||
|
const VkPipelineColorBlendAttachmentState * pAttachments)
|
||||||
|
{
|
||||||
|
VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo {};
|
||||||
|
pipelineColorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
||||||
|
pipelineColorBlendStateCreateInfo.attachmentCount = attachmentCount;
|
||||||
|
pipelineColorBlendStateCreateInfo.pAttachments = pAttachments;
|
||||||
|
return pipelineColorBlendStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineDepthStencilStateCreateInfo pipelineDepthStencilStateCreateInfo(
|
||||||
|
VkBool32 depthTestEnable,
|
||||||
|
VkBool32 depthWriteEnable,
|
||||||
|
VkCompareOp depthCompareOp)
|
||||||
|
{
|
||||||
|
VkPipelineDepthStencilStateCreateInfo pipelineDepthStencilStateCreateInfo {};
|
||||||
|
pipelineDepthStencilStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
||||||
|
pipelineDepthStencilStateCreateInfo.depthTestEnable = depthTestEnable;
|
||||||
|
pipelineDepthStencilStateCreateInfo.depthWriteEnable = depthWriteEnable;
|
||||||
|
pipelineDepthStencilStateCreateInfo.depthCompareOp = depthCompareOp;
|
||||||
|
pipelineDepthStencilStateCreateInfo.front = pipelineDepthStencilStateCreateInfo.back;
|
||||||
|
pipelineDepthStencilStateCreateInfo.back.compareOp = VK_COMPARE_OP_ALWAYS;
|
||||||
|
return pipelineDepthStencilStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineViewportStateCreateInfo pipelineViewportStateCreateInfo(
|
||||||
|
uint32_t viewportCount,
|
||||||
|
uint32_t scissorCount,
|
||||||
|
VkPipelineViewportStateCreateFlags flags)
|
||||||
|
{
|
||||||
|
VkPipelineViewportStateCreateInfo pipelineViewportStateCreateInfo {};
|
||||||
|
pipelineViewportStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
||||||
|
pipelineViewportStateCreateInfo.viewportCount = viewportCount;
|
||||||
|
pipelineViewportStateCreateInfo.scissorCount = scissorCount;
|
||||||
|
pipelineViewportStateCreateInfo.flags = flags;
|
||||||
|
return pipelineViewportStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo(
|
||||||
|
VkSampleCountFlagBits rasterizationSamples,
|
||||||
|
VkPipelineMultisampleStateCreateFlags flags)
|
||||||
|
{
|
||||||
|
VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo {};
|
||||||
|
pipelineMultisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||||
|
pipelineMultisampleStateCreateInfo.rasterizationSamples = rasterizationSamples;
|
||||||
|
return pipelineMultisampleStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo(
|
||||||
|
const VkDynamicState * pDynamicStates,
|
||||||
|
uint32_t dynamicStateCount,
|
||||||
|
VkPipelineDynamicStateCreateFlags flags = 0)
|
||||||
|
{
|
||||||
|
VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo {};
|
||||||
|
pipelineDynamicStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
||||||
|
pipelineDynamicStateCreateInfo.pDynamicStates = pDynamicStates;
|
||||||
|
pipelineDynamicStateCreateInfo.dynamicStateCount = dynamicStateCount;
|
||||||
|
return pipelineDynamicStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo(uint32_t patchControlPoints)
|
||||||
|
{
|
||||||
|
VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo {};
|
||||||
|
pipelineTessellationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
||||||
|
pipelineTessellationStateCreateInfo.patchControlPoints = patchControlPoints;
|
||||||
|
return pipelineTessellationStateCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkGraphicsPipelineCreateInfo pipelineCreateInfo(
|
||||||
|
VkPipelineLayout layout,
|
||||||
|
VkRenderPass renderPass,
|
||||||
|
VkPipelineCreateFlags flags = 0)
|
||||||
|
{
|
||||||
|
VkGraphicsPipelineCreateInfo pipelineCreateInfo {};
|
||||||
|
pipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
|
pipelineCreateInfo.layout = layout;
|
||||||
|
pipelineCreateInfo.renderPass = renderPass;
|
||||||
|
pipelineCreateInfo.flags = flags;
|
||||||
|
return pipelineCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkComputePipelineCreateInfo computePipelineCreateInfo(
|
||||||
|
VkPipelineLayout layout,
|
||||||
|
VkPipelineCreateFlags flags = 0)
|
||||||
|
{
|
||||||
|
VkComputePipelineCreateInfo computePipelineCreateInfo {};
|
||||||
|
computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
||||||
|
computePipelineCreateInfo.layout = layout;
|
||||||
|
computePipelineCreateInfo.flags = flags;
|
||||||
|
return computePipelineCreateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkPushConstantRange pushConstantRange(
|
||||||
|
VkShaderStageFlags stageFlags,
|
||||||
|
uint32_t size,
|
||||||
|
uint32_t offset)
|
||||||
|
{
|
||||||
|
VkPushConstantRange pushConstantRange {};
|
||||||
|
pushConstantRange.stageFlags = stageFlags;
|
||||||
|
pushConstantRange.offset = offset;
|
||||||
|
pushConstantRange.size = size;
|
||||||
|
return pushConstantRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VkBindSparseInfo bindSparseInfo()
|
||||||
|
{
|
||||||
|
VkBindSparseInfo bindSparseInfo{};
|
||||||
|
bindSparseInfo.sType = VK_STRUCTURE_TYPE_BIND_SPARSE_INFO;
|
||||||
|
return bindSparseInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief Initialize a map entry for a shader specialization constant */
|
||||||
|
inline VkSpecializationMapEntry specializationMapEntry(uint32_t constantID, uint32_t offset, size_t size)
|
||||||
|
{
|
||||||
|
VkSpecializationMapEntry specializationMapEntry{};
|
||||||
|
specializationMapEntry.constantID = constantID;
|
||||||
|
specializationMapEntry.offset = offset;
|
||||||
|
specializationMapEntry.size = size;
|
||||||
|
return specializationMapEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief Initialize a specialization constant info structure to pass to a shader stage */
|
||||||
|
inline VkSpecializationInfo specializationInfo(uint32_t mapEntryCount, const VkSpecializationMapEntry* mapEntries, size_t dataSize, const void* data)
|
||||||
|
{
|
||||||
|
VkSpecializationInfo specializationInfo{};
|
||||||
|
specializationInfo.mapEntryCount = mapEntryCount;
|
||||||
|
specializationInfo.pMapEntries = mapEntries;
|
||||||
|
specializationInfo.dataSize = dataSize;
|
||||||
|
specializationInfo.pData = data;
|
||||||
|
return specializationInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
#include "vulkantools.h"
|
#include "vulkantools.h"
|
||||||
#include "vulkandebug.h"
|
#include "vulkandebug.h"
|
||||||
|
|
||||||
|
#include "VulkanInitializers.hpp"
|
||||||
#include "vulkandevice.hpp"
|
#include "vulkandevice.hpp"
|
||||||
#include "vulkanswapchain.hpp"
|
#include "vulkanswapchain.hpp"
|
||||||
#include "vulkanTextureLoader.hpp"
|
#include "vulkanTextureLoader.hpp"
|
||||||
|
|
|
||||||
|
|
@ -329,543 +329,4 @@ namespace vkTools
|
||||||
|
|
||||||
return shaderModule;
|
return shaderModule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VkMemoryAllocateInfo vkTools::initializers::memoryAllocateInfo()
|
|
||||||
{
|
|
||||||
VkMemoryAllocateInfo memAllocInfo = {};
|
|
||||||
memAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
|
||||||
memAllocInfo.pNext = NULL;
|
|
||||||
memAllocInfo.allocationSize = 0;
|
|
||||||
memAllocInfo.memoryTypeIndex = 0;
|
|
||||||
return memAllocInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkMappedMemoryRange vkTools::initializers::mappedMemoryRange()
|
|
||||||
{
|
|
||||||
VkMappedMemoryRange mappedMemoryRange = {};
|
|
||||||
mappedMemoryRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
|
||||||
return mappedMemoryRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkCommandBufferAllocateInfo vkTools::initializers::commandBufferAllocateInfo(VkCommandPool commandPool, VkCommandBufferLevel level, uint32_t bufferCount)
|
|
||||||
{
|
|
||||||
VkCommandBufferAllocateInfo commandBufferAllocateInfo = {};
|
|
||||||
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
|
||||||
commandBufferAllocateInfo.commandPool = commandPool;
|
|
||||||
commandBufferAllocateInfo.level = level;
|
|
||||||
commandBufferAllocateInfo.commandBufferCount = bufferCount;
|
|
||||||
return commandBufferAllocateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkCommandPoolCreateInfo vkTools::initializers::commandPoolCreateInfo()
|
|
||||||
{
|
|
||||||
VkCommandPoolCreateInfo cmdPoolCreateInfo = {};
|
|
||||||
cmdPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
|
||||||
return cmdPoolCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkCommandBufferBeginInfo vkTools::initializers::commandBufferBeginInfo()
|
|
||||||
{
|
|
||||||
VkCommandBufferBeginInfo cmdBufferBeginInfo = {};
|
|
||||||
cmdBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
|
||||||
cmdBufferBeginInfo.pNext = NULL;
|
|
||||||
return cmdBufferBeginInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkCommandBufferInheritanceInfo vkTools::initializers::commandBufferInheritanceInfo()
|
|
||||||
{
|
|
||||||
VkCommandBufferInheritanceInfo cmdBufferInheritanceInfo = {};
|
|
||||||
cmdBufferInheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
|
|
||||||
return cmdBufferInheritanceInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkRenderPassBeginInfo vkTools::initializers::renderPassBeginInfo()
|
|
||||||
{
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = {};
|
|
||||||
renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
|
||||||
renderPassBeginInfo.pNext = NULL;
|
|
||||||
return renderPassBeginInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkRenderPassCreateInfo vkTools::initializers::renderPassCreateInfo()
|
|
||||||
{
|
|
||||||
VkRenderPassCreateInfo renderPassCreateInfo = {};
|
|
||||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
|
||||||
renderPassCreateInfo.pNext = NULL;
|
|
||||||
return renderPassCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkImageMemoryBarrier vkTools::initializers::imageMemoryBarrier()
|
|
||||||
{
|
|
||||||
VkImageMemoryBarrier imageMemoryBarrier = {};
|
|
||||||
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
|
||||||
imageMemoryBarrier.pNext = NULL;
|
|
||||||
// Some default values
|
|
||||||
imageMemoryBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
imageMemoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
|
||||||
return imageMemoryBarrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkBufferMemoryBarrier vkTools::initializers::bufferMemoryBarrier()
|
|
||||||
{
|
|
||||||
VkBufferMemoryBarrier bufferMemoryBarrier = {};
|
|
||||||
bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
|
||||||
bufferMemoryBarrier.pNext = NULL;
|
|
||||||
return bufferMemoryBarrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkMemoryBarrier vkTools::initializers::memoryBarrier()
|
|
||||||
{
|
|
||||||
VkMemoryBarrier memoryBarrier = {};
|
|
||||||
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
|
||||||
memoryBarrier.pNext = NULL;
|
|
||||||
return memoryBarrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkImageCreateInfo vkTools::initializers::imageCreateInfo()
|
|
||||||
{
|
|
||||||
VkImageCreateInfo imageCreateInfo = {};
|
|
||||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
|
||||||
imageCreateInfo.pNext = NULL;
|
|
||||||
return imageCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkSamplerCreateInfo vkTools::initializers::samplerCreateInfo()
|
|
||||||
{
|
|
||||||
VkSamplerCreateInfo samplerCreateInfo = {};
|
|
||||||
samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
|
||||||
samplerCreateInfo.pNext = NULL;
|
|
||||||
return samplerCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkImageViewCreateInfo vkTools::initializers::imageViewCreateInfo()
|
|
||||||
{
|
|
||||||
VkImageViewCreateInfo imageViewCreateInfo = {};
|
|
||||||
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
|
||||||
imageViewCreateInfo.pNext = NULL;
|
|
||||||
return imageViewCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkFramebufferCreateInfo vkTools::initializers::framebufferCreateInfo()
|
|
||||||
{
|
|
||||||
VkFramebufferCreateInfo framebufferCreateInfo = {};
|
|
||||||
framebufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
|
||||||
framebufferCreateInfo.pNext = NULL;
|
|
||||||
return framebufferCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkSemaphoreCreateInfo vkTools::initializers::semaphoreCreateInfo()
|
|
||||||
{
|
|
||||||
VkSemaphoreCreateInfo semaphoreCreateInfo = {};
|
|
||||||
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
|
||||||
semaphoreCreateInfo.pNext = NULL;
|
|
||||||
semaphoreCreateInfo.flags = 0;
|
|
||||||
return semaphoreCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkFenceCreateInfo vkTools::initializers::fenceCreateInfo(VkFenceCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkFenceCreateInfo fenceCreateInfo = {};
|
|
||||||
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
|
||||||
fenceCreateInfo.flags = flags;
|
|
||||||
return fenceCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkEventCreateInfo vkTools::initializers::eventCreateInfo()
|
|
||||||
{
|
|
||||||
VkEventCreateInfo eventCreateInfo = {};
|
|
||||||
eventCreateInfo.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
|
|
||||||
return eventCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkSubmitInfo vkTools::initializers::submitInfo()
|
|
||||||
{
|
|
||||||
VkSubmitInfo submitInfo = {};
|
|
||||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
|
||||||
submitInfo.pNext = NULL;
|
|
||||||
return submitInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkViewport vkTools::initializers::viewport(
|
|
||||||
float width,
|
|
||||||
float height,
|
|
||||||
float minDepth,
|
|
||||||
float maxDepth)
|
|
||||||
{
|
|
||||||
VkViewport viewport = {};
|
|
||||||
viewport.width = width;
|
|
||||||
viewport.height = height;
|
|
||||||
viewport.minDepth = minDepth;
|
|
||||||
viewport.maxDepth = maxDepth;
|
|
||||||
return viewport;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkRect2D vkTools::initializers::rect2D(
|
|
||||||
int32_t width,
|
|
||||||
int32_t height,
|
|
||||||
int32_t offsetX,
|
|
||||||
int32_t offsetY)
|
|
||||||
{
|
|
||||||
VkRect2D rect2D = {};
|
|
||||||
rect2D.extent.width = width;
|
|
||||||
rect2D.extent.height = height;
|
|
||||||
rect2D.offset.x = offsetX;
|
|
||||||
rect2D.offset.y = offsetY;
|
|
||||||
return rect2D;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkBufferCreateInfo vkTools::initializers::bufferCreateInfo()
|
|
||||||
{
|
|
||||||
VkBufferCreateInfo bufCreateInfo = {};
|
|
||||||
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
|
||||||
return bufCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkBufferCreateInfo vkTools::initializers::bufferCreateInfo(
|
|
||||||
VkBufferUsageFlags usage,
|
|
||||||
VkDeviceSize size)
|
|
||||||
{
|
|
||||||
VkBufferCreateInfo bufCreateInfo = {};
|
|
||||||
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
|
||||||
bufCreateInfo.pNext = NULL;
|
|
||||||
bufCreateInfo.usage = usage;
|
|
||||||
bufCreateInfo.size = size;
|
|
||||||
bufCreateInfo.flags = 0;
|
|
||||||
return bufCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo vkTools::initializers::descriptorPoolCreateInfo(
|
|
||||||
uint32_t poolSizeCount,
|
|
||||||
VkDescriptorPoolSize* pPoolSizes,
|
|
||||||
uint32_t maxSets)
|
|
||||||
{
|
|
||||||
VkDescriptorPoolCreateInfo descriptorPoolInfo = {};
|
|
||||||
descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
|
||||||
descriptorPoolInfo.pNext = NULL;
|
|
||||||
descriptorPoolInfo.poolSizeCount = poolSizeCount;
|
|
||||||
descriptorPoolInfo.pPoolSizes = pPoolSizes;
|
|
||||||
descriptorPoolInfo.maxSets = maxSets;
|
|
||||||
return descriptorPoolInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorPoolSize vkTools::initializers::descriptorPoolSize(
|
|
||||||
VkDescriptorType type,
|
|
||||||
uint32_t descriptorCount)
|
|
||||||
{
|
|
||||||
VkDescriptorPoolSize descriptorPoolSize = {};
|
|
||||||
descriptorPoolSize.type = type;
|
|
||||||
descriptorPoolSize.descriptorCount = descriptorCount;
|
|
||||||
return descriptorPoolSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorSetLayoutBinding vkTools::initializers::descriptorSetLayoutBinding(
|
|
||||||
VkDescriptorType type,
|
|
||||||
VkShaderStageFlags stageFlags,
|
|
||||||
uint32_t binding,
|
|
||||||
uint32_t count)
|
|
||||||
{
|
|
||||||
VkDescriptorSetLayoutBinding setLayoutBinding = {};
|
|
||||||
setLayoutBinding.descriptorType = type;
|
|
||||||
setLayoutBinding.stageFlags = stageFlags;
|
|
||||||
setLayoutBinding.binding = binding;
|
|
||||||
setLayoutBinding.descriptorCount = count;
|
|
||||||
return setLayoutBinding;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorSetLayoutCreateInfo vkTools::initializers::descriptorSetLayoutCreateInfo(
|
|
||||||
const VkDescriptorSetLayoutBinding* pBindings,
|
|
||||||
uint32_t bindingCount)
|
|
||||||
{
|
|
||||||
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo = {};
|
|
||||||
descriptorSetLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
|
||||||
descriptorSetLayoutCreateInfo.pNext = NULL;
|
|
||||||
descriptorSetLayoutCreateInfo.pBindings = pBindings;
|
|
||||||
descriptorSetLayoutCreateInfo.bindingCount = bindingCount;
|
|
||||||
return descriptorSetLayoutCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineLayoutCreateInfo vkTools::initializers::pipelineLayoutCreateInfo(
|
|
||||||
const VkDescriptorSetLayout* pSetLayouts,
|
|
||||||
uint32_t setLayoutCount)
|
|
||||||
{
|
|
||||||
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo = {};
|
|
||||||
pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
|
||||||
pipelineLayoutCreateInfo.pNext = NULL;
|
|
||||||
pipelineLayoutCreateInfo.setLayoutCount = setLayoutCount;
|
|
||||||
pipelineLayoutCreateInfo.pSetLayouts = pSetLayouts;
|
|
||||||
return pipelineLayoutCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineLayoutCreateInfo vkTools::initializers::pipelineLayoutCreateInfo(
|
|
||||||
uint32_t setLayoutCount)
|
|
||||||
{
|
|
||||||
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{};
|
|
||||||
pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
|
||||||
pipelineLayoutCreateInfo.setLayoutCount = setLayoutCount;
|
|
||||||
return pipelineLayoutCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorSetAllocateInfo vkTools::initializers::descriptorSetAllocateInfo(
|
|
||||||
VkDescriptorPool descriptorPool,
|
|
||||||
const VkDescriptorSetLayout* pSetLayouts,
|
|
||||||
uint32_t descriptorSetCount)
|
|
||||||
{
|
|
||||||
VkDescriptorSetAllocateInfo descriptorSetAllocateInfo = {};
|
|
||||||
descriptorSetAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
|
||||||
descriptorSetAllocateInfo.pNext = NULL;
|
|
||||||
descriptorSetAllocateInfo.descriptorPool = descriptorPool;
|
|
||||||
descriptorSetAllocateInfo.pSetLayouts = pSetLayouts;
|
|
||||||
descriptorSetAllocateInfo.descriptorSetCount = descriptorSetCount;
|
|
||||||
return descriptorSetAllocateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkDescriptorImageInfo vkTools::initializers::descriptorImageInfo(VkSampler sampler, VkImageView imageView, VkImageLayout imageLayout)
|
|
||||||
{
|
|
||||||
VkDescriptorImageInfo descriptorImageInfo = {};
|
|
||||||
descriptorImageInfo.sampler = sampler;
|
|
||||||
descriptorImageInfo.imageView = imageView;
|
|
||||||
descriptorImageInfo.imageLayout = imageLayout;
|
|
||||||
return descriptorImageInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkWriteDescriptorSet vkTools::initializers::writeDescriptorSet(
|
|
||||||
VkDescriptorSet dstSet,
|
|
||||||
VkDescriptorType type,
|
|
||||||
uint32_t binding,
|
|
||||||
VkDescriptorBufferInfo* bufferInfo)
|
|
||||||
{
|
|
||||||
VkWriteDescriptorSet writeDescriptorSet = {};
|
|
||||||
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
||||||
writeDescriptorSet.pNext = NULL;
|
|
||||||
writeDescriptorSet.dstSet = dstSet;
|
|
||||||
writeDescriptorSet.descriptorType = type;
|
|
||||||
writeDescriptorSet.dstBinding = binding;
|
|
||||||
writeDescriptorSet.pBufferInfo = bufferInfo;
|
|
||||||
// Default value in all examples
|
|
||||||
writeDescriptorSet.descriptorCount = 1;
|
|
||||||
return writeDescriptorSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkWriteDescriptorSet vkTools::initializers::writeDescriptorSet(
|
|
||||||
VkDescriptorSet dstSet,
|
|
||||||
VkDescriptorType type,
|
|
||||||
uint32_t binding,
|
|
||||||
VkDescriptorImageInfo * imageInfo)
|
|
||||||
{
|
|
||||||
VkWriteDescriptorSet writeDescriptorSet = {};
|
|
||||||
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
||||||
writeDescriptorSet.pNext = NULL;
|
|
||||||
writeDescriptorSet.dstSet = dstSet;
|
|
||||||
writeDescriptorSet.descriptorType = type;
|
|
||||||
writeDescriptorSet.dstBinding = binding;
|
|
||||||
writeDescriptorSet.pImageInfo = imageInfo;
|
|
||||||
// Default value in all examples
|
|
||||||
writeDescriptorSet.descriptorCount = 1;
|
|
||||||
return writeDescriptorSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkVertexInputBindingDescription vkTools::initializers::vertexInputBindingDescription(
|
|
||||||
uint32_t binding,
|
|
||||||
uint32_t stride,
|
|
||||||
VkVertexInputRate inputRate)
|
|
||||||
{
|
|
||||||
VkVertexInputBindingDescription vInputBindDescription = {};
|
|
||||||
vInputBindDescription.binding = binding;
|
|
||||||
vInputBindDescription.stride = stride;
|
|
||||||
vInputBindDescription.inputRate = inputRate;
|
|
||||||
return vInputBindDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkVertexInputAttributeDescription vkTools::initializers::vertexInputAttributeDescription(
|
|
||||||
uint32_t binding,
|
|
||||||
uint32_t location,
|
|
||||||
VkFormat format,
|
|
||||||
uint32_t offset)
|
|
||||||
{
|
|
||||||
VkVertexInputAttributeDescription vInputAttribDescription = {};
|
|
||||||
vInputAttribDescription.location = location;
|
|
||||||
vInputAttribDescription.binding = binding;
|
|
||||||
vInputAttribDescription.format = format;
|
|
||||||
vInputAttribDescription.offset = offset;
|
|
||||||
return vInputAttribDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineVertexInputStateCreateInfo vkTools::initializers::pipelineVertexInputStateCreateInfo()
|
|
||||||
{
|
|
||||||
VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo = {};
|
|
||||||
pipelineVertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
|
||||||
pipelineVertexInputStateCreateInfo.pNext = NULL;
|
|
||||||
return pipelineVertexInputStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineInputAssemblyStateCreateInfo vkTools::initializers::pipelineInputAssemblyStateCreateInfo(
|
|
||||||
VkPrimitiveTopology topology,
|
|
||||||
VkPipelineInputAssemblyStateCreateFlags flags,
|
|
||||||
VkBool32 primitiveRestartEnable)
|
|
||||||
{
|
|
||||||
VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo = {};
|
|
||||||
pipelineInputAssemblyStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
|
||||||
pipelineInputAssemblyStateCreateInfo.topology = topology;
|
|
||||||
pipelineInputAssemblyStateCreateInfo.flags = flags;
|
|
||||||
pipelineInputAssemblyStateCreateInfo.primitiveRestartEnable = primitiveRestartEnable;
|
|
||||||
return pipelineInputAssemblyStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineRasterizationStateCreateInfo vkTools::initializers::pipelineRasterizationStateCreateInfo(
|
|
||||||
VkPolygonMode polygonMode,
|
|
||||||
VkCullModeFlags cullMode,
|
|
||||||
VkFrontFace frontFace,
|
|
||||||
VkPipelineRasterizationStateCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo = {};
|
|
||||||
pipelineRasterizationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
|
||||||
pipelineRasterizationStateCreateInfo.polygonMode = polygonMode;
|
|
||||||
pipelineRasterizationStateCreateInfo.cullMode = cullMode;
|
|
||||||
pipelineRasterizationStateCreateInfo.frontFace = frontFace;
|
|
||||||
pipelineRasterizationStateCreateInfo.flags = flags;
|
|
||||||
pipelineRasterizationStateCreateInfo.depthClampEnable = VK_FALSE;
|
|
||||||
pipelineRasterizationStateCreateInfo.lineWidth = 1.0f;
|
|
||||||
return pipelineRasterizationStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineColorBlendAttachmentState vkTools::initializers::pipelineColorBlendAttachmentState(
|
|
||||||
VkColorComponentFlags colorWriteMask,
|
|
||||||
VkBool32 blendEnable)
|
|
||||||
{
|
|
||||||
VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState = {};
|
|
||||||
pipelineColorBlendAttachmentState.colorWriteMask = colorWriteMask;
|
|
||||||
pipelineColorBlendAttachmentState.blendEnable = blendEnable;
|
|
||||||
return pipelineColorBlendAttachmentState;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineColorBlendStateCreateInfo vkTools::initializers::pipelineColorBlendStateCreateInfo(
|
|
||||||
uint32_t attachmentCount,
|
|
||||||
const VkPipelineColorBlendAttachmentState * pAttachments)
|
|
||||||
{
|
|
||||||
VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo = {};
|
|
||||||
pipelineColorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
|
||||||
pipelineColorBlendStateCreateInfo.pNext = NULL;
|
|
||||||
pipelineColorBlendStateCreateInfo.attachmentCount = attachmentCount;
|
|
||||||
pipelineColorBlendStateCreateInfo.pAttachments = pAttachments;
|
|
||||||
return pipelineColorBlendStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineDepthStencilStateCreateInfo vkTools::initializers::pipelineDepthStencilStateCreateInfo(
|
|
||||||
VkBool32 depthTestEnable,
|
|
||||||
VkBool32 depthWriteEnable,
|
|
||||||
VkCompareOp depthCompareOp)
|
|
||||||
{
|
|
||||||
VkPipelineDepthStencilStateCreateInfo pipelineDepthStencilStateCreateInfo = {};
|
|
||||||
pipelineDepthStencilStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
|
||||||
pipelineDepthStencilStateCreateInfo.depthTestEnable = depthTestEnable;
|
|
||||||
pipelineDepthStencilStateCreateInfo.depthWriteEnable = depthWriteEnable;
|
|
||||||
pipelineDepthStencilStateCreateInfo.depthCompareOp = depthCompareOp;
|
|
||||||
pipelineDepthStencilStateCreateInfo.front = pipelineDepthStencilStateCreateInfo.back;
|
|
||||||
pipelineDepthStencilStateCreateInfo.back.compareOp = VK_COMPARE_OP_ALWAYS;
|
|
||||||
return pipelineDepthStencilStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineViewportStateCreateInfo vkTools::initializers::pipelineViewportStateCreateInfo(
|
|
||||||
uint32_t viewportCount,
|
|
||||||
uint32_t scissorCount,
|
|
||||||
VkPipelineViewportStateCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkPipelineViewportStateCreateInfo pipelineViewportStateCreateInfo = {};
|
|
||||||
pipelineViewportStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
|
||||||
pipelineViewportStateCreateInfo.viewportCount = viewportCount;
|
|
||||||
pipelineViewportStateCreateInfo.scissorCount = scissorCount;
|
|
||||||
pipelineViewportStateCreateInfo.flags = flags;
|
|
||||||
return pipelineViewportStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineMultisampleStateCreateInfo vkTools::initializers::pipelineMultisampleStateCreateInfo(
|
|
||||||
VkSampleCountFlagBits rasterizationSamples,
|
|
||||||
VkPipelineMultisampleStateCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo = {};
|
|
||||||
pipelineMultisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
|
||||||
pipelineMultisampleStateCreateInfo.rasterizationSamples = rasterizationSamples;
|
|
||||||
return pipelineMultisampleStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo vkTools::initializers::pipelineDynamicStateCreateInfo(
|
|
||||||
const VkDynamicState * pDynamicStates,
|
|
||||||
uint32_t dynamicStateCount,
|
|
||||||
VkPipelineDynamicStateCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo = {};
|
|
||||||
pipelineDynamicStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
|
||||||
pipelineDynamicStateCreateInfo.pDynamicStates = pDynamicStates;
|
|
||||||
pipelineDynamicStateCreateInfo.dynamicStateCount = dynamicStateCount;
|
|
||||||
return pipelineDynamicStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPipelineTessellationStateCreateInfo vkTools::initializers::pipelineTessellationStateCreateInfo(uint32_t patchControlPoints)
|
|
||||||
{
|
|
||||||
VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo = {};
|
|
||||||
pipelineTessellationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
|
||||||
pipelineTessellationStateCreateInfo.patchControlPoints = patchControlPoints;
|
|
||||||
return pipelineTessellationStateCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkGraphicsPipelineCreateInfo vkTools::initializers::pipelineCreateInfo(
|
|
||||||
VkPipelineLayout layout,
|
|
||||||
VkRenderPass renderPass,
|
|
||||||
VkPipelineCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkGraphicsPipelineCreateInfo pipelineCreateInfo = {};
|
|
||||||
pipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
|
||||||
pipelineCreateInfo.pNext = NULL;
|
|
||||||
pipelineCreateInfo.layout = layout;
|
|
||||||
pipelineCreateInfo.renderPass = renderPass;
|
|
||||||
pipelineCreateInfo.flags = flags;
|
|
||||||
return pipelineCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkComputePipelineCreateInfo vkTools::initializers::computePipelineCreateInfo(VkPipelineLayout layout, VkPipelineCreateFlags flags)
|
|
||||||
{
|
|
||||||
VkComputePipelineCreateInfo computePipelineCreateInfo = {};
|
|
||||||
computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
|
||||||
computePipelineCreateInfo.layout = layout;
|
|
||||||
computePipelineCreateInfo.flags = flags;
|
|
||||||
return computePipelineCreateInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkPushConstantRange vkTools::initializers::pushConstantRange(
|
|
||||||
VkShaderStageFlags stageFlags,
|
|
||||||
uint32_t size,
|
|
||||||
uint32_t offset)
|
|
||||||
{
|
|
||||||
VkPushConstantRange pushConstantRange = {};
|
|
||||||
pushConstantRange.stageFlags = stageFlags;
|
|
||||||
pushConstantRange.offset = offset;
|
|
||||||
pushConstantRange.size = size;
|
|
||||||
return pushConstantRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkBindSparseInfo vkTools::initializers::bindSparseInfo()
|
|
||||||
{
|
|
||||||
VkBindSparseInfo bindSparseInfo{};
|
|
||||||
bindSparseInfo.sType = VK_STRUCTURE_TYPE_BIND_SPARSE_INFO;
|
|
||||||
return bindSparseInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkSpecializationMapEntry vkTools::initializers::specializationMapEntry(uint32_t constantID, uint32_t offset, size_t size)
|
|
||||||
{
|
|
||||||
VkSpecializationMapEntry specializationEntry{};
|
|
||||||
specializationEntry.constantID = constantID;
|
|
||||||
specializationEntry.offset = offset;
|
|
||||||
specializationEntry.size = size;
|
|
||||||
return specializationEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
VkSpecializationInfo vkTools::initializers::specializationInfo(uint32_t mapEntryCount, const VkSpecializationMapEntry* mapEntries, size_t dataSize, const void* data)
|
|
||||||
{
|
|
||||||
VkSpecializationInfo specializationInfo{};
|
|
||||||
specializationInfo.mapEntryCount = mapEntryCount;
|
|
||||||
specializationInfo.pMapEntries = mapEntries;
|
|
||||||
specializationInfo.dataSize = dataSize;
|
|
||||||
specializationInfo.pData = data;
|
|
||||||
return specializationInfo;
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Contain struct initializers and assorted Vulkan helper functions
|
* Assorted Vulkan helper functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
|
* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de
|
||||||
*
|
*
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
|
#include "VulkanInitializers.hpp"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -87,184 +88,4 @@ namespace vkTools
|
||||||
// Load a GLSL shader (text)
|
// Load a GLSL shader (text)
|
||||||
// Note: GLSL support requires vendor-specific extensions to be enabled and is not a core-feature of Vulkan
|
// Note: GLSL support requires vendor-specific extensions to be enabled and is not a core-feature of Vulkan
|
||||||
VkShaderModule loadShaderGLSL(const char *fileName, VkDevice device, VkShaderStageFlagBits stage);
|
VkShaderModule loadShaderGLSL(const char *fileName, VkDevice device, VkShaderStageFlagBits stage);
|
||||||
|
|
||||||
// Contains often used vulkan object initializers
|
|
||||||
// Saves lot of VK_STRUCTURE_TYPE assignments
|
|
||||||
// Some initializers are parameterized for convenience
|
|
||||||
namespace initializers
|
|
||||||
{
|
|
||||||
VkMemoryAllocateInfo memoryAllocateInfo();
|
|
||||||
|
|
||||||
VkMappedMemoryRange mappedMemoryRange();
|
|
||||||
|
|
||||||
VkCommandBufferAllocateInfo commandBufferAllocateInfo(
|
|
||||||
VkCommandPool commandPool,
|
|
||||||
VkCommandBufferLevel level,
|
|
||||||
uint32_t bufferCount);
|
|
||||||
|
|
||||||
VkCommandPoolCreateInfo commandPoolCreateInfo();
|
|
||||||
VkCommandBufferBeginInfo commandBufferBeginInfo();
|
|
||||||
VkCommandBufferInheritanceInfo commandBufferInheritanceInfo();
|
|
||||||
|
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo();
|
|
||||||
VkRenderPassCreateInfo renderPassCreateInfo();
|
|
||||||
|
|
||||||
VkImageMemoryBarrier imageMemoryBarrier();
|
|
||||||
VkBufferMemoryBarrier bufferMemoryBarrier();
|
|
||||||
VkMemoryBarrier memoryBarrier();
|
|
||||||
|
|
||||||
VkImageCreateInfo imageCreateInfo();
|
|
||||||
VkSamplerCreateInfo samplerCreateInfo();
|
|
||||||
VkImageViewCreateInfo imageViewCreateInfo();
|
|
||||||
|
|
||||||
VkFramebufferCreateInfo framebufferCreateInfo();
|
|
||||||
|
|
||||||
VkSemaphoreCreateInfo semaphoreCreateInfo();
|
|
||||||
VkFenceCreateInfo fenceCreateInfo(VkFenceCreateFlags flags = VK_FLAGS_NONE);
|
|
||||||
VkEventCreateInfo eventCreateInfo();
|
|
||||||
|
|
||||||
VkSubmitInfo submitInfo();
|
|
||||||
|
|
||||||
VkViewport viewport(
|
|
||||||
float width,
|
|
||||||
float height,
|
|
||||||
float minDepth,
|
|
||||||
float maxDepth);
|
|
||||||
|
|
||||||
VkRect2D rect2D(
|
|
||||||
int32_t width,
|
|
||||||
int32_t height,
|
|
||||||
int32_t offsetX,
|
|
||||||
int32_t offsetY);
|
|
||||||
|
|
||||||
VkBufferCreateInfo bufferCreateInfo();
|
|
||||||
|
|
||||||
VkBufferCreateInfo bufferCreateInfo(
|
|
||||||
VkBufferUsageFlags usage,
|
|
||||||
VkDeviceSize size);
|
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo descriptorPoolCreateInfo(
|
|
||||||
uint32_t poolSizeCount,
|
|
||||||
VkDescriptorPoolSize* pPoolSizes,
|
|
||||||
uint32_t maxSets);
|
|
||||||
|
|
||||||
VkDescriptorPoolSize descriptorPoolSize(
|
|
||||||
VkDescriptorType type,
|
|
||||||
uint32_t descriptorCount);
|
|
||||||
|
|
||||||
VkDescriptorSetLayoutBinding descriptorSetLayoutBinding(
|
|
||||||
VkDescriptorType type,
|
|
||||||
VkShaderStageFlags stageFlags,
|
|
||||||
uint32_t binding,
|
|
||||||
uint32_t count = 1);
|
|
||||||
|
|
||||||
VkDescriptorSetLayoutCreateInfo descriptorSetLayoutCreateInfo(
|
|
||||||
const VkDescriptorSetLayoutBinding* pBindings,
|
|
||||||
uint32_t bindingCount);
|
|
||||||
|
|
||||||
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo(
|
|
||||||
const VkDescriptorSetLayout* pSetLayouts,
|
|
||||||
uint32_t setLayoutCount);
|
|
||||||
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo(
|
|
||||||
uint32_t setLayoutCount = 1);
|
|
||||||
|
|
||||||
VkDescriptorSetAllocateInfo descriptorSetAllocateInfo(
|
|
||||||
VkDescriptorPool descriptorPool,
|
|
||||||
const VkDescriptorSetLayout* pSetLayouts,
|
|
||||||
uint32_t descriptorSetCount);
|
|
||||||
|
|
||||||
VkDescriptorImageInfo descriptorImageInfo(
|
|
||||||
VkSampler sampler,
|
|
||||||
VkImageView imageView,
|
|
||||||
VkImageLayout imageLayout);
|
|
||||||
|
|
||||||
VkWriteDescriptorSet writeDescriptorSet(
|
|
||||||
VkDescriptorSet dstSet,
|
|
||||||
VkDescriptorType type,
|
|
||||||
uint32_t binding,
|
|
||||||
VkDescriptorBufferInfo* bufferInfo);
|
|
||||||
|
|
||||||
VkWriteDescriptorSet writeDescriptorSet(
|
|
||||||
VkDescriptorSet dstSet,
|
|
||||||
VkDescriptorType type,
|
|
||||||
uint32_t binding,
|
|
||||||
VkDescriptorImageInfo* imageInfo);
|
|
||||||
|
|
||||||
VkVertexInputBindingDescription vertexInputBindingDescription(
|
|
||||||
uint32_t binding,
|
|
||||||
uint32_t stride,
|
|
||||||
VkVertexInputRate inputRate);
|
|
||||||
|
|
||||||
VkVertexInputAttributeDescription vertexInputAttributeDescription(
|
|
||||||
uint32_t binding,
|
|
||||||
uint32_t location,
|
|
||||||
VkFormat format,
|
|
||||||
uint32_t offset);
|
|
||||||
|
|
||||||
VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo();
|
|
||||||
|
|
||||||
VkPipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo(
|
|
||||||
VkPrimitiveTopology topology,
|
|
||||||
VkPipelineInputAssemblyStateCreateFlags flags,
|
|
||||||
VkBool32 primitiveRestartEnable);
|
|
||||||
|
|
||||||
VkPipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo(
|
|
||||||
VkPolygonMode polygonMode,
|
|
||||||
VkCullModeFlags cullMode,
|
|
||||||
VkFrontFace frontFace,
|
|
||||||
VkPipelineRasterizationStateCreateFlags flags);
|
|
||||||
|
|
||||||
VkPipelineColorBlendAttachmentState pipelineColorBlendAttachmentState(
|
|
||||||
VkColorComponentFlags colorWriteMask,
|
|
||||||
VkBool32 blendEnable);
|
|
||||||
|
|
||||||
VkPipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo(
|
|
||||||
uint32_t attachmentCount,
|
|
||||||
const VkPipelineColorBlendAttachmentState* pAttachments);
|
|
||||||
|
|
||||||
VkPipelineDepthStencilStateCreateInfo pipelineDepthStencilStateCreateInfo(
|
|
||||||
VkBool32 depthTestEnable,
|
|
||||||
VkBool32 depthWriteEnable,
|
|
||||||
VkCompareOp depthCompareOp);
|
|
||||||
|
|
||||||
VkPipelineViewportStateCreateInfo pipelineViewportStateCreateInfo(
|
|
||||||
uint32_t viewportCount,
|
|
||||||
uint32_t scissorCount,
|
|
||||||
VkPipelineViewportStateCreateFlags flags);
|
|
||||||
|
|
||||||
VkPipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo(
|
|
||||||
VkSampleCountFlagBits rasterizationSamples,
|
|
||||||
VkPipelineMultisampleStateCreateFlags flags);
|
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo(
|
|
||||||
const VkDynamicState *pDynamicStates,
|
|
||||||
uint32_t dynamicStateCount,
|
|
||||||
VkPipelineDynamicStateCreateFlags flags);
|
|
||||||
|
|
||||||
VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo(
|
|
||||||
uint32_t patchControlPoints);
|
|
||||||
|
|
||||||
VkGraphicsPipelineCreateInfo pipelineCreateInfo(
|
|
||||||
VkPipelineLayout layout,
|
|
||||||
VkRenderPass renderPass,
|
|
||||||
VkPipelineCreateFlags flags);
|
|
||||||
|
|
||||||
VkComputePipelineCreateInfo computePipelineCreateInfo(
|
|
||||||
VkPipelineLayout layout,
|
|
||||||
VkPipelineCreateFlags flags);
|
|
||||||
|
|
||||||
VkPushConstantRange pushConstantRange(
|
|
||||||
VkShaderStageFlags stageFlags,
|
|
||||||
uint32_t size,
|
|
||||||
uint32_t offset);
|
|
||||||
|
|
||||||
VkBindSparseInfo bindSparseInfo();
|
|
||||||
|
|
||||||
/** @brief Initialize a map entry for a shader specialization constant */
|
|
||||||
VkSpecializationMapEntry specializationMapEntry(uint32_t constantID, uint32_t offset, size_t size);
|
|
||||||
|
|
||||||
/** @biref Initialize a specialization constant info structure to pass to a shader stage */
|
|
||||||
VkSpecializationInfo specializationInfo(uint32_t mapEntryCount, const VkSpecializationMapEntry* mapEntries, size_t dataSize, const void* data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Base", "Base", "{09B9A54B-F
|
||||||
base\vulkanexamplebase.h = base\vulkanexamplebase.h
|
base\vulkanexamplebase.h = base\vulkanexamplebase.h
|
||||||
base\vulkanframebuffer.hpp = base\vulkanframebuffer.hpp
|
base\vulkanframebuffer.hpp = base\vulkanframebuffer.hpp
|
||||||
base\vulkanheightmap.hpp = base\vulkanheightmap.hpp
|
base\vulkanheightmap.hpp = base\vulkanheightmap.hpp
|
||||||
|
base\VulkanInitializers.hpp = base\VulkanInitializers.hpp
|
||||||
base\vulkanMeshLoader.hpp = base\vulkanMeshLoader.hpp
|
base\vulkanMeshLoader.hpp = base\vulkanMeshLoader.hpp
|
||||||
base\vulkanscene.hpp = base\vulkanscene.hpp
|
base\vulkanscene.hpp = base\vulkanscene.hpp
|
||||||
base\vulkanswapchain.hpp = base\vulkanswapchain.hpp
|
base\vulkanswapchain.hpp = base\vulkanswapchain.hpp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue