diff --git a/src/canvas/canvas_frame.rs b/src/canvas/canvas_frame.rs index ee60ebae..4b2575ab 100644 --- a/src/canvas/canvas_frame.rs +++ b/src/canvas/canvas_frame.rs @@ -2,11 +2,11 @@ use crate::util::vertex_3d::{Vertex3D}; use std::sync::Arc; use std::collections::HashMap; use crate::canvas::canvas_state::{Drawable}; -use crate::canvas::shader::text_shader::GlyphInstance; use std::hash::Hash; use crate::canvas::*; -use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; -use crate::canvas::canvas_state::CanvasFontHandle; +use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef; +use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle}; +use crate::canvas::managed::shader::text_shader::GlyphInstance; /// I dont know why this isnt working /// fqowiejf diff --git a/src/canvas/canvas_state.rs b/src/canvas/canvas_state.rs index 3d9c4614..9a204633 100644 --- a/src/canvas/canvas_state.rs +++ b/src/canvas/canvas_state.rs @@ -20,20 +20,19 @@ use vulkano::pipeline::viewport::Viewport; use vulkano::descriptor::descriptor::DescriptorDescTy::TexelBuffer; use crate::canvas::canvas_frame::CanvasFrame; use std::hash::Hash; -use crate::canvas::canvas_buffer::{CanvasImage, CanvasTexture, CanvasFont}; use crate::util::vertex_3d::{Vertex3D, TextVertex3D}; use vulkano::pipeline::depth_stencil::{StencilFaceFlags, DynamicStencilValue}; -use crate::canvas::shader::common::{CompiledGraphicsPipeline}; -use crate::canvas::shader::generic_shader::GenericShader; use vulkano::memory::pool::PotentialDedicatedAllocation::Generic; use std::borrow::Borrow; -use crate::canvas::shader::text_shader::GlyphInstance; use std::fs::File; use std::io::Read; use rusttype::{Font, PositionedGlyph, Scale, Rect, point, GlyphId}; use vulkano::pipeline::vertex::VertexDefinition; -use crate::canvas::{CanvasTextureHandle, CanvasImageHandle, CompiledGraphicsPipelineHandle, Handle}; -use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; +use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef; +use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle, CompiledGraphicsPipelineHandle, Handle}; +use crate::canvas::managed::gpu_buffers::{CanvasImage, CanvasTexture, CanvasFont}; +use crate::canvas::managed::shader::shader_common::CompiledGraphicsPipeline; +use crate::canvas::managed::shader::generic_shader::GenericShader; // I don't think this is going to work without getting into Box'ing @@ -72,19 +71,6 @@ pub trait Drawable { } } -/// Typed wrapper for a u32 font handle (index id) -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CanvasFontHandle { - handle: u32 -} - -impl Handle for CanvasFontHandle { - fn get_handle(&self) -> u32 { - self.handle - } -} - - /// Canvas state is used for storage of texture and image buffers in addition to vertex buffers /// Canvas state also contains logic for writing the stored buffers to the command_buffer #[derive(Clone)] @@ -251,7 +237,7 @@ impl CanvasState { /// Return the image buffer from an input image handle pub fn get_image(&self, image_handle: Arc) -> Arc { - self.image_buffers.get((*image_handle).clone().handle as usize).unwrap() + self.image_buffers.get((*image_handle).clone().get_handle() as usize).unwrap() .clone().buffer.clone() } @@ -418,7 +404,7 @@ impl CanvasState { /// Using the texture handle, grab the stored texture and return the buffer pub fn get_texture(&self, texture_handle: Arc) -> Arc> { - let handle = texture_handle.handle as usize; + let handle = texture_handle.get_handle() as usize; if let Some(i) = self.texture_buffers.get(handle) { return i.clone().buffer.clone(); @@ -550,7 +536,7 @@ impl CanvasState { // Solid colors let mut shader = self.shader_buffers.get( self.get_shader_handle(String::from("color-passthrough")) - .unwrap().clone().handle as usize + .unwrap().clone().get_handle() as usize ).unwrap(); // This looks a little weird as colored_vertex_buffer is a vec of GPU allocated vecs. @@ -568,12 +554,12 @@ impl CanvasState { // Images let mut shader = self.shader_buffers.get( self.get_shader_handle(String::from("simple_image")) - .unwrap().clone().handle as usize + .unwrap().clone().get_handle() as usize ).unwrap(); if !self.image_vertex_buffer.is_empty() { for (image_handle, vertex_buffer) in self.image_vertex_buffer.clone() { - let handle = image_handle.clone().handle as usize; + let handle = image_handle.clone().get_handle() as usize; let descriptor_set = self.image_buffers.get(handle).clone().unwrap().clone() .get_descriptor_set(shader.get_pipeline().clone()); @@ -589,12 +575,12 @@ impl CanvasState { // Textures let mut shader = self.shader_buffers.get( self.get_shader_handle(String::from("simple_texture")) - .unwrap().clone().handle as usize + .unwrap().clone().get_handle() as usize ).unwrap(); if !self.textured_vertex_buffer.is_empty() { for (texture_handle, vertex_buffer) in self.textured_vertex_buffer.clone() { - let handle = texture_handle.clone().handle as usize; + let handle = texture_handle.clone().get_handle() as usize; let descriptor_set = self.texture_buffers.get(handle).clone().unwrap().clone() .get_descriptor_set(shader.get_pipeline(), self.sampler.clone()); @@ -610,7 +596,7 @@ impl CanvasState { // Text let mut shader = self.shader_buffers.get( self.get_shader_handle(String::from("simple_text")) - .unwrap().clone().handle as usize + .unwrap().clone().get_handle() as usize ).unwrap(); // diff --git a/src/canvas/canvas_text.rs b/src/canvas/managed/canvas_text.rs similarity index 96% rename from src/canvas/canvas_text.rs rename to src/canvas/managed/canvas_text.rs index 7a3a4ace..121f33e8 100644 --- a/src/canvas/canvas_text.rs +++ b/src/canvas/managed/canvas_text.rs @@ -10,9 +10,7 @@ use vulkano::format::ClearValue; use vulkano::format::Format::R8Unorm; use std::fs::File; use std::io::Read; -use crate::canvas::shader::text_shader::GlyphInstance; use crate::util::vertex_3d::{Vertex3D, TextVertex3D}; -use crate::canvas::canvas_buffer::CanvasFont; //pub struct Glyph {} diff --git a/src/canvas/canvas_buffer.rs b/src/canvas/managed/gpu_buffers.rs similarity index 95% rename from src/canvas/canvas_buffer.rs rename to src/canvas/managed/gpu_buffers.rs index b247689b..a8f8e773 100644 --- a/src/canvas/canvas_buffer.rs +++ b/src/canvas/managed/gpu_buffers.rs @@ -7,8 +7,7 @@ use vulkano::descriptor::descriptor_set::PersistentDescriptorSet; use vulkano::buffer::{CpuAccessibleBuffer, BufferAccess}; use vulkano::pipeline::GraphicsPipelineAbstract; use rusttype::Font; -use crate::canvas::{CanvasTextureHandle, CanvasImageHandle}; -use crate::canvas::canvas_state::CanvasFontHandle; +use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle}; /// Canvas buffer which represents an allocated Texture with a key and dimensions diff --git a/src/canvas/managed/handles.rs b/src/canvas/managed/handles.rs new file mode 100644 index 00000000..a44f0f50 --- /dev/null +++ b/src/canvas/managed/handles.rs @@ -0,0 +1,66 @@ + +pub trait Handle { + fn get_handle(&self) -> u32; +} + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CanvasFontHandle { + pub(in crate::canvas) handle: u32 +} + +impl Handle for CanvasFontHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CanvasTextureHandle { + pub(in crate::canvas) handle: u32 +} + +impl Handle for CanvasTextureHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CanvasImageHandle { + pub(in crate::canvas) handle: u32 +} + +impl Handle for CanvasImageHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CanvasShaderHandle { + pub(in crate::canvas) handle: u32 +} + +impl Handle for CanvasShaderHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CompiledGraphicsPipelineHandle { + pub(in crate::canvas) handle: u32 +} + +impl Handle for CompiledGraphicsPipelineHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + + diff --git a/src/canvas/shader/mod.rs b/src/canvas/managed/mod.rs similarity index 75% rename from src/canvas/shader/mod.rs rename to src/canvas/managed/mod.rs index 1222e263..682e852c 100644 --- a/src/canvas/shader/mod.rs +++ b/src/canvas/managed/mod.rs @@ -1,15 +1,8 @@ -use crate::canvas::shader::common::CompiledGraphicsPipeline; - -pub mod common; -pub mod generic_shader; -pub mod text_shader; -pub mod dynamic_vertex; - -use crate::canvas::shader::common::*; -use crate::canvas::shader::generic_shader::*; -use crate::canvas::shader::text_shader::*; -use crate::canvas::shader::dynamic_vertex::*; +pub mod shader; +pub mod handles; +pub mod canvas_text; +pub mod gpu_buffers; use vulkano::pipeline::shader::{SpecializationConstants, SpecializationMapEntry}; diff --git a/src/canvas/shader/dynamic_vertex.rs b/src/canvas/managed/shader/dynamic_vertex.rs similarity index 100% rename from src/canvas/shader/dynamic_vertex.rs rename to src/canvas/managed/shader/dynamic_vertex.rs diff --git a/src/canvas/shader/generic_shader.rs b/src/canvas/managed/shader/generic_shader.rs similarity index 93% rename from src/canvas/shader/generic_shader.rs rename to src/canvas/managed/shader/generic_shader.rs index 959f8534..7dae70dd 100644 --- a/src/canvas/shader/generic_shader.rs +++ b/src/canvas/managed/shader/generic_shader.rs @@ -1,13 +1,11 @@ use vulkano::pipeline::GraphicsPipelineAbstract; use std::sync::Arc; -use crate::canvas::shader::common::{ShaderType, CompiledGraphicsPipeline}; use std::collections::{HashSet, HashMap}; use vulkano::device::Device; use vulkano::framebuffer::{RenderPassAbstract, Subpass}; use vulkano::pipeline::GraphicsPipeline; use vulkano::pipeline::shader::{GraphicsEntryPoint, ShaderModule, GraphicsShaderType, GeometryShaderExecutionMode, ShaderInterfaceDef}; -use crate::canvas::shader::ShaderSpecializationConstants; use shade_runner::{Input, Output, Layout, Entry}; use std::ffi::CStr; use std::marker::PhantomData; @@ -15,11 +13,12 @@ use vulkano::pipeline::depth_stencil::{DepthStencil, Compare, DepthBounds, Stenc use vulkano::pipeline::vertex::{SingleBufferDefinition, VertexDefinition}; use crate::util::vertex_3d::Vertex3D; use shade_runner as sr; -use crate::canvas::shader::common::CompiledGraphicsPipelineResources; use vulkano::memory::pool::PotentialDedicatedAllocation::Generic; use vulkano::SafeDeref; -use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; -use crate::canvas::CompiledGraphicsPipelineHandle; +use crate::canvas::managed::shader::shader_common::{ShaderType, CompiledGraphicsPipelineResources, CompiledGraphicsPipeline}; +use crate::canvas::managed::handles::CompiledGraphicsPipelineHandle; +use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef; +use crate::canvas::managed::ShaderSpecializationConstants; /// CanvasShader holds the pipeline and render pass for the input shader source #[derive(Clone)] diff --git a/src/canvas/managed/shader/mod.rs b/src/canvas/managed/shader/mod.rs new file mode 100644 index 00000000..9c56f6ec --- /dev/null +++ b/src/canvas/managed/shader/mod.rs @@ -0,0 +1,4 @@ +pub mod text_shader; +pub mod generic_shader; +pub mod dynamic_vertex; +pub mod shader_common; \ No newline at end of file diff --git a/src/canvas/shader/common.rs b/src/canvas/managed/shader/shader_common.rs similarity index 97% rename from src/canvas/shader/common.rs rename to src/canvas/managed/shader/shader_common.rs index a3131473..299e474b 100644 --- a/src/canvas/shader/common.rs +++ b/src/canvas/managed/shader/shader_common.rs @@ -8,7 +8,7 @@ use vulkano::pipeline::shader::{ShaderModule, GraphicsShaderType, GeometryShader use vulkano::device::Device; use shade_runner::Entry; use shaderc::ShaderKind; -use crate::canvas::CompiledGraphicsPipelineHandle; +use crate::canvas::managed::handles::CompiledGraphicsPipelineHandle; /* @@ -28,7 +28,7 @@ This best works I think if I allow users to /// Inheriting this gives private functions to grab resources -pub(super) trait CompiledGraphicsPipelineResources { +pub trait CompiledGraphicsPipelineResources { fn get_path(filename: String, shader_type: ShaderType) -> PathBuf { let project_root = diff --git a/src/canvas/shader/text_shader.rs b/src/canvas/managed/shader/text_shader.rs similarity index 93% rename from src/canvas/shader/text_shader.rs rename to src/canvas/managed/shader/text_shader.rs index b58dbf99..9683663e 100644 --- a/src/canvas/shader/text_shader.rs +++ b/src/canvas/managed/shader/text_shader.rs @@ -1,22 +1,22 @@ use vulkano::pipeline::GraphicsPipelineAbstract; use std::sync::Arc; -use crate::canvas::shader::common::{ShaderType, CompiledGraphicsPipeline, CompiledGraphicsPipelineResources}; use std::collections::{HashSet, HashMap}; use vulkano::device::Device; use vulkano::framebuffer::{RenderPassAbstract, Subpass}; use vulkano::pipeline::GraphicsPipeline; use vulkano::pipeline::shader::{GraphicsEntryPoint, ShaderModule, GraphicsShaderType, GeometryShaderExecutionMode}; -use crate::canvas::shader::ShaderSpecializationConstants; use shade_runner::{Input, Output, Layout, Entry}; use std::ffi::CStr; use std::marker::PhantomData; use vulkano::pipeline::depth_stencil::{DepthStencil, Compare, DepthBounds, Stencil, StencilOp}; use vulkano::pipeline::vertex::{SingleBufferDefinition, OneVertexOneInstanceDefinition}; use crate::util::vertex_3d::Vertex3D; -use crate::canvas::shader::generic_shader::GenericShader; use shade_runner as sr; -use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; -use crate::canvas::CompiledGraphicsPipelineHandle; +use crate::canvas::managed::shader::shader_common::{ShaderType, CompiledGraphicsPipelineResources, CompiledGraphicsPipeline}; +use crate::canvas::managed::handles::CompiledGraphicsPipelineHandle; +use crate::canvas::managed::shader::generic_shader::GenericShader; +use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef; +use crate::canvas::managed::ShaderSpecializationConstants; #[derive(Default, Debug, Clone, Copy)] pub struct GlyphInstance { diff --git a/src/canvas/mod.rs b/src/canvas/mod.rs index 8587e065..71f7215a 100644 --- a/src/canvas/mod.rs +++ b/src/canvas/mod.rs @@ -1,39 +1,6 @@ pub mod canvas_state; pub mod canvas_frame; -pub mod shader; -pub mod canvas_text; -pub mod canvas_buffer; +pub mod managed; - -pub trait Handle { - fn get_handle(&self) -> u32; -} - - -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CanvasTextureHandle { - pub handle: u32 -} - -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CanvasImageHandle { - pub handle: u32 -} - -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CanvasShaderHandle { - pub handle: u32 -} - -/// Typed wrapper for a u32 handle -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CompiledGraphicsPipelineHandle { - pub handle: u32 -} - -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CompuBufferHandle { - pub handle: u32, -} diff --git a/src/compute/compu_frame.rs b/src/compute/compu_frame.rs index 13ed01b3..775e2d96 100644 --- a/src/compute/compu_frame.rs +++ b/src/compute/compu_frame.rs @@ -1,9 +1,8 @@ use crate::canvas::canvas_state::{Drawable}; use std::sync::Arc; -use crate::compute::compu_sprite::CompuSprite; -use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle}; -use crate::compute::compu_buffer::{CompuBuffers}; -use crate::canvas::{CompuBufferHandle, CanvasImageHandle}; +use crate::canvas::managed::handles::{CanvasImageHandle}; +use crate::compute::managed::handles::{CompuKernelHandle, CompuBufferHandle}; +use crate::compute::managed::compu_sprite::CompuSprite; pub struct CompuFrame { // Vec<(Buffer, Kernel)> diff --git a/src/compute/compu_state.rs b/src/compute/compu_state.rs index 0d3d74fe..a8533982 100644 --- a/src/compute/compu_state.rs +++ b/src/compute/compu_state.rs @@ -18,10 +18,11 @@ use std::path::PathBuf; use shade_runner::{CompiledShaders, Entry, CompileError}; use vulkano::pipeline::shader::ShaderModule; use shaderc::CompileOptions; -use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle}; -use crate::compute::compu_buffer::{CompuBuffers}; use crate::compute::compu_frame::CompuFrame; -use crate::canvas::CompuBufferHandle; +use crate::canvas::managed::handles::Handle; +use crate::compute::managed::compu_buffer::CompuBuffers; +use crate::compute::managed::handles::{CompuKernelHandle, CompuBufferHandle}; +use crate::compute::managed::compu_kernel::CompuKernel; /// State holding the compute buffers for computation and the kernels which will compute them @@ -98,8 +99,8 @@ impl CompuState { // i = (Buffer, Kernel) for i in compute_frame.pure_compute { - let buffer_id = (*i.0).clone().handle as usize; - let kernel_id = (*i.1).clone().handle as usize; + let buffer_id = (*i.0).clone().get_handle() as usize; + let kernel_id = (*i.1).clone().get_handle() as usize; let buffer = self.compute_buffers.get(buffer_id).unwrap(); let kernel = self.kernels.get(kernel_id).unwrap(); @@ -115,7 +116,7 @@ impl CompuState { // i = (Buffer, Image, Kernel) for i in compute_frame.swapped_to_image { - let buffer_id = (*i.0).clone().handle as usize; + let buffer_id = (*i.0).clone().get_handle() as usize; let image_id = i.1.clone(); let kernel_id = (*i.2).clone().handle as usize; @@ -143,8 +144,8 @@ impl CompuState { // i = (Input Buffer, Output Buffer, Kernel) // Input buffer -> Kernel -> Output buffer for i in compute_frame.swapped_to_buffer { - let input_buffer_id = (*i.0).clone().handle as usize; - let output_buffer_id = (*i.1).clone().handle as usize; + let input_buffer_id = (*i.0).clone().get_handle() as usize; + let output_buffer_id = (*i.1).clone().get_handle() as usize; let kernel_id = (*i.2).clone().handle as usize; let input_buffer = self.compute_buffers.get(input_buffer_id).unwrap(); diff --git a/src/compute/compu_buffer.rs b/src/compute/managed/compu_buffer.rs similarity index 98% rename from src/compute/compu_buffer.rs rename to src/compute/managed/compu_buffer.rs index 8f5e5e04..60fc4edb 100644 --- a/src/compute/compu_buffer.rs +++ b/src/compute/managed/compu_buffer.rs @@ -7,7 +7,7 @@ use vulkano::descriptor::descriptor_set::{PersistentDescriptorSet, PersistentDes use image::ImageBuffer; use image::Rgba; use shade_runner::Layout; -use crate::canvas::CompuBufferHandle; +use crate::compute::managed::handles::CompuBufferHandle; #[derive(Clone)] diff --git a/src/compute/compu_kernel.rs b/src/compute/managed/compu_kernel.rs similarity index 96% rename from src/compute/compu_kernel.rs rename to src/compute/managed/compu_kernel.rs index f57e4ac5..b597632b 100644 --- a/src/compute/compu_kernel.rs +++ b/src/compute/managed/compu_kernel.rs @@ -8,12 +8,8 @@ use vulkano::descriptor::pipeline_layout::PipelineLayout; use shade_runner::{CompileError, Layout, Input, Output, CompiledShaders, Entry, CompiledShader}; use shaderc::CompileOptions; use vulkano::pipeline::shader::{ShaderModule, GraphicsEntryPoint, SpecializationConstants, SpecializationMapEntry}; -use crate::compute::compu_buffer::{CompuBuffers}; +use crate::compute::managed::handles::CompuKernelHandle; -#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] -pub struct CompuKernelHandle { - pub handle: u32, -} #[derive(Clone)] pub struct CompuKernel { diff --git a/src/compute/compu_sprite.rs b/src/compute/managed/compu_sprite.rs similarity index 96% rename from src/compute/compu_sprite.rs rename to src/compute/managed/compu_sprite.rs index 050ff34a..7fd358d0 100644 --- a/src/compute/compu_sprite.rs +++ b/src/compute/managed/compu_sprite.rs @@ -1,6 +1,6 @@ use crate::canvas::canvas_state::{Drawable}; use std::sync::Arc; -use crate::canvas::{CanvasImageHandle, CanvasTextureHandle}; +use crate::canvas::managed::handles::{CanvasImageHandle, CanvasTextureHandle}; pub struct CompuSprite { pub vertices: [(f32, f32, f32); 6], diff --git a/src/compute/managed/handles.rs b/src/compute/managed/handles.rs new file mode 100644 index 00000000..f5338cec --- /dev/null +++ b/src/compute/managed/handles.rs @@ -0,0 +1,29 @@ +use crate::canvas::managed::handles::Handle; + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CompuBufferHandle { + pub(in crate::compute) handle: u32, +} + +impl Handle for CompuBufferHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + +/// Typed wrapper for a u32 handle +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct CompuKernelHandle { + pub(in crate::compute) handle: u32, +} + +impl Handle for CompuKernelHandle { + fn get_handle(&self) -> u32 { + self.handle + } +} + + + + diff --git a/src/compute/managed/mod.rs b/src/compute/managed/mod.rs new file mode 100644 index 00000000..40d8454b --- /dev/null +++ b/src/compute/managed/mod.rs @@ -0,0 +1,5 @@ + +pub mod compu_buffer; +pub mod compu_sprite; +pub mod compu_kernel; +pub mod handles; \ No newline at end of file diff --git a/src/compute/mod.rs b/src/compute/mod.rs index b9bd0fe9..7503ae4b 100644 --- a/src/compute/mod.rs +++ b/src/compute/mod.rs @@ -1,11 +1,6 @@ pub mod compu_frame; -pub mod compu_kernel; -pub mod compu_sprite; pub mod compu_state; -pub mod compu_buffer; +pub mod managed; use crate::compute::compu_state::CompuState; -use crate::compute::compu_frame::CompuFrame; -use crate::compute::compu_sprite::CompuSprite; -use crate::compute::compu_kernel::CompuKernel; -use crate::compute::compu_buffer::CompuBuffers; \ No newline at end of file +use crate::compute::compu_frame::CompuFrame; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 467a3eb8..3d325787 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,9 +24,9 @@ use crate::util::load_raw; use crate::sprite::{Poly, Text, TextHandle, TextVertex, TextInstance}; use vulkano::instance::debug::DebugCallback; -use crate::compute::compu_sprite::CompuSprite; use crate::compute::compu_frame::CompuFrame; use crate::canvas::canvas_frame::{CanvasFrame, GenericCanvasFrame}; +use crate::compute::managed::compu_sprite::CompuSprite; pub mod util; diff --git a/src/sprite.rs b/src/sprite.rs index 7edea747..24cd2905 100644 --- a/src/sprite.rs +++ b/src/sprite.rs @@ -1,9 +1,9 @@ -use crate::canvas::canvas_state::{Drawable, DrawableTest, CanvasFontHandle}; use std::sync::Arc; -use crate::canvas::shader::text_shader::GlyphInstance; -use crate::canvas::canvas_buffer::CanvasFont; use crate::util::vertex_3d::Vertex3D; use crate::canvas::*; +use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, CanvasTextureHandle}; +use crate::canvas::managed::shader::text_shader::GlyphInstance; +use crate::canvas::canvas_state::{DrawableTest, Drawable}; /// #[derive(Debug, Clone)] diff --git a/src/vkprocessor.rs b/src/vkprocessor.rs index c50e8994..49f2039e 100644 --- a/src/vkprocessor.rs +++ b/src/vkprocessor.rs @@ -11,17 +11,16 @@ use winit::Window; use crate::compute::compu_state::CompuState; use vulkano::image::ImageUsage; use crate::compute::compu_frame::CompuFrame; -use crate::canvas::canvas_state::{CanvasState, CanvasFontHandle}; use crate::canvas::canvas_frame::CanvasFrame; -use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle}; -use crate::compute::compu_buffer::{CompuBuffers}; use std::time::Duration; use vulkano::pipeline::depth_stencil::{DynamicStencilValue, StencilFaceFlags}; -use crate::canvas::shader::generic_shader::GenericShader; -use crate::canvas::shader::text_shader::{TextShader, GlyphInstance}; use vulkano::pipeline::vertex::{OneVertexOneInstanceDefinition, SingleBufferDefinition}; use crate::util::vertex_3d::Vertex3D; -use crate::canvas::{CanvasTextureHandle, CompiledGraphicsPipelineHandle, CanvasImageHandle, CompuBufferHandle}; +use crate::canvas::canvas_state::CanvasState; +use crate::canvas::managed::shader::generic_shader::GenericShader; +use crate::canvas::managed::shader::text_shader::TextShader; +use crate::canvas::managed::handles::{CanvasTextureHandle, CompiledGraphicsPipelineHandle, CanvasFontHandle, CanvasImageHandle}; +use crate::compute::managed::handles::{CompuKernelHandle, CompuBufferHandle}; /// VKProcessor holds the vulkan instance information, the swapchain,