Code cleanup

This commit is contained in:
Sascha Willems 2024-01-21 13:19:40 +01:00
parent 91ab6a517f
commit afde90dcfd
3 changed files with 9 additions and 6 deletions

View file

@ -335,7 +335,7 @@ public:
vkEndCommandBuffer(compute.commandBuffer); vkEndCommandBuffer(compute.commandBuffer);
} }
void setupDescriptorSets() void setupDescriptors()
{ {
// Pool // Pool
std::vector<VkDescriptorPoolSize> poolSizes = { std::vector<VkDescriptorPoolSize> poolSizes = {
@ -744,7 +744,7 @@ public:
VulkanExampleBase::prepare(); VulkanExampleBase::prepare();
loadAssets(); loadAssets();
prepareBuffers(); prepareBuffers();
setupDescriptorSets(); setupDescriptors();
preparePipelines(); preparePipelines();
prepareCompute(); prepareCompute();
buildCommandBuffers(); buildCommandBuffers();

View file

@ -205,7 +205,7 @@ public:
} }
// [POI] Set up descriptor sets and set layout // [POI] Set up descriptor sets and set layout
void setupDescriptorSets() void setupDescriptors()
{ {
// Descriptor pool // Descriptor pool
std::vector<VkDescriptorPoolSize> poolSizes = { std::vector<VkDescriptorPoolSize> poolSizes = {
@ -403,7 +403,7 @@ public:
generateTextures(); generateTextures();
generateCubes(); generateCubes();
prepareUniformBuffers(); prepareUniformBuffers();
setupDescriptorSets(); setupDescriptors();
preparePipelines(); preparePipelines();
buildCommandBuffers(); buildCommandBuffers();
prepared = true; prepared = true;

View file

@ -181,12 +181,15 @@ public:
descriptorLayoutCI.pBindings = setLayoutBindings.data(); descriptorLayoutCI.pBindings = setLayoutBindings.data();
VK_CHECK_RESULT(vkCreateDescriptorSetLayout(device, &descriptorLayoutCI, nullptr, &descriptorSetLayout)); VK_CHECK_RESULT(vkCreateDescriptorSetLayout(device, &descriptorLayoutCI, nullptr, &descriptorSetLayout));
VkPipelineLayoutCreateInfo pipelineLayoutCI = vks::initializers::pipelineLayoutCreateInfo(&descriptorSetLayout, 1);
VK_CHECK_RESULT(vkCreatePipelineLayout(device, &pipelineLayoutCI, nullptr, &pipelineLayout));
} }
void preparePipelines() void preparePipelines()
{ {
// Layout
VkPipelineLayoutCreateInfo pipelineLayoutCI = vks::initializers::pipelineLayoutCreateInfo(&descriptorSetLayout, 1);
VK_CHECK_RESULT(vkCreatePipelineLayout(device, &pipelineLayoutCI, nullptr, &pipelineLayout));
// Pipeline
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE); VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0); VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
VkPipelineColorBlendAttachmentState blendAttachmentState = vks::initializers::pipelineColorBlendAttachmentState(0xf, VK_FALSE); VkPipelineColorBlendAttachmentState blendAttachmentState = vks::initializers::pipelineColorBlendAttachmentState(0xf, VK_FALSE);