Corrected pool sizes, no longer delete compute command buffer when switching compute pipelines
This commit is contained in:
parent
7e8365630e
commit
3b27fe6fc2
1 changed files with 10 additions and 15 deletions
|
|
@ -99,6 +99,8 @@ public:
|
||||||
|
|
||||||
vkTools::destroyUniformData(device, &uniformDataVS);
|
vkTools::destroyUniformData(device, &uniformDataVS);
|
||||||
|
|
||||||
|
vkFreeCommandBuffers(device, cmdPool, 1, &computeCmdBuffer);
|
||||||
|
|
||||||
textureLoader->destroyTexture(textureColorMap);
|
textureLoader->destroyTexture(textureColorMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,17 +295,12 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reBuildComputeCommandBuffer()
|
|
||||||
{
|
|
||||||
vkFreeCommandBuffers(device, cmdPool, 1, &computeCmdBuffer);
|
|
||||||
buildComputeCommandBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void buildComputeCommandBuffer()
|
void buildComputeCommandBuffer()
|
||||||
{
|
{
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vkTools::initializers::commandBufferBeginInfo();;
|
VkCommandBufferBeginInfo cmdBufInfo = vkTools::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
vkBeginCommandBuffer(computeCmdBuffer, &cmdBufInfo);
|
VkResult err = vkBeginCommandBuffer(computeCmdBuffer, &cmdBufInfo);
|
||||||
|
assert(!err);
|
||||||
|
|
||||||
vkCmdBindPipeline(computeCmdBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelines.compute[pipelines.computeIndex]);
|
vkCmdBindPipeline(computeCmdBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelines.compute[pipelines.computeIndex]);
|
||||||
vkCmdBindDescriptorSets(computeCmdBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, computePipelineLayout, 0, 1, &computeDescriptorSet, 0, 0);
|
vkCmdBindDescriptorSets(computeCmdBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, computePipelineLayout, 0, 1, &computeDescriptorSet, 0, 0);
|
||||||
|
|
@ -431,10 +428,8 @@ public:
|
||||||
{
|
{
|
||||||
std::vector<VkDescriptorPoolSize> poolSizes =
|
std::vector<VkDescriptorPoolSize> poolSizes =
|
||||||
{
|
{
|
||||||
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1),
|
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2),
|
||||||
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 3),
|
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 4),
|
||||||
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1),
|
|
||||||
vkTools::initializers::descriptorPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo descriptorPoolInfo =
|
VkDescriptorPoolCreateInfo descriptorPoolInfo =
|
||||||
|
|
@ -658,7 +653,7 @@ public:
|
||||||
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
|
std::vector<VkDescriptorSetLayoutBinding> setLayoutBindings = {
|
||||||
// Binding 0 : Sampled image (read)
|
// Binding 0 : Sampled image (read)
|
||||||
vkTools::initializers::descriptorSetLayoutBinding(
|
vkTools::initializers::descriptorSetLayoutBinding(
|
||||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||||
VK_SHADER_STAGE_COMPUTE_BIT,
|
VK_SHADER_STAGE_COMPUTE_BIT,
|
||||||
0),
|
0),
|
||||||
// Binding 1 : Sampled image (write)
|
// Binding 1 : Sampled image (write)
|
||||||
|
|
@ -858,12 +853,12 @@ public:
|
||||||
if ((dir < 0) && (pipelines.computeIndex > 0))
|
if ((dir < 0) && (pipelines.computeIndex > 0))
|
||||||
{
|
{
|
||||||
pipelines.computeIndex--;
|
pipelines.computeIndex--;
|
||||||
reBuildComputeCommandBuffer();
|
buildComputeCommandBuffer();
|
||||||
}
|
}
|
||||||
if ((dir > 0) && (pipelines.computeIndex < pipelines.compute.size()-1))
|
if ((dir > 0) && (pipelines.computeIndex < pipelines.compute.size()-1))
|
||||||
{
|
{
|
||||||
pipelines.computeIndex++;
|
pipelines.computeIndex++;
|
||||||
reBuildComputeCommandBuffer();
|
buildComputeCommandBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue