still working on getiting these shaders to a usable API

This commit is contained in:
2019-09-28 21:30:28 -07:00
parent 1a247e482a
commit 77d30591e6
15 changed files with 264 additions and 271 deletions

View File

@@ -27,6 +27,7 @@ use crate::util::vertex_3d::Vertex3D;
use vulkano::pipeline::depth_stencil::{StencilFaceFlags, DynamicStencilValue};
use crate::canvas::shader::common::{CompiledGraphicsPipeline, CompiledGraphicsPipelineHandle};
use crate::canvas::shader::generic_shader::GenericShader;
use vulkano::memory::pool::PotentialDedicatedAllocation::Generic;
/// A drawable object can be passed into a CanvasFrame to be rendered
/// Very generic implementation. (N % 2 == 0) vertices, ditto for texture coords, and rgba color
@@ -336,17 +337,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(&mut self,
pub fn load_shader<T: 'static>(&mut self,
filename: String,
physical: PhysicalDevice,
capabilities: Capabilities) -> Option<Arc<CompiledGraphicsPipelineHandle>> {
capabilities: Capabilities) -> Option<Arc<CompiledGraphicsPipelineHandle>>
where T: CompiledGraphicsPipeline {
let handle = Arc::new(CompiledGraphicsPipelineHandle {
handle: self.shader_buffers.len() as u32
});
let shader : Box<dyn CompiledGraphicsPipeline> = Box::new(GenericShader::new(
let shader : Box<dyn CompiledGraphicsPipeline> = Box::new(T::new(
filename.clone(),
self.device.clone(),
handle.clone(),