working on docs
This commit is contained in:
@@ -10,12 +10,13 @@ use vulkano::pipeline::shader::{GraphicsShaderType, ShaderModule, Specialization
|
||||
use vulkano::swapchain::{Capabilities};
|
||||
use crate::vertex_2d::{ColoredVertex2D, Vertex2D};
|
||||
|
||||
/*
|
||||
|
||||
CanvasShader holds the pipeline and render pass for the inputted shader source
|
||||
|
||||
*/
|
||||
/// Typed wrapper for a u32 shader handle (index id)
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct CanvasShaderHandle {
|
||||
pub handle: u32
|
||||
}
|
||||
|
||||
/// CanvasShader holds the pipeline and render pass for the input shader source
|
||||
#[derive(Clone)]
|
||||
pub struct CanvasShader {
|
||||
|
||||
@@ -27,6 +28,8 @@ pub struct CanvasShader {
|
||||
|
||||
impl CanvasShader {
|
||||
|
||||
/// Takes the filename of a .vertex .fragment shader combo in resources/shaders/
|
||||
/// Returns pathbuffer of that vertex and fragment shader
|
||||
fn get_path(filename: String) -> (PathBuf, PathBuf) {
|
||||
|
||||
let project_root =
|
||||
@@ -47,10 +50,13 @@ impl CanvasShader {
|
||||
(vertex_shader_path, fragment_shader_path)
|
||||
}
|
||||
|
||||
/// Clone and returns the compiled graphics pipeline
|
||||
pub fn get_pipeline(&self) -> Arc<dyn GraphicsPipelineAbstract + Sync + Send> {
|
||||
self.graphics_pipeline.clone().unwrap()
|
||||
}
|
||||
|
||||
/// Create a new `Colored` shader. Which just means that it uses ColoredVertex2D's
|
||||
/// This will explode when the shader does not want to compile
|
||||
pub fn new_colored(filename: String,
|
||||
capabilities: Capabilities,
|
||||
queue: Arc<Queue>,
|
||||
@@ -168,6 +174,8 @@ impl CanvasShader {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new `Textured` shader. Which just means that it uses plain Vertex2D's
|
||||
/// This will explode when the shader does not want to compile
|
||||
pub fn new_textured(filename: String,
|
||||
capabilities: Capabilities,
|
||||
queue: Arc<Queue>,
|
||||
@@ -289,7 +297,7 @@ impl CanvasShader {
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Default, Debug, Clone)]
|
||||
// TODO: This needs to be duplicated and moved into their respective containers shaderkenrels copute
|
||||
/// Specialization constants which can be passed to the shader. Pretty much placeholder ATM
|
||||
struct ShaderSpecializationConstants {
|
||||
first_constant: i32,
|
||||
second_constant: u32,
|
||||
|
||||
Reference in New Issue
Block a user