compute shader support apparently? not tested pls no bulli

This commit is contained in:
Noah Santschi-Cooney 2021-03-05 17:26:51 +00:00
parent b649aeb1f6
commit db5e5afb26
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
2 changed files with 30 additions and 10 deletions

View file

@ -111,7 +111,7 @@ impl Display for IncludePosition {
}
pub enum TreeType {
Fragment, Vertex, Geometry
Fragment, Vertex, Geometry, Compute
}
impl MinecraftShaderLanguageServer {
@ -290,15 +290,24 @@ impl MinecraftShaderLanguageServer {
merge_views::generate_merge_list(&tree, &all_sources, &graph)
};
let root_path = self.graph.borrow().get_node(root).clone();
let tree_type = if root_path.extension().unwrap() == "fsh" {
let root_path = self.graph.borrow().get_node(root);
let ext = match root_path.extension() {
Some(ext) => ext,
None => {
back_fill(&all_sources, &mut diagnostics);
return Ok(diagnostics)
},
};
let tree_type = if ext == "fsh" {
TreeType::Fragment
} else if root_path.extension().unwrap() == "vsh" {
} else if ext == "vsh" {
TreeType::Vertex
} else if root_path.extension().unwrap() == "gsh" {
} else if ext == "gsh" {
TreeType::Geometry
} else if ext == "csh" {
TreeType::Compute
} else {
eprintln!("got a non fsh|vsh ({:?}) as a file root ancestor: {:?}", root_path.extension().unwrap(), root_path);
eprintln!("got a non fsh|vsh|gsh|csh ({:?}) as a file root ancestor: {:?}", ext, root_path);
back_fill(&all_sources, &mut diagnostics);
return Ok(diagnostics)
};
@ -325,14 +334,20 @@ impl MinecraftShaderLanguageServer {
};
let root_path = self.graph.borrow().get_node(*root).clone();
let tree_type = if root_path.extension().unwrap() == "fsh" {
let ext = match root_path.extension() {
Some(ext) => ext,
None => continue
};
let tree_type = if ext == "fsh" {
TreeType::Fragment
} else if root_path.extension().unwrap() == "vsh" {
} else if ext == "vsh" {
TreeType::Vertex
} else if root_path.extension().unwrap() == "gsh" {
} else if ext == "gsh" {
TreeType::Geometry
} else if ext == "csh" {
TreeType::Compute
} else {
eprintln!("got a non fsh|vsh ({:?}) as a file root ancestor: {:?}", root_path.extension().unwrap(), root_path);
eprintln!("got a non fsh|vsh|gsh|csh ({:?}) as a file root ancestor: {:?}", ext, root_path);
continue;
};

View file

@ -78,6 +78,11 @@ impl ShaderValidator for OpenGLContext {
let geometry_shader = gl::CreateShader(gl::GEOMETRY_SHADER);
self.compile_and_get_shader_log(geometry_shader, source)
}
crate::TreeType::Compute => {
// Compute shader
let compute_shader= gl::CreateShader(gl::COMPUTE_SHADER);
self.compile_and_get_shader_log(compute_shader, source)
}
}
}
}