moved around the file heirarchy to make these handles safer

master
mitchellhansen 5 years ago
parent bb5617420e
commit 8fcd26063a

@ -2,11 +2,11 @@ use crate::util::vertex_3d::{Vertex3D};
use std::sync::Arc; use std::sync::Arc;
use std::collections::HashMap; use std::collections::HashMap;
use crate::canvas::canvas_state::{Drawable}; use crate::canvas::canvas_state::{Drawable};
use crate::canvas::shader::text_shader::GlyphInstance;
use std::hash::Hash; use std::hash::Hash;
use crate::canvas::*; use crate::canvas::*;
use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef;
use crate::canvas::canvas_state::CanvasFontHandle; use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle};
use crate::canvas::managed::shader::text_shader::GlyphInstance;
/// I dont know why this isnt working /// I dont know why this isnt working
/// fqowiejf /// fqowiejf

@ -20,20 +20,19 @@ use vulkano::pipeline::viewport::Viewport;
use vulkano::descriptor::descriptor::DescriptorDescTy::TexelBuffer; use vulkano::descriptor::descriptor::DescriptorDescTy::TexelBuffer;
use crate::canvas::canvas_frame::CanvasFrame; use crate::canvas::canvas_frame::CanvasFrame;
use std::hash::Hash; use std::hash::Hash;
use crate::canvas::canvas_buffer::{CanvasImage, CanvasTexture, CanvasFont};
use crate::util::vertex_3d::{Vertex3D, TextVertex3D}; use crate::util::vertex_3d::{Vertex3D, TextVertex3D};
use vulkano::pipeline::depth_stencil::{StencilFaceFlags, DynamicStencilValue}; 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 vulkano::memory::pool::PotentialDedicatedAllocation::Generic;
use std::borrow::Borrow; use std::borrow::Borrow;
use crate::canvas::shader::text_shader::GlyphInstance;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use rusttype::{Font, PositionedGlyph, Scale, Rect, point, GlyphId}; use rusttype::{Font, PositionedGlyph, Scale, Rect, point, GlyphId};
use vulkano::pipeline::vertex::VertexDefinition; use vulkano::pipeline::vertex::VertexDefinition;
use crate::canvas::{CanvasTextureHandle, CanvasImageHandle, CompiledGraphicsPipelineHandle, Handle}; use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef;
use crate::canvas::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 // 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 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 /// Canvas state also contains logic for writing the stored buffers to the command_buffer
#[derive(Clone)] #[derive(Clone)]
@ -251,7 +237,7 @@ impl CanvasState {
/// Return the image buffer from an input image handle /// Return the image buffer from an input image handle
pub fn get_image(&self, image_handle: Arc<CanvasImageHandle>) -> Arc<AttachmentImage> { pub fn get_image(&self, image_handle: Arc<CanvasImageHandle>) -> Arc<AttachmentImage> {
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() .clone().buffer.clone()
} }
@ -418,7 +404,7 @@ impl CanvasState {
/// Using the texture handle, grab the stored texture and return the buffer /// Using the texture handle, grab the stored texture and return the buffer
pub fn get_texture(&self, texture_handle: Arc<CanvasTextureHandle>) pub fn get_texture(&self, texture_handle: Arc<CanvasTextureHandle>)
-> Arc<ImmutableImage<Format>> { -> Arc<ImmutableImage<Format>> {
let handle = texture_handle.handle as usize; let handle = texture_handle.get_handle() as usize;
if let Some(i) = self.texture_buffers.get(handle) { if let Some(i) = self.texture_buffers.get(handle) {
return i.clone().buffer.clone(); return i.clone().buffer.clone();
@ -550,7 +536,7 @@ impl CanvasState {
// Solid colors // Solid colors
let mut shader = self.shader_buffers.get( let mut shader = self.shader_buffers.get(
self.get_shader_handle(String::from("color-passthrough")) self.get_shader_handle(String::from("color-passthrough"))
.unwrap().clone().handle as usize .unwrap().clone().get_handle() as usize
).unwrap(); ).unwrap();
// This looks a little weird as colored_vertex_buffer is a vec of GPU allocated vecs. // This looks a little weird as colored_vertex_buffer is a vec of GPU allocated vecs.
@ -568,12 +554,12 @@ impl CanvasState {
// Images // Images
let mut shader = self.shader_buffers.get( let mut shader = self.shader_buffers.get(
self.get_shader_handle(String::from("simple_image")) self.get_shader_handle(String::from("simple_image"))
.unwrap().clone().handle as usize .unwrap().clone().get_handle() as usize
).unwrap(); ).unwrap();
if !self.image_vertex_buffer.is_empty() { if !self.image_vertex_buffer.is_empty() {
for (image_handle, vertex_buffer) in self.image_vertex_buffer.clone() { 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() let descriptor_set = self.image_buffers.get(handle).clone().unwrap().clone()
.get_descriptor_set(shader.get_pipeline().clone()); .get_descriptor_set(shader.get_pipeline().clone());
@ -589,12 +575,12 @@ impl CanvasState {
// Textures // Textures
let mut shader = self.shader_buffers.get( let mut shader = self.shader_buffers.get(
self.get_shader_handle(String::from("simple_texture")) self.get_shader_handle(String::from("simple_texture"))
.unwrap().clone().handle as usize .unwrap().clone().get_handle() as usize
).unwrap(); ).unwrap();
if !self.textured_vertex_buffer.is_empty() { if !self.textured_vertex_buffer.is_empty() {
for (texture_handle, vertex_buffer) in self.textured_vertex_buffer.clone() { 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() let descriptor_set = self.texture_buffers.get(handle).clone().unwrap().clone()
.get_descriptor_set(shader.get_pipeline(), self.sampler.clone()); .get_descriptor_set(shader.get_pipeline(), self.sampler.clone());
@ -610,7 +596,7 @@ impl CanvasState {
// Text // Text
let mut shader = self.shader_buffers.get( let mut shader = self.shader_buffers.get(
self.get_shader_handle(String::from("simple_text")) self.get_shader_handle(String::from("simple_text"))
.unwrap().clone().handle as usize .unwrap().clone().get_handle() as usize
).unwrap(); ).unwrap();
// //

@ -10,9 +10,7 @@ use vulkano::format::ClearValue;
use vulkano::format::Format::R8Unorm; use vulkano::format::Format::R8Unorm;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use crate::canvas::shader::text_shader::GlyphInstance;
use crate::util::vertex_3d::{Vertex3D, TextVertex3D}; use crate::util::vertex_3d::{Vertex3D, TextVertex3D};
use crate::canvas::canvas_buffer::CanvasFont;
//pub struct Glyph {} //pub struct Glyph {}

@ -7,8 +7,7 @@ use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
use vulkano::buffer::{CpuAccessibleBuffer, BufferAccess}; use vulkano::buffer::{CpuAccessibleBuffer, BufferAccess};
use vulkano::pipeline::GraphicsPipelineAbstract; use vulkano::pipeline::GraphicsPipelineAbstract;
use rusttype::Font; use rusttype::Font;
use crate::canvas::{CanvasTextureHandle, CanvasImageHandle}; use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle};
use crate::canvas::canvas_state::CanvasFontHandle;
/// Canvas buffer which represents an allocated Texture with a key and dimensions /// Canvas buffer which represents an allocated Texture with a key and dimensions

@ -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
}
}

@ -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}; use vulkano::pipeline::shader::{SpecializationConstants, SpecializationMapEntry};

@ -1,13 +1,11 @@
use vulkano::pipeline::GraphicsPipelineAbstract; use vulkano::pipeline::GraphicsPipelineAbstract;
use std::sync::Arc; use std::sync::Arc;
use crate::canvas::shader::common::{ShaderType, CompiledGraphicsPipeline};
use std::collections::{HashSet, HashMap}; use std::collections::{HashSet, HashMap};
use vulkano::device::Device; use vulkano::device::Device;
use vulkano::framebuffer::{RenderPassAbstract, Subpass}; use vulkano::framebuffer::{RenderPassAbstract, Subpass};
use vulkano::pipeline::GraphicsPipeline; use vulkano::pipeline::GraphicsPipeline;
use vulkano::pipeline::shader::{GraphicsEntryPoint, ShaderModule, GraphicsShaderType, GeometryShaderExecutionMode, ShaderInterfaceDef}; use vulkano::pipeline::shader::{GraphicsEntryPoint, ShaderModule, GraphicsShaderType, GeometryShaderExecutionMode, ShaderInterfaceDef};
use crate::canvas::shader::ShaderSpecializationConstants;
use shade_runner::{Input, Output, Layout, Entry}; use shade_runner::{Input, Output, Layout, Entry};
use std::ffi::CStr; use std::ffi::CStr;
use std::marker::PhantomData; use std::marker::PhantomData;
@ -15,11 +13,12 @@ use vulkano::pipeline::depth_stencil::{DepthStencil, Compare, DepthBounds, Stenc
use vulkano::pipeline::vertex::{SingleBufferDefinition, VertexDefinition}; use vulkano::pipeline::vertex::{SingleBufferDefinition, VertexDefinition};
use crate::util::vertex_3d::Vertex3D; use crate::util::vertex_3d::Vertex3D;
use shade_runner as sr; use shade_runner as sr;
use crate::canvas::shader::common::CompiledGraphicsPipelineResources;
use vulkano::memory::pool::PotentialDedicatedAllocation::Generic; use vulkano::memory::pool::PotentialDedicatedAllocation::Generic;
use vulkano::SafeDeref; use vulkano::SafeDeref;
use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; use crate::canvas::managed::shader::shader_common::{ShaderType, CompiledGraphicsPipelineResources, CompiledGraphicsPipeline};
use crate::canvas::CompiledGraphicsPipelineHandle; 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 /// CanvasShader holds the pipeline and render pass for the input shader source
#[derive(Clone)] #[derive(Clone)]

@ -0,0 +1,4 @@
pub mod text_shader;
pub mod generic_shader;
pub mod dynamic_vertex;
pub mod shader_common;

@ -8,7 +8,7 @@ use vulkano::pipeline::shader::{ShaderModule, GraphicsShaderType, GeometryShader
use vulkano::device::Device; use vulkano::device::Device;
use shade_runner::Entry; use shade_runner::Entry;
use shaderc::ShaderKind; 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 /// Inheriting this gives private functions to grab resources
pub(super) trait CompiledGraphicsPipelineResources { pub trait CompiledGraphicsPipelineResources {
fn get_path(filename: String, shader_type: ShaderType) -> PathBuf { fn get_path(filename: String, shader_type: ShaderType) -> PathBuf {
let project_root = let project_root =

@ -1,22 +1,22 @@
use vulkano::pipeline::GraphicsPipelineAbstract; use vulkano::pipeline::GraphicsPipelineAbstract;
use std::sync::Arc; use std::sync::Arc;
use crate::canvas::shader::common::{ShaderType, CompiledGraphicsPipeline, CompiledGraphicsPipelineResources};
use std::collections::{HashSet, HashMap}; use std::collections::{HashSet, HashMap};
use vulkano::device::Device; use vulkano::device::Device;
use vulkano::framebuffer::{RenderPassAbstract, Subpass}; use vulkano::framebuffer::{RenderPassAbstract, Subpass};
use vulkano::pipeline::GraphicsPipeline; use vulkano::pipeline::GraphicsPipeline;
use vulkano::pipeline::shader::{GraphicsEntryPoint, ShaderModule, GraphicsShaderType, GeometryShaderExecutionMode}; use vulkano::pipeline::shader::{GraphicsEntryPoint, ShaderModule, GraphicsShaderType, GeometryShaderExecutionMode};
use crate::canvas::shader::ShaderSpecializationConstants;
use shade_runner::{Input, Output, Layout, Entry}; use shade_runner::{Input, Output, Layout, Entry};
use std::ffi::CStr; use std::ffi::CStr;
use std::marker::PhantomData; use std::marker::PhantomData;
use vulkano::pipeline::depth_stencil::{DepthStencil, Compare, DepthBounds, Stencil, StencilOp}; use vulkano::pipeline::depth_stencil::{DepthStencil, Compare, DepthBounds, Stencil, StencilOp};
use vulkano::pipeline::vertex::{SingleBufferDefinition, OneVertexOneInstanceDefinition}; use vulkano::pipeline::vertex::{SingleBufferDefinition, OneVertexOneInstanceDefinition};
use crate::util::vertex_3d::Vertex3D; use crate::util::vertex_3d::Vertex3D;
use crate::canvas::shader::generic_shader::GenericShader;
use shade_runner as sr; use shade_runner as sr;
use crate::canvas::shader::dynamic_vertex::RuntimeVertexDef; use crate::canvas::managed::shader::shader_common::{ShaderType, CompiledGraphicsPipelineResources, CompiledGraphicsPipeline};
use crate::canvas::CompiledGraphicsPipelineHandle; 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)] #[derive(Default, Debug, Clone, Copy)]
pub struct GlyphInstance { pub struct GlyphInstance {

@ -1,39 +1,6 @@
pub mod canvas_state; pub mod canvas_state;
pub mod canvas_frame; pub mod canvas_frame;
pub mod shader; pub mod managed;
pub mod canvas_text;
pub mod canvas_buffer;
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,
}

@ -1,9 +1,8 @@
use crate::canvas::canvas_state::{Drawable}; use crate::canvas::canvas_state::{Drawable};
use std::sync::Arc; use std::sync::Arc;
use crate::compute::compu_sprite::CompuSprite; use crate::canvas::managed::handles::{CanvasImageHandle};
use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle}; use crate::compute::managed::handles::{CompuKernelHandle, CompuBufferHandle};
use crate::compute::compu_buffer::{CompuBuffers}; use crate::compute::managed::compu_sprite::CompuSprite;
use crate::canvas::{CompuBufferHandle, CanvasImageHandle};
pub struct CompuFrame { pub struct CompuFrame {
// Vec<(Buffer, Kernel)> // Vec<(Buffer, Kernel)>

@ -18,10 +18,11 @@ use std::path::PathBuf;
use shade_runner::{CompiledShaders, Entry, CompileError}; use shade_runner::{CompiledShaders, Entry, CompileError};
use vulkano::pipeline::shader::ShaderModule; use vulkano::pipeline::shader::ShaderModule;
use shaderc::CompileOptions; use shaderc::CompileOptions;
use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle};
use crate::compute::compu_buffer::{CompuBuffers};
use crate::compute::compu_frame::CompuFrame; 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 /// State holding the compute buffers for computation and the kernels which will compute them
@ -98,8 +99,8 @@ impl CompuState {
// i = (Buffer, Kernel) // i = (Buffer, Kernel)
for i in compute_frame.pure_compute { for i in compute_frame.pure_compute {
let buffer_id = (*i.0).clone().handle as usize; let buffer_id = (*i.0).clone().get_handle() as usize;
let kernel_id = (*i.1).clone().handle as usize; let kernel_id = (*i.1).clone().get_handle() as usize;
let buffer = self.compute_buffers.get(buffer_id).unwrap(); let buffer = self.compute_buffers.get(buffer_id).unwrap();
let kernel = self.kernels.get(kernel_id).unwrap(); let kernel = self.kernels.get(kernel_id).unwrap();
@ -115,7 +116,7 @@ impl CompuState {
// i = (Buffer, Image, Kernel) // i = (Buffer, Image, Kernel)
for i in compute_frame.swapped_to_image { 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 image_id = i.1.clone();
let kernel_id = (*i.2).clone().handle as usize; let kernel_id = (*i.2).clone().handle as usize;
@ -143,8 +144,8 @@ impl CompuState {
// i = (Input Buffer, Output Buffer, Kernel) // i = (Input Buffer, Output Buffer, Kernel)
// Input buffer -> Kernel -> Output buffer // Input buffer -> Kernel -> Output buffer
for i in compute_frame.swapped_to_buffer { for i in compute_frame.swapped_to_buffer {
let input_buffer_id = (*i.0).clone().handle as usize; let input_buffer_id = (*i.0).clone().get_handle() as usize;
let output_buffer_id = (*i.1).clone().handle as usize; let output_buffer_id = (*i.1).clone().get_handle() as usize;
let kernel_id = (*i.2).clone().handle as usize; let kernel_id = (*i.2).clone().handle as usize;
let input_buffer = self.compute_buffers.get(input_buffer_id).unwrap(); let input_buffer = self.compute_buffers.get(input_buffer_id).unwrap();

@ -7,7 +7,7 @@ use vulkano::descriptor::descriptor_set::{PersistentDescriptorSet, PersistentDes
use image::ImageBuffer; use image::ImageBuffer;
use image::Rgba; use image::Rgba;
use shade_runner::Layout; use shade_runner::Layout;
use crate::canvas::CompuBufferHandle; use crate::compute::managed::handles::CompuBufferHandle;
#[derive(Clone)] #[derive(Clone)]

@ -8,12 +8,8 @@ use vulkano::descriptor::pipeline_layout::PipelineLayout;
use shade_runner::{CompileError, Layout, Input, Output, CompiledShaders, Entry, CompiledShader}; use shade_runner::{CompileError, Layout, Input, Output, CompiledShaders, Entry, CompiledShader};
use shaderc::CompileOptions; use shaderc::CompileOptions;
use vulkano::pipeline::shader::{ShaderModule, GraphicsEntryPoint, SpecializationConstants, SpecializationMapEntry}; 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)] #[derive(Clone)]
pub struct CompuKernel { pub struct CompuKernel {

@ -1,6 +1,6 @@
use crate::canvas::canvas_state::{Drawable}; use crate::canvas::canvas_state::{Drawable};
use std::sync::Arc; use std::sync::Arc;
use crate::canvas::{CanvasImageHandle, CanvasTextureHandle}; use crate::canvas::managed::handles::{CanvasImageHandle, CanvasTextureHandle};
pub struct CompuSprite { pub struct CompuSprite {
pub vertices: [(f32, f32, f32); 6], pub vertices: [(f32, f32, f32); 6],

@ -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
}
}

@ -0,0 +1,5 @@
pub mod compu_buffer;
pub mod compu_sprite;
pub mod compu_kernel;
pub mod handles;

@ -1,11 +1,6 @@
pub mod compu_frame; pub mod compu_frame;
pub mod compu_kernel;
pub mod compu_sprite;
pub mod compu_state; pub mod compu_state;
pub mod compu_buffer; pub mod managed;
use crate::compute::compu_state::CompuState; use crate::compute::compu_state::CompuState;
use crate::compute::compu_frame::CompuFrame; use crate::compute::compu_frame::CompuFrame;
use crate::compute::compu_sprite::CompuSprite;
use crate::compute::compu_kernel::CompuKernel;
use crate::compute::compu_buffer::CompuBuffers;

@ -24,9 +24,9 @@ use crate::util::load_raw;
use crate::sprite::{Poly, Text, TextHandle, TextVertex, TextInstance}; use crate::sprite::{Poly, Text, TextHandle, TextVertex, TextInstance};
use vulkano::instance::debug::DebugCallback; use vulkano::instance::debug::DebugCallback;
use crate::compute::compu_sprite::CompuSprite;
use crate::compute::compu_frame::CompuFrame; use crate::compute::compu_frame::CompuFrame;
use crate::canvas::canvas_frame::{CanvasFrame, GenericCanvasFrame}; use crate::canvas::canvas_frame::{CanvasFrame, GenericCanvasFrame};
use crate::compute::managed::compu_sprite::CompuSprite;
pub mod util; pub mod util;

@ -1,9 +1,9 @@
use crate::canvas::canvas_state::{Drawable, DrawableTest, CanvasFontHandle};
use std::sync::Arc; 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::util::vertex_3d::Vertex3D;
use crate::canvas::*; 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)] #[derive(Debug, Clone)]

@ -11,17 +11,16 @@ use winit::Window;
use crate::compute::compu_state::CompuState; use crate::compute::compu_state::CompuState;
use vulkano::image::ImageUsage; use vulkano::image::ImageUsage;
use crate::compute::compu_frame::CompuFrame; use crate::compute::compu_frame::CompuFrame;
use crate::canvas::canvas_state::{CanvasState, CanvasFontHandle};
use crate::canvas::canvas_frame::CanvasFrame; use crate::canvas::canvas_frame::CanvasFrame;
use crate::compute::compu_kernel::{CompuKernel, CompuKernelHandle};
use crate::compute::compu_buffer::{CompuBuffers};
use std::time::Duration; use std::time::Duration;
use vulkano::pipeline::depth_stencil::{DynamicStencilValue, StencilFaceFlags}; 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 vulkano::pipeline::vertex::{OneVertexOneInstanceDefinition, SingleBufferDefinition};
use crate::util::vertex_3d::Vertex3D; 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, /// VKProcessor holds the vulkan instance information, the swapchain,

Loading…
Cancel
Save