diff --git a/src/gfx_apis/vulkan/renderer.rs b/src/gfx_apis/vulkan/renderer.rs index 76dddb39..c1c7e464 100644 --- a/src/gfx_apis/vulkan/renderer.rs +++ b/src/gfx_apis/vulkan/renderer.rs @@ -1,8 +1,13 @@ mod color; +mod op; mod paint_region; use { color::{ColorTransforms, EotfArgsCache}, + op::{ + TexCopyType, TexSourceType, VulkanFillOp, VulkanOp, VulkanRoundedFillOp, + VulkanRoundedTexOp, VulkanTexOp, + }, paint_region::{PaintRegion, Point, constrain_to_fb}, crate::{ async_engine::{AsyncEngine, SpawnedFuture}, @@ -77,9 +82,7 @@ use { borrow::Cow, cell::{Cell, LazyCell, RefCell}, fmt::{Debug, Formatter}, - mem, - ops::Range, - ptr, + mem, ptr, rc::{Rc, Weak}, slice, }, @@ -160,18 +163,6 @@ pub(super) struct UsedTexture { release_sync: ReleaseSync, } -#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Linearize)] -pub(super) enum TexCopyType { - Identity, - Multiply, -} - -#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Linearize)] -pub(super) enum TexSourceType { - Opaque, - HasAlpha, -} - #[derive(Default)] pub(super) struct Memory { dmabuf_sample: Vec>, @@ -210,74 +201,6 @@ pub(super) struct Memory { fb_inv_eotf_args_address: Option, } -enum VulkanOp { - Fill(VulkanFillOp), - Tex(VulkanTexOp), - RoundedFill(VulkanRoundedFillOp), - RoundedTex(VulkanRoundedTexOp), -} - -struct VulkanTexOp { - tex: Rc, - index: usize, - range: Range, - buffer_resv: Option>, - acquire_sync: Option, - release_sync: ReleaseSync, - alpha: f32, - source_type: TexSourceType, - copy_type: TexCopyType, - alpha_mode: AlphaMode, - range_address: DeviceAddress, - instances: u32, - tex_cd: Rc, - color_management_data_address: Option, - eotf_args_address: Option, - resource_descriptor_buffer_offset: DeviceAddress, -} - -struct VulkanFillOp { - range: Range, - color: [f32; 4], - source_type: TexSourceType, - range_address: DeviceAddress, - instances: u32, -} - -struct VulkanRoundedFillOp { - target: Point, - color: [f32; 4], - source_type: TexSourceType, - size: [f32; 2], - corner_radius: [f32; 4], - border_width: f32, - scale: f32, - range_address: DeviceAddress, - z_order: u32, -} - -struct VulkanRoundedTexOp { - tex: Rc, - index: usize, - target: Point, - source: Point, - buffer_resv: Option>, - acquire_sync: Option, - release_sync: ReleaseSync, - alpha: f32, - source_type: TexSourceType, - copy_type: TexCopyType, - alpha_mode: AlphaMode, - tex_cd: Rc, - color_management_data_address: Option, - eotf_args_address: Option, - resource_descriptor_buffer_offset: DeviceAddress, - size: [f32; 2], - corner_radius: [f32; 4], - scale: f32, - range_address: DeviceAddress, -} - #[derive(Copy, Clone, Debug, Linearize, Eq, PartialEq)] pub(super) enum RenderPass { BlendBuffer, diff --git a/src/gfx_apis/vulkan/renderer/op.rs b/src/gfx_apis/vulkan/renderer/op.rs new file mode 100644 index 00000000..f4dbbb03 --- /dev/null +++ b/src/gfx_apis/vulkan/renderer/op.rs @@ -0,0 +1,91 @@ +use { + super::paint_region::Point, + crate::{ + cmm::cmm_description::ColorDescription, + gfx_api::{AcquireSync, AlphaMode, BufferResv, ReleaseSync}, + gfx_apis::vulkan::image::VulkanImage, + }, + ash::vk::DeviceAddress, + linearize::Linearize, + std::{ops::Range, rc::Rc}, +}; + +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Linearize)] +pub(in crate::gfx_apis::vulkan) enum TexCopyType { + Identity, + Multiply, +} + +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Linearize)] +pub(in crate::gfx_apis::vulkan) enum TexSourceType { + Opaque, + HasAlpha, +} + +pub(super) enum VulkanOp { + Fill(VulkanFillOp), + Tex(VulkanTexOp), + RoundedFill(VulkanRoundedFillOp), + RoundedTex(VulkanRoundedTexOp), +} + +pub(super) struct VulkanTexOp { + pub(super) tex: Rc, + pub(super) index: usize, + pub(super) range: Range, + pub(super) buffer_resv: Option>, + pub(super) acquire_sync: Option, + pub(super) release_sync: ReleaseSync, + pub(super) alpha: f32, + pub(super) source_type: TexSourceType, + pub(super) copy_type: TexCopyType, + pub(super) alpha_mode: AlphaMode, + pub(super) range_address: DeviceAddress, + pub(super) instances: u32, + pub(super) tex_cd: Rc, + pub(super) color_management_data_address: Option, + pub(super) eotf_args_address: Option, + pub(super) resource_descriptor_buffer_offset: DeviceAddress, +} + +pub(super) struct VulkanFillOp { + pub(super) range: Range, + pub(super) color: [f32; 4], + pub(super) source_type: TexSourceType, + pub(super) range_address: DeviceAddress, + pub(super) instances: u32, +} + +pub(super) struct VulkanRoundedFillOp { + pub(super) target: Point, + pub(super) color: [f32; 4], + pub(super) source_type: TexSourceType, + pub(super) size: [f32; 2], + pub(super) corner_radius: [f32; 4], + pub(super) border_width: f32, + pub(super) scale: f32, + pub(super) range_address: DeviceAddress, + pub(super) z_order: u32, +} + +pub(super) struct VulkanRoundedTexOp { + pub(super) tex: Rc, + pub(super) index: usize, + pub(super) target: Point, + pub(super) source: Point, + pub(super) buffer_resv: Option>, + pub(super) acquire_sync: Option, + pub(super) release_sync: ReleaseSync, + pub(super) alpha: f32, + pub(super) source_type: TexSourceType, + pub(super) copy_type: TexCopyType, + pub(super) alpha_mode: AlphaMode, + pub(super) tex_cd: Rc, + pub(super) color_management_data_address: Option, + pub(super) eotf_args_address: Option, + pub(super) resource_descriptor_buffer_offset: DeviceAddress, + pub(super) size: [f32; 2], + pub(super) corner_radius: [f32; 4], + pub(super) scale: f32, + pub(super) range_address: DeviceAddress, +}