vk_graphics_pipeline: Use Shader::NumDescriptors when possible

This commit is contained in:
ReinUsesLisp 2021-07-25 22:28:26 -03:00 committed by Fernando Sahmkow
parent 6f3a41abe2
commit baf0993d5c
1 changed files with 6 additions and 18 deletions

View File

@ -402,13 +402,9 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
add_buffer(desc); add_buffer(desc);
} }
} }
for (const auto& desc : info.texture_descriptors) { texture_buffer_index += Shader::NumDescriptors(info.texture_descriptors);
texture_buffer_index += desc.count;
}
if constexpr (Spec::has_images) { if constexpr (Spec::has_images) {
for (const auto& desc : info.image_descriptors) { texture_buffer_index += Shader::NumDescriptors(info.image_descriptors);
texture_buffer_index += desc.count;
}
} }
}}; }};
if constexpr (Spec::enabled_stages[0]) { if constexpr (Spec::enabled_stages[0]) {
@ -826,18 +822,10 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
void GraphicsPipeline::Validate() { void GraphicsPipeline::Validate() {
size_t num_images{}; size_t num_images{};
for (const auto& info : stage_infos) { for (const auto& info : stage_infos) {
for (const auto& desc : info.texture_buffer_descriptors) { num_images += Shader::NumDescriptors(info.texture_buffer_descriptors);
num_images += desc.count; num_images += Shader::NumDescriptors(info.image_buffer_descriptors);
} num_images += Shader::NumDescriptors(info.texture_descriptors);
for (const auto& desc : info.image_buffer_descriptors) { num_images += Shader::NumDescriptors(info.image_descriptors);
num_images += desc.count;
}
for (const auto& desc : info.texture_descriptors) {
num_images += desc.count;
}
for (const auto& desc : info.image_descriptors) {
num_images += desc.count;
}
} }
ASSERT(num_images <= MAX_IMAGE_ELEMENTS); ASSERT(num_images <= MAX_IMAGE_ELEMENTS);
} }