replace bufferDeviceAddress with uniform buffers

This commit is contained in:
Zack Buhman 2026-04-10 20:24:21 -05:00
parent 024a42e691
commit b20306664b
3 changed files with 145 additions and 119 deletions

View File

@ -3,40 +3,25 @@
#ifdef __aligned_alloc #ifdef __aligned_alloc
#undef __aligned_alloc #undef __aligned_alloc
#endif #endif
#ifdef __alloca
#undef __alloca
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#define __aligned_alloc(alignment, size) _aligned_malloc(size, alignment) #define __aligned_alloc(size, alignment) _aligned_malloc(size, alignment)
#define __alloca(size) _malloca(size)
#else #else
#include <stdlib.h> #include <stdlib.h>
#define __aligned_alloc(alignment, size) aligned_alloc(alignment, size) #define __aligned_alloc(size, alignment) aligned_alloc(alignment, size)
#define __alloca(size) alloca(size)
#endif #endif
template <typename T> template <typename T>
T * New(int elements) inline T * NewA(int elements, size_t alignment)
{ {
return (T *)__aligned_alloc(16, (sizeof (T)) * elements); return (T *)__aligned_alloc((sizeof (T)) * elements, alignment);
} }
template <typename T> template <typename T>
T * NewM(int elements) inline T * NewM(int elements)
{ {
return (T *)malloc((sizeof (T)) * elements); return (T *)malloc((sizeof (T)) * elements);
} }
/*
template <typename T>
T * NewA(int elements)
{
return (T *)__alloca((sizeof (T)) * elements);
}
*/
#undef __alloca
#undef __aligned_alloc #undef __aligned_alloc

View File

@ -22,16 +22,10 @@ struct ShaderData
uint32_t Selected; uint32_t Selected;
}; };
struct PushConstant { [[vk::binding(0, 0)]] ConstantBuffer<ShaderData> data;
vk::BufferPointer<ShaderData> data;
};
[[vk::push_constant]] [[vk::binding(0, 1)]] SamplerState samplers[];
ShaderData data; [[vk::binding(0, 1)]] Texture2D textures[];
//struct PushConstant constants;
[[vk::binding(0)]] SamplerState samplers[];
[[vk::binding(0)]] Texture2D textures[];
[shader("vertex")] [shader("vertex")]
VSOutput VSMain(VSInput input) VSOutput VSMain(VSInput input)

View File

