This commit is contained in:
galister
2025-12-12 20:44:06 +09:00
parent e1b209410e
commit 8b4e60e221
53 changed files with 206 additions and 215 deletions

View File

@@ -7,26 +7,26 @@ use std::{marker::PhantomData, slice::Iter, sync::Arc};
use cmd::{GfxCommandBuffer, XferCommandBuffer};
use pipeline::WGfxPipeline;
use vulkano::{
DeviceSize,
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, IndexBuffer, Subbuffer},
command_buffer::{
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
AutoCommandBufferBuilder, CommandBufferUsage,
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
},
descriptor_set::allocator::{StandardDescriptorSetAllocator, StandardDescriptorSetAllocatorCreateInfo},
device::{Device, Queue},
format::Format,
image::{sampler::Filter, Image, ImageCreateInfo, ImageType, ImageUsage},
image::{Image, ImageCreateInfo, ImageType, ImageUsage, sampler::Filter},
instance::Instance,
memory::{
allocator::{AllocationCreateInfo, GenericMemoryAllocatorCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
MemoryPropertyFlags,
allocator::{AllocationCreateInfo, GenericMemoryAllocatorCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
},
pipeline::graphics::{
color_blend::{AttachmentBlend, BlendFactor, BlendOp},
vertex_input::Vertex,
},
shader::ShaderModule,
DeviceSize,
};
use crate::gfx::pipeline::WPipelineCreateInfo;

View File

@@ -13,12 +13,12 @@ use vulkano::{
view::ImageView,
},
pipeline::{
graphics::{self, vertex_input::Vertex, viewport::Viewport},
Pipeline, PipelineBindPoint,
graphics::{self, vertex_input::Vertex, viewport::Viewport},
},
};
use super::{pipeline::WGfxPipeline, WGfx};
use super::{WGfx, pipeline::WGfxPipeline};
pub struct WGfxPass<V> {
pub command_buffer: Arc<SecondaryAutoCommandBuffer>,

View File

@@ -48,4 +48,4 @@ pub fn parse_component_checkbox(
process_component(ctx, Component(component), widget.id, attribs);
Ok(widget.id)
}
}

View File

@@ -1,7 +1,7 @@
use crate::{
components::{slider, Component},
components::{Component, slider},
layout::WidgetID,
parser::{parse_check_f32, process_component, style::parse_style, AttribPair, ParserContext},
parser::{AttribPair, ParserContext, parse_check_f32, process_component, style::parse_style},
widget::ConstructEssentials,
};

View File

@@ -2,21 +2,21 @@ use std::{cell::RefCell, rc::Rc, sync::Arc};
use cosmic_text::Buffer;
use glam::{Mat4, Vec2, Vec3};
use slotmap::{new_key_type, SlotMap};
use slotmap::{SlotMap, new_key_type};
use vulkano::pipeline::graphics::viewport;
use crate::{
drawing::{self},
font_config,
gfx::{cmd::GfxCommandBuffer, WGfx},
gfx::{WGfx, cmd::GfxCommandBuffer},
};
use super::{
rect::{RectPipeline, RectRenderer},
text::{
DEFAULT_METRICS, SWASH_CACHE, TextArea, TextBounds,
text_atlas::{TextAtlas, TextPipeline},
text_renderer::TextRenderer,
TextArea, TextBounds, DEFAULT_METRICS, SWASH_CACHE,
},
viewport::Viewport,
};

View File

@@ -10,10 +10,10 @@ use vulkano::{
use crate::{
drawing::{Boundary, Rectangle},
gfx::{
BLEND_ALPHA, WGfx,
cmd::GfxCommandBuffer,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx, BLEND_ALPHA,
},
renderer_vk::model_buffer::ModelBuffer,
};

View File

@@ -29,10 +29,7 @@ impl Viewport {
projection: WMat4::default(),
};
let params_buffer = gfx.new_buffer(
BufferUsage::UNIFORM_BUFFER | BufferUsage::TRANSFER_DST,
[params].iter(),
)?;
let params_buffer = gfx.new_buffer(BufferUsage::UNIFORM_BUFFER | BufferUsage::TRANSFER_DST, [params].iter())?;
Ok(Self {
params,
@@ -46,10 +43,7 @@ impl Viewport {
self
.text_descriptor
.get_or_insert_with(|| {
pipeline
.inner
.buffer(2, self.params_buffer.clone())
.unwrap() // safe unwrap
pipeline.inner.buffer(2, self.params_buffer.clone()).unwrap() // safe unwrap
})
.clone()
}
@@ -58,21 +52,13 @@ impl Viewport {
self
.rect_descriptor
.get_or_insert_with(|| {
pipeline
.color_rect
.buffer(0, self.params_buffer.clone())
.unwrap() // safe unwrap
pipeline.color_rect.buffer(0, self.params_buffer.clone()).unwrap() // safe unwrap
})
.clone()
}
/// Updates the `Viewport` with the given `resolution` and `projection`.
pub fn update(
&mut self,
resolution: [u32; 2],
projection: &glam::Mat4,
pixel_scale: f32,
) -> anyhow::Result<()> {
pub fn update(&mut self, resolution: [u32; 2], projection: &glam::Mat4, pixel_scale: f32) -> anyhow::Result<()> {
if self.params.screen_resolution == resolution
&& self.params.projection.0 == *projection.as_ref()
&& self.params.pixel_scale == pixel_scale