diff options
| author | Valentin Popov <valentin@popov.link> | 2026-07-18 07:22:29 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-07-18 07:22:29 +0300 |
| commit | e7c16641716b41b8682b05bb96f74f25707d9d93 (patch) | |
| tree | f1f1221a9e5b271908fae71f628deb66c310aaca /adapters/fparkan-render-vulkan/src/ffi/smoke.rs | |
| parent | 1afe1698db5e9b3378f5087890c8177201a84789 (diff) | |
| download | fparkan-e7c16641716b41b8682b05bb96f74f25707d9d93.tar.xz fparkan-e7c16641716b41b8682b05bb96f74f25707d9d93.zip | |
feat(vulkan): cache pipeline variants by state key
Diffstat (limited to 'adapters/fparkan-render-vulkan/src/ffi/smoke.rs')
| -rw-r--r-- | adapters/fparkan-render-vulkan/src/ffi/smoke.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs index 533ab1c..71af2a8 100644 --- a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs +++ b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs @@ -560,6 +560,7 @@ impl VulkanSmokeRenderer { self.vertex_buffer_ref()?, self.index_buffer_ref()?, self.textures_ref()?, + &self.draw_ranges, reuse_command_pool, )?, |resources| destroy_swapchain_resources(device, self.command_pool, resources), @@ -631,11 +632,6 @@ impl VulkanSmokeRenderer { &render_pass_info, vk::SubpassContents::INLINE, ); - device.device().cmd_bind_pipeline( - command_buffer, - vk::PipelineBindPoint::GRAPHICS, - resources.pipeline, - ); let vertex_buffers = [self.vertex_buffer_ref()?.buffer]; let offsets = [0_u64]; device @@ -648,6 +644,16 @@ impl VulkanSmokeRenderer { vk::IndexType::UINT16, ); for (range, &texture_index) in self.draw_ranges.iter().zip(&self.draw_texture_indices) { + let pipeline = resources.pipelines.get(&range.pipeline_key()).ok_or( + VulkanSmokeRendererError::InvariantViolation { + context: "static draw pipeline variant", + }, + )?; + device.device().cmd_bind_pipeline( + command_buffer, + vk::PipelineBindPoint::GRAPHICS, + *pipeline, + ); let descriptor_set = resources.descriptor_sets.get(texture_index).ok_or( VulkanSmokeRendererError::InvariantViolation { context: "static material descriptor set", |
