deduplicate prepareDescriptorSets code

This commit is contained in:
goeiecool9999 2024-11-05 12:01:39 +01:00
parent de2cc13b0f
commit ac2b5d05fa

View File

@ -1165,34 +1165,19 @@ void VulkanRenderer::draw_prepareDescriptorSets(PipelineInfo* pipeline_info, VkD
const auto geometryShader = LatteSHRC_GetActiveGeometryShader(); const auto geometryShader = LatteSHRC_GetActiveGeometryShader();
const auto pixelShader = LatteSHRC_GetActivePixelShader(); const auto pixelShader = LatteSHRC_GetActivePixelShader();
auto prepareShaderDescriptors = [this, &pipeline_info](LatteDecompilerShader* shader) -> VkDescriptorSetInfo* {
if (vertexShader) if (!shader)
{ return nullptr;
auto descriptorSetInfo = draw_getOrCreateDescriptorSet(pipeline_info, vertexShader); auto descriptorSetInfo = draw_getOrCreateDescriptorSet(pipeline_info, shader);
descriptorSetInfo->m_vkObjDescriptorSet->flagForCurrentCommandBuffer(); descriptorSetInfo->m_vkObjDescriptorSet->flagForCurrentCommandBuffer();
for (auto& sampler : descriptorSetInfo->m_vkObjSamplers) for (auto& sampler : descriptorSetInfo->m_vkObjSamplers)
sampler->flagForCurrentCommandBuffer(); sampler->flagForCurrentCommandBuffer();
vertexDS = descriptorSetInfo; return descriptorSetInfo;
} };
if (pixelShader) vertexDS = prepareShaderDescriptors(vertexShader);
{ pixelDS = prepareShaderDescriptors(pixelShader);
auto descriptorSetInfo = draw_getOrCreateDescriptorSet(pipeline_info, pixelShader); geometryDS = prepareShaderDescriptors(geometryShader);
descriptorSetInfo->m_vkObjDescriptorSet->flagForCurrentCommandBuffer();
for(auto& sampler : descriptorSetInfo->m_vkObjSamplers)
sampler->flagForCurrentCommandBuffer();
pixelDS = descriptorSetInfo;
}
if (geometryShader)
{
auto descriptorSetInfo = draw_getOrCreateDescriptorSet(pipeline_info, geometryShader);
descriptorSetInfo->m_vkObjDescriptorSet->flagForCurrentCommandBuffer();
for(auto& sampler : descriptorSetInfo->m_vkObjSamplers)
sampler->flagForCurrentCommandBuffer();
geometryDS = descriptorSetInfo;
}
} }
void VulkanRenderer::draw_updateVkBlendConstants() void VulkanRenderer::draw_updateVkBlendConstants()