@ -123,6 +123,8 @@ VkDeviceMemory textureImageMemory{ VK_NULL_HANDLE };
VkSampler textureSampler{ VK_NULL_HANDLE }; VkSampler textureSampler{ VK_NULL_HANDLE };
VkDescriptorPool descriptorPool{ VK_NULL_HANDLE }; VkDescriptorPool descriptorPool{ VK_NULL_HANDLE };
VkDescriptorSetLayout uniformBufferDescriptorSetLayout{ VK_NULL_HANDLE };
VkDescriptorSet uniformBufferDescriptorSets[maxFramesInFlight];
VkDescriptorSetLayout textureDescriptorSetLayout{ VK_NULL_HANDLE }; VkDescriptorSetLayout textureDescriptorSetLayout{ VK_NULL_HANDLE };
VkDescriptorSet textureDescriptorSet{ VK_NULL_HANDLE }; VkDescriptorSet textureDescriptorSet{ VK_NULL_HANDLE };
@ -443,6 +445,7 @@ int main()
printf(" maxMemoryAllocationCount %u\n", properties.properties.limits.maxMemoryAllocationCount); printf(" maxMemoryAllocationCount %u\n", properties.properties.limits.maxMemoryAllocationCount);
printf(" maxSamplerAllocationCount %u\n", properties.properties.limits.maxSamplerAllocationCount); printf(" maxSamplerAllocationCount %u\n", properties.properties.limits.maxSamplerAllocationCount);
printf(" nonCoherentAtomSize %lu\n", properties.properties.limits.nonCoherentAtomSize); printf(" nonCoherentAtomSize %lu\n", properties.properties.limits.nonCoherentAtomSize);
printf(" minUniformBufferOffsetAlignment %lu\n", properties.properties.limits.minUniformBufferOffsetAlignment);
physicalDeviceProperties = properties.properties; physicalDeviceProperties = properties.properties;
} }
} }
@ -509,7 +512,6 @@ int main()
.shaderSampledImageArrayNonUniformIndexing = true, .shaderSampledImageArrayNonUniformIndexing = true,
.descriptorBindingVariableDescriptorCount = true, .descriptorBindingVariableDescriptorCount = true,
.runtimeDescriptorArray = true, .runtimeDescriptorArray = true,
//.bufferDeviceAddress = true
}; };
VkPhysicalDeviceVulkan13Features enabledVulkan13Features{ VkPhysicalDeviceVulkan13Features enabledVulkan13Features{
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
@ -638,7 +640,7 @@ int main()
VkBufferCreateInfo bufferCreateInfo{ VkBufferCreateInfo bufferCreateInfo{
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
.size = (sizeof (ShaderData)), .size = (sizeof (ShaderData)),
.usage = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, .usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE .sharingMode = VK_SHARING_MODE_EXCLUSIVE
}; };
@ -649,7 +651,7 @@ int main()
vkGetBufferMemoryRequirements(device, shaderDataDevice.frame[0].buffer, &memoryRequirements); vkGetBufferMemoryRequirements(device, shaderDataDevice.frame[0].buffer, &memoryRequirements);
VkMemoryPropertyFlags memoryPropertyFlags{ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT }; VkMemoryPropertyFlags memoryPropertyFlags{ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT };
VkMemoryAllocateFlags memoryAllocateFlags{ /*VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT*/ }; VkMemoryAllocateFlags memoryAllocateFlags{ };
shaderDataDevice.stride = allocateFromMemoryRequirements(physicalDeviceMemoryProperties, shaderDataDevice.stride = allocateFromMemoryRequirements(physicalDeviceMemoryProperties,
memoryRequirements, memoryRequirements,
memoryPropertyFlags, memoryPropertyFlags,
@ -666,14 +668,6 @@ int main()
VkDeviceSize offset{ shaderDataDevice.stride * i }; VkDeviceSize offset{ shaderDataDevice.stride * i };
VK_CHECK(vkBindBufferMemory(device, shaderDataDevice.frame[i].buffer, shaderDataDevice.memory, offset)); VK_CHECK(vkBindBufferMemory(device, shaderDataDevice.frame[i].buffer, shaderDataDevice.memory, offset));
/*
VkBufferDeviceAddressInfo bufferDeviceAddressInfo{
.sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO,
.buffer = shaderDataDevice.frame[i].buffer
};
shaderDataDevice.frame[i].deviceAddress = vkGetBufferDeviceAddress(device, &bufferDeviceAddressInfo);
*/
} }
} }
@ -775,7 +769,7 @@ int main()
VkMemoryRequirements textureSourceBufferMemoryRequirements; VkMemoryRequirements textureSourceBufferMemoryRequirements;
vkGetBufferMemoryRequirements(device, textureSourceBuffer, &textureSourceBufferMemoryRequirements); vkGetBufferMemoryRequirements(device, textureSourceBuffer, &textureSourceBufferMemoryRequirements);
VkMemoryPropertyFlags textureSourceBufferMemoryPropertyFlags{ VkMemoryPropertyFlags textureSourceBufferMemoryPropertyFlags{
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
}; };
uint32_t textureSourceBufferMemoryTypeIndex = findMemoryTypeIndex(physicalDeviceMemoryProperties.memoryProperties, textureSourceBufferMemoryRequirements.memoryTypeBits, textureSourceBufferMemoryPropertyFlags); uint32_t textureSourceBufferMemoryTypeIndex = findMemoryTypeIndex(physicalDeviceMemoryProperties.memoryProperties, textureSourceBufferMemoryRequirements.memoryTypeBits, textureSourceBufferMemoryPropertyFlags);
VkMemoryAllocateInfo textureSourceBufferAllocateInfo{ VkMemoryAllocateInfo textureSourceBufferAllocateInfo{
@ -888,69 +882,103 @@ int main()
}; };
VK_CHECK(vkCreateSampler(device, &samplerCreateInfo, nullptr, &textureSampler)); VK_CHECK(vkCreateSampler(device, &samplerCreateInfo, nullptr, &textureSampler));
//////////////////////////////////////////////////////////////////////
// descriptors
//////////////////////////////////////////////////////////////////////
//
// pool
//
VkDescriptorPoolSize descriptorPoolSizes[2]{
{
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
.descriptorCount = 1,
},
{
.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.descriptorCount = maxFramesInFlight,
}
};
VkDescriptorPoolCreateInfo descriptorPoolCreateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.maxSets = 3,
.poolSizeCount = 2,
.pPoolSizes = descriptorPoolSizes
};
VK_CHECK(vkCreateDescriptorPool(device, &descriptorPoolCreateInfo, nullptr, &descriptorPool));
//
// uniform buffer descriptor set layout/allocation
//
VkDescriptorSetLayoutBinding uniformBufferDescriptorSetLayoutBinding{
.binding = 0,
.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT
};
VkDescriptorSetLayoutCreateInfo uniformBufferDescriptorSetLayoutCreateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.bindingCount = 1,
.pBindings = &uniformBufferDescriptorSetLayoutBinding
};
VK_CHECK(vkCreateDescriptorSetLayout(device, &uniformBufferDescriptorSetLayoutCreateInfo, nullptr, &uniformBufferDescriptorSetLayout));
VkDescriptorSetLayout uniformBufferDescriptorSetLayouts[maxFramesInFlight];
for (uint32_t i = 0; i < maxFramesInFlight; i++) {
uniformBufferDescriptorSetLayouts[i] = uniformBufferDescriptorSetLayout;
};
VkDescriptorSetAllocateInfo uniformBufferDescriptorSetAllocateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
.descriptorPool = descriptorPool,
.descriptorSetCount = maxFramesInFlight,
.pSetLayouts = uniformBufferDescriptorSetLayouts
};
VK_CHECK(vkAllocateDescriptorSets(device, &uniformBufferDescriptorSetAllocateInfo, uniformBufferDescriptorSets));
//
// texture descriptor set layout/allocation
//
VkDescriptorSetLayoutBinding textureDescriptorSetLayoutBinding{
.binding = 0,
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
.descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT
};
VkDescriptorSetLayoutCreateInfo textureDescriptorSetLayoutCreateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.bindingCount = 1,
.pBindings = &textureDescriptorSetLayoutBinding
};
VK_CHECK(vkCreateDescriptorSetLayout(device, &textureDescriptorSetLayoutCreateInfo, nullptr, &textureDescriptorSetLayout));
VkDescriptorSetAllocateInfo textureDescriptorSetAllocateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
.descriptorPool = descriptorPool,
.descriptorSetCount = 1,
.pSetLayouts = &textureDescriptorSetLayout
};
VK_CHECK(vkAllocateDescriptorSets(device, &textureDescriptorSetAllocateInfo, &textureDescriptorSet));
//////////////////////////////////////////////////////////////////////
// descriptor set writes
//////////////////////////////////////////////////////////////////////
constexpr int writeDescriptorSetsCount = 1 + maxFramesInFlight;
VkWriteDescriptorSet writeDescriptorSets[writeDescriptorSetsCount];
VkDescriptorImageInfo textureDescriptorImageInfo = { VkDescriptorImageInfo textureDescriptorImageInfo = {
.sampler = textureSampler, .sampler = textureSampler,
.imageView = textureImageView, .imageView = textureImageView,
.imageLayout = VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL .imageLayout = VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL
}; };
////////////////////////////////////////////////////////////////////// writeDescriptorSets[0] = {
// descriptors
//////////////////////////////////////////////////////////////////////
VkDescriptorBindingFlags descriptorBindingFlags{ VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT };
VkDescriptorSetLayoutBindingFlagsCreateInfo descriptorSetLayoutBindingFlagsCreateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO,
.bindingCount = 1,
.pBindingFlags = &descriptorBindingFlags
};
VkDescriptorSetLayoutBinding textureDescriptorSetLayoutBinding{
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
.descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT
};
VkDescriptorSetLayoutCreateInfo textureDescriptorSetLayoutCreateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.pNext = &descriptorSetLayoutBindingFlagsCreateInfo,
.bindingCount = 1,
.pBindings = &textureDescriptorSetLayoutBinding
};
VK_CHECK(vkCreateDescriptorSetLayout(device, &textureDescriptorSetLayoutCreateInfo, nullptr, &textureDescriptorSetLayout));
// pool
VkDescriptorPoolSize poolSize{
.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
.descriptorCount = 1,
};
VkDescriptorPoolCreateInfo descriptorPoolCreateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
.maxSets = 1,
.poolSizeCount = 1,
.pPoolSizes = &poolSize
};
VK_CHECK(vkCreateDescriptorPool(device, &descriptorPoolCreateInfo, nullptr, &descriptorPool));
//
uint32_t variableDescriptorCount{ 1 };
VkDescriptorSetVariableDescriptorCountAllocateInfo descriptorSetVariableDescriptorCountAllocateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT,
.descriptorSetCount = 1,
.pDescriptorCounts = &variableDescriptorCount
};
VkDescriptorSetAllocateInfo descriptorSetAllocateInfo{
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
.pNext = &descriptorSetVariableDescriptorCountAllocateInfo,
.descriptorPool = descriptorPool,
.descriptorSetCount = 1,
.pSetLayouts = &textureDescriptorSetLayout
};
VK_CHECK(vkAllocateDescriptorSets(device, &descriptorSetAllocateInfo, &textureDescriptorSet));
//
VkWriteDescriptorSet writeDescriptorSet{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = textureDescriptorSet, .dstSet = textureDescriptorSet,
.dstBinding = 0, .dstBinding = 0,
@ -958,7 +986,26 @@ int main()
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
.pImageInfo = &textureDescriptorImageInfo .pImageInfo = &textureDescriptorImageInfo
}; };
vkUpdateDescriptorSets(device, 1, &writeDescriptorSet, 0, nullptr);
for (uint32_t i = 0; i < maxFramesInFlight; i++) {
VkDescriptorBufferInfo descriptorBufferInfo {
.buffer = shaderDataDevice.frame[i].buffer,
.offset = 0,
.range = VK_WHOLE_SIZE,
};
writeDescriptorSets[1 + i] = {
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = uniformBufferDescriptorSets[i],
.dstBinding = 0,
.descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
.pBufferInfo = &descriptorBufferInfo
};
}
// update all three descriptor sets
vkUpdateDescriptorSets(device, writeDescriptorSetsCount, writeDescriptorSets, 0, nullptr);
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// shaders // shaders
@ -979,17 +1026,15 @@ int main()
// pipeline // pipeline
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
VkPushConstantRange pushConstantRange{ VkDescriptorSetLayout descriptorSetLayouts[2] = {
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT, uniformBufferDescriptorSetLayout,
//.size = (sizeof (VkDeviceAddress)) textureDescriptorSetLayout,
.size = (sizeof (ShaderData))
}; };
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{ VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo{
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
.setLayoutCount = 1, .setLayoutCount = 2,
.pSetLayouts = &textureDescriptorSetLayout, .pSetLayouts = descriptorSetLayouts,
.pushConstantRangeCount = 1,
.pPushConstantRanges = &pushConstantRange
}; };
VK_CHECK(vkCreatePipelineLayout(device, &pipelineLayoutCreateInfo, nullptr, &pipelineLayout)); VK_CHECK(vkCreatePipelineLayout(device, &pipelineLayoutCreateInfo, nullptr, &pipelineLayout));
@ -1184,13 +1229,6 @@ int main()
} }
} }
// wait for fence
VK_CHECK(vkWaitForFences(device, 1, &fences[frameIndex], true, UINT64_MAX));
VK_CHECK(vkResetFences(device, 1, &fences[frameIndex]));
// acquire next image
VK_CHECK_SWAPCHAIN(vkAcquireNextImageKHR(device, swapchain, UINT64_MAX, presentSemaphores[frameIndex], VK_NULL_HANDLE, &imageIndex));
// shader data // shader data
XMMATRIX model = currentModel(); XMMATRIX model = currentModel();
XMMATRIX view = currentView(); XMMATRIX view = currentView();
@ -1204,7 +1242,6 @@ int main()
size_t frameOffset = shaderDataDevice.stride * frameIndex; size_t frameOffset = shaderDataDevice.stride * frameIndex;
void * frameData = (void *)(((VkDeviceSize)shaderDataDevice.mappedData) + frameOffset); void * frameData = (void *)(((VkDeviceSize)shaderDataDevice.mappedData) + frameOffset);
VkDeviceSize frameSize{ (sizeof (ShaderData)) }; VkDeviceSize frameSize{ (sizeof (ShaderData)) };
/*
memcpy(frameData, &shaderData, frameSize); memcpy(frameData, &shaderData, frameSize);
VkDeviceSize flushSize{ roundAlignment(frameSize, physicalDeviceProperties.limits.nonCoherentAtomSize) }; VkDeviceSize flushSize{ roundAlignment(frameSize, physicalDeviceProperties.limits.nonCoherentAtomSize) };
VkMappedMemoryRange shaderDataMemoryRange{ VkMappedMemoryRange shaderDataMemoryRange{
@ -1214,7 +1251,14 @@ int main()
.size = flushSize, .size = flushSize,
}; };
vkFlushMappedMemoryRanges(device, 1, &shaderDataMemoryRange); vkFlushMappedMemoryRanges(device, 1, &shaderDataMemoryRange);
*/
// wait for fence
VK_CHECK(vkWaitForFences(device, 1, &fences[frameIndex], true, UINT64_MAX));
VK_CHECK(vkResetFences(device, 1, &fences[frameIndex]));
// acquire next image
VK_CHECK_SWAPCHAIN(vkAcquireNextImageKHR(device, swapchain, UINT64_MAX, presentSemaphores[frameIndex], VK_NULL_HANDLE, &imageIndex));
// command buffer // command buffer
VkCommandBuffer& commandBuffer = commandBuffers[frameIndex]; VkCommandBuffer& commandBuffer = commandBuffers[frameIndex];
@ -1303,12 +1347,14 @@ int main()
vkCmdSetScissor(commandBuffer, 0, 1, &scissor); vkCmdSetScissor(commandBuffer, 0, 1, &scissor);
VkDeviceSize vertexOffset{ 0 }; VkDeviceSize vertexOffset{ 0 };
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &textureDescriptorSet, 0, nullptr); VkDescriptorSet descriptorSets[2] = {
uniformBufferDescriptorSets[frameIndex],
textureDescriptorSet,
};
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 2, descriptorSets, 0, nullptr);
vkCmdBindVertexBuffers(commandBuffer, 0, 1, &vertexIndexBuffer, &vertexOffset); vkCmdBindVertexBuffers(commandBuffer, 0, 1, &vertexIndexBuffer, &vertexOffset);
VkDeviceSize indexOffset{ vertexBufferSize }; VkDeviceSize indexOffset{ vertexBufferSize };
vkCmdBindIndexBuffer(commandBuffer, vertexIndexBuffer, indexOffset, VK_INDEX_TYPE_UINT32); vkCmdBindIndexBuffer(commandBuffer, vertexIndexBuffer, indexOffset, VK_INDEX_TYPE_UINT32);
//vkCmdPushConstants(commandBuffer, pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, 0, (sizeof (VkDeviceAddress)), &shaderDataDevice.frame[frameIndex].deviceAddress);
vkCmdPushConstants(commandBuffer, pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, 0, (sizeof (ShaderData)), &shaderData);
VkDeviceSize indexCount{ 9216 }; VkDeviceSize indexCount{ 9216 };
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines[MAIN_PIPELINE]); vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines[MAIN_PIPELINE]);
@ -1404,6 +1450,7 @@ int main()
vkDestroyImage(device, textureImage, nullptr); vkDestroyImage(device, textureImage, nullptr);
vkFreeMemory(device, textureImageMemory, nullptr); vkFreeMemory(device, textureImageMemory, nullptr);
vkDestroyDescriptorSetLayout(device, uniformBufferDescriptorSetLayout, nullptr);
vkDestroyDescriptorSetLayout(device, textureDescriptorSetLayout, nullptr); vkDestroyDescriptorSetLayout(device, textureDescriptorSetLayout, nullptr);
vkDestroyDescriptorPool(device, descriptorPool, nullptr); vkDestroyDescriptorPool(device, descriptorPool, nullptr);
vkDestroyPipelineLayout(device, pipelineLayout, nullptr); vkDestroyPipelineLayout(device, pipelineLayout, nullptr);