compiles. Need a good hard think to see what this interface is going to look like

This commit is contained in:
2019-10-17 22:57:27 -07:00
parent ffa04d0bb1
commit f1e8990dba
6 changed files with 16 additions and 10 deletions

View File

@@ -56,7 +56,7 @@ Type: Text
Color
frame.draw(text) {
text.type == TEXT { // When it matches to default text shader
text_shader.get_definition()
text_shader.get_pipeline()

View File

@@ -18,6 +18,7 @@ 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;
/// CanvasShader holds the pipeline and render pass for the input shader source
#[derive(Clone)]
@@ -75,12 +76,14 @@ impl CompiledGraphicsPipeline for GenericShader {
)).unwrap()
};
let vertex_definition = RuntimeVertexDef::from_primitive(0);
GenericShader {
graphics_pipeline:
Some(Arc::new(GraphicsPipeline::start()
//SingleBufferDefinition::<Vertex3D>
.vertex_input(T::new())
.vertex_input(vertex_definition)
.vertex_shader(vertex_entry_point.clone(), ShaderSpecializationConstants {
first_constant: 0,

View File

@@ -15,6 +15,7 @@ use vulkano::pipeline::vertex::{SingleBufferDefinition, OneVertexOneInstanceDefi
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;
#[derive(Default, Debug, Clone, Copy)]
pub struct GlyphInstance {
@@ -45,7 +46,7 @@ impl CompiledGraphicsPipelineResources for TextShader {}
impl CompiledGraphicsPipeline for TextShader {
/// This will explode when the shader does not want to compile
fn new<T>(filename: String,
fn new(filename: String,
device: Arc<Device>,
handle: Arc<CompiledGraphicsPipelineHandle>,
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>) -> TextShader {
@@ -104,11 +105,13 @@ impl CompiledGraphicsPipeline for TextShader {
},
};
let vertex_definition = RuntimeVertexDef::from_primitive(0);
TextShader {
graphics_pipeline:
Some(Arc::new(GraphicsPipeline::start()
//OneVertexOneInstanceDefinition::<Vertex3D, GlyphInstance>
.vertex_input(T::new())
.vertex_input(vertex_definition)
.vertex_shader(vertex_entry_point.clone(), ShaderSpecializationConstants {
first_constant: 0,

View File

@@ -159,10 +159,10 @@ impl<'a> VkProcessor<'a> {
/// A hardcoded list of shaders which can be proloaded from this function
pub fn preload_shaders(&mut self) {
self.canvas_state.load_shader::<GenericShader, SingleBufferDefinition::<Vertex3D>>(String::from("color-passthrough"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<GenericShader, SingleBufferDefinition::<Vertex3D>>(String::from("simple_texture"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<GenericShader, SingleBufferDefinition::<Vertex3D>>(String::from("simple_image"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<TextShader, OneVertexOneInstanceDefinition::<Vertex3D, GlyphInstance>>(String::from("simple_text"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<GenericShader>(String::from("color-passthrough"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<GenericShader>(String::from("simple_texture"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<GenericShader>(String::from("simple_image"), self.physical.clone(), self.capabilities.clone());
self.canvas_state.load_shader::<TextShader>(String::from("simple_text"), self.physical.clone(), self.capabilities.clone());
}
/// A hardcoded list of shaders which can be proloaded from this function