1
0
Fork 0
forked from wry/wry

vulkan: split renderer operations

This commit is contained in:
kossLAN 2026-05-29 21:11:23 -04:00
parent 959f23f61b
commit ed0dc3fbad
No known key found for this signature in database
2 changed files with 97 additions and 83 deletions

View file

@ -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<Rc<VulkanImage>>,
@ -210,74 +201,6 @@ pub(super) struct Memory {
fb_inv_eotf_args_address: Option<DeviceSize>,
}
enum VulkanOp {
Fill(VulkanFillOp),
Tex(VulkanTexOp),
RoundedFill(VulkanRoundedFillOp),
RoundedTex(VulkanRoundedTexOp),
}
struct VulkanTexOp {
tex: Rc<VulkanImage>,
index: usize,
range: Range<usize>,
buffer_resv: Option<Rc<dyn BufferResv>>,
acquire_sync: Option<AcquireSync>,
release_sync: ReleaseSync,
alpha: f32,
source_type: TexSourceType,
copy_type: TexCopyType,
alpha_mode: AlphaMode,
range_address: DeviceAddress,
instances: u32,
tex_cd: Rc<ColorDescription>,
color_management_data_address: Option<DeviceAddress>,
eotf_args_address: Option<DeviceAddress>,
resource_descriptor_buffer_offset: DeviceAddress,
}
struct VulkanFillOp {
range: Range<usize>,
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<VulkanImage>,
index: usize,
target: Point,
source: Point,
buffer_resv: Option<Rc<dyn BufferResv>>,
acquire_sync: Option<AcquireSync>,
release_sync: ReleaseSync,
alpha: f32,
source_type: TexSourceType,
copy_type: TexCopyType,
alpha_mode: AlphaMode,
tex_cd: Rc<ColorDescription>,
color_management_data_address: Option<DeviceAddress>,
eotf_args_address: Option<DeviceAddress>,
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,

View file

@ -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<VulkanImage>,
pub(super) index: usize,
pub(super) range: Range<usize>,
pub(super) buffer_resv: Option<Rc<dyn BufferResv>>,
pub(super) acquire_sync: Option<AcquireSync>,
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<ColorDescription>,
pub(super) color_management_data_address: Option<DeviceAddress>,
pub(super) eotf_args_address: Option<DeviceAddress>,
pub(super) resource_descriptor_buffer_offset: DeviceAddress,
}
pub(super) struct VulkanFillOp {
pub(super) range: Range<usize>,
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<VulkanImage>,
pub(super) index: usize,
pub(super) target: Point,
pub(super) source: Point,
pub(super) buffer_resv: Option<Rc<dyn BufferResv>>,
pub(super) acquire_sync: Option<AcquireSync>,
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<ColorDescription>,
pub(super) color_management_data_address: Option<DeviceAddress>,
pub(super) eotf_args_address: Option<DeviceAddress>,
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,
}