Switched vertex type to be chosen at the shader load
This commit is contained in:
@@ -26,7 +26,7 @@ use std::borrow::Borrow;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use rusttype::{Font, PositionedGlyph, Scale, Rect, point, GlyphId, Line, Curve, Segment};
|
||||
use vulkano::pipeline::vertex::VertexDefinition;
|
||||
use vulkano::pipeline::vertex::{VertexDefinition, Vertex};
|
||||
use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef;
|
||||
use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle, CompiledShaderHandle, Handle, DrawableHandle};
|
||||
use crate::canvas::managed::gpu_buffers::{CanvasImage, CanvasTexture, CanvasFont};
|
||||
@@ -34,6 +34,7 @@ use crate::canvas::managed::shader::shader_common::CompiledGraphicsPipeline;
|
||||
use crate::canvas::managed::shader::generic_shader::GenericShader;
|
||||
use crate::VertexTypes;
|
||||
use crate::util::vertex::{TextVertex3D, TextureVertex2D, ImageVertex2D, ColorVertex2D, CanvasFrameAllocation};
|
||||
use shade_runner::Input;
|
||||
|
||||
|
||||
/// Canvas state is used for storage of texture and image buffers in addition to vertex buffers
|
||||
@@ -255,17 +256,17 @@ impl CanvasState {
|
||||
|
||||
/// Load and Compile a shader with the filename at resources/shaders
|
||||
/// Takes physical and capabilities as we don't store that in Canvas
|
||||
pub fn load_shader<T: 'static>(&mut self,
|
||||
pub fn load_shader<T: 'static, V>(&mut self,
|
||||
filename: String,
|
||||
physical: PhysicalDevice,
|
||||
capabilities: Capabilities) -> Option<Arc<CompiledShaderHandle>>
|
||||
where T: CompiledGraphicsPipeline {
|
||||
where T: CompiledGraphicsPipeline, V: Vertex {
|
||||
|
||||
let handle = Arc::new(CompiledShaderHandle {
|
||||
handle: self.shader_buffers.len() as u32
|
||||
});
|
||||
|
||||
let shader: Box<dyn CompiledGraphicsPipeline> = Box::new(T::new(
|
||||
let shader: Box<dyn CompiledGraphicsPipeline> = Box::new(T::new::<V>(
|
||||
filename.clone(),
|
||||
self.device.clone(),
|
||||
handle.clone(),
|
||||
|
||||
Reference in New Issue
Block a user