mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
deduplicate prepareDescriptorSets code
This commit is contained in:
parent
de2cc13b0f
commit
ac2b5d05fa
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user