diff --git a/src/gfx_apis/vulkan/renderer.rs b/src/gfx_apis/vulkan/renderer.rs index c1c7e464..9e8ceabb 100644 --- a/src/gfx_apis/vulkan/renderer.rs +++ b/src/gfx_apis/vulkan/renderer.rs @@ -1,5 +1,6 @@ mod color; mod op; +mod pipeline_cache; mod paint_region; use { @@ -9,6 +10,7 @@ use { VulkanRoundedTexOp, VulkanTexOp, }, paint_region::{PaintRegion, Point, constrain_to_fb}, + pipeline_cache::{FillPipelines, OutPipelineKey, TexPipelineKey, TexPipelines}, crate::{ async_engine::{AsyncEngine, SpawnedFuture}, cmm::{ @@ -220,30 +222,6 @@ pub(super) struct PendingFrame { _used_buffers: ArrayVec, } -type FillPipelines = Rc>>; - -#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] -struct TexPipelineKey { - tex_copy_type: TexCopyType, - tex_source_type: TexSourceType, - tex_alpha_mode: AlphaMode, - eotf: VulkanEotf, - has_color_management_data: bool, -} - -pub(super) struct TexPipelines { - format: vk::Format, - eotf: VulkanEotf, - pipelines: CopyHashMap>, -} - -#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] -pub(super) struct OutPipelineKey { - format: vk::Format, - eotf: VulkanEotf, - has_color_management_data: bool, -} - impl VulkanDevice { pub fn create_renderer( self: &Rc, diff --git a/src/gfx_apis/vulkan/renderer/pipeline_cache.rs b/src/gfx_apis/vulkan/renderer/pipeline_cache.rs new file mode 100644 index 00000000..cca90c18 --- /dev/null +++ b/src/gfx_apis/vulkan/renderer/pipeline_cache.rs @@ -0,0 +1,36 @@ +use { + super::op::{TexCopyType, TexSourceType}, + crate::{ + gfx_api::AlphaMode, + gfx_apis::vulkan::{eotfs::VulkanEotf, pipeline::VulkanPipeline}, + utils::copyhashmap::CopyHashMap, + }, + ash::vk, + linearize::StaticMap, + std::rc::Rc, +}; + +pub(in crate::gfx_apis::vulkan) type FillPipelines = + Rc>>; + +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub(super) struct TexPipelineKey { + pub(super) tex_copy_type: TexCopyType, + pub(super) tex_source_type: TexSourceType, + pub(super) tex_alpha_mode: AlphaMode, + pub(super) eotf: VulkanEotf, + pub(super) has_color_management_data: bool, +} + +pub(in crate::gfx_apis::vulkan) struct TexPipelines { + pub(super) format: vk::Format, + pub(super) eotf: VulkanEotf, + pub(super) pipelines: CopyHashMap>, +} + +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub(in crate::gfx_apis::vulkan) struct OutPipelineKey { + pub(super) format: vk::Format, + pub(super) eotf: VulkanEotf, + pub(super) has_color_management_data: bool, +}