mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2025-02-16 09:02:25 +00:00
Raytracing shaders with vulkano-shaders (#1888)
* Support for compiling ray shaders (still broken) * Remove debug print and fix unimplemented panic
This commit is contained in:
parent
57feb317c5
commit
31a203303e
@ -73,6 +73,14 @@ fn write_shader_execution(execution: &ShaderExecution) -> TokenStream {
|
||||
}
|
||||
ShaderExecution::Fragment => quote! { ::vulkano::shader::ShaderExecution::Fragment },
|
||||
ShaderExecution::Compute => quote! { ::vulkano::shader::ShaderExecution::Compute },
|
||||
ShaderExecution::RayGeneration => {
|
||||
quote! { ::vulkano::shader::ShaderExecution::RayGeneration}
|
||||
}
|
||||
ShaderExecution::AnyHit => quote! { ::vulkano::shader::ShaderExecution::AnyHit},
|
||||
ShaderExecution::ClosestHit => quote! { ::vulkano::shader::ShaderExecution::ClosestHit},
|
||||
ShaderExecution::Miss => quote! { ::vulkano::shader::ShaderExecution::Miss},
|
||||
ShaderExecution::Intersection => quote! { ::vulkano::shader::ShaderExecution::Intersection},
|
||||
ShaderExecution::Callable => quote! { ::vulkano::shader::ShaderExecution::Callable},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,14 @@ impl Parse for MacroInput {
|
||||
"tess_ctrl" => ShaderKind::TessControl,
|
||||
"tess_eval" => ShaderKind::TessEvaluation,
|
||||
"compute" => ShaderKind::Compute,
|
||||
_ => panic!("Unexpected shader type, valid values: vertex, fragment, geometry, tess_ctrl, tess_eval, compute")
|
||||
"raygen" => ShaderKind::RayGeneration,
|
||||
"anyhit" => ShaderKind::AnyHit,
|
||||
"closesthit" => ShaderKind::ClosestHit,
|
||||
"miss" => ShaderKind::Miss,
|
||||
"intersection" => ShaderKind::Intersection,
|
||||
"callable" => ShaderKind::Callable,
|
||||
_ => panic!(concat!("Unexpected shader type, valid values: vertex, fragment, geometry, tess_ctrl, ",
|
||||
"tess_eval, compute, raygen, anyhit, closesthit, miss, intersection, callable"))
|
||||
};
|
||||
|
||||
output.0 = Some(ty);
|
||||
|
@ -454,6 +454,12 @@ pub enum ShaderExecution {
|
||||
Geometry(GeometryShaderExecution),
|
||||
Fragment,
|
||||
Compute,
|
||||
RayGeneration,
|
||||
AnyHit,
|
||||
ClosestHit,
|
||||
Miss,
|
||||
Intersection,
|
||||
Callable,
|
||||
}
|
||||
|
||||
/*#[derive(Clone, Copy, Debug)]
|
||||
@ -1059,6 +1065,12 @@ impl From<ShaderExecution> for ShaderStage {
|
||||
ShaderExecution::Geometry(_) => Self::Geometry,
|
||||
ShaderExecution::Fragment => Self::Fragment,
|
||||
ShaderExecution::Compute => Self::Compute,
|
||||
ShaderExecution::RayGeneration => Self::Raygen,
|
||||
ShaderExecution::AnyHit => Self::AnyHit,
|
||||
ShaderExecution::ClosestHit => Self::ClosestHit,
|
||||
ShaderExecution::Miss => Self::Miss,
|
||||
ShaderExecution::Intersection => Self::Intersection,
|
||||
ShaderExecution::Callable => Self::Callable,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,17 +154,14 @@ fn shader_execution(
|
||||
|
||||
ExecutionModel::GLCompute => ShaderExecution::Compute,
|
||||
|
||||
ExecutionModel::Kernel
|
||||
| ExecutionModel::TaskNV
|
||||
| ExecutionModel::MeshNV
|
||||
| ExecutionModel::RayGenerationKHR
|
||||
| ExecutionModel::IntersectionKHR
|
||||
| ExecutionModel::AnyHitKHR
|
||||
| ExecutionModel::ClosestHitKHR
|
||||
| ExecutionModel::MissKHR
|
||||
| ExecutionModel::CallableKHR => {
|
||||
todo!()
|
||||
}
|
||||
ExecutionModel::RayGenerationKHR => ShaderExecution::RayGeneration,
|
||||
ExecutionModel::IntersectionKHR => ShaderExecution::Intersection,
|
||||
ExecutionModel::AnyHitKHR => ShaderExecution::AnyHit,
|
||||
ExecutionModel::ClosestHitKHR => ShaderExecution::ClosestHit,
|
||||
ExecutionModel::MissKHR => ShaderExecution::Miss,
|
||||
ExecutionModel::CallableKHR => ShaderExecution::Callable,
|
||||
|
||||
ExecutionModel::Kernel | ExecutionModel::TaskNV | ExecutionModel::MeshNV => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -870,6 +867,8 @@ fn descriptor_requirements_of(spirv: &Spirv, variable_id: Id) -> DescriptorVaria
|
||||
Some(element_type)
|
||||
}
|
||||
|
||||
&Instruction::TypeAccelerationStructureKHR { result_id } => None, // FIXME temporary workaround
|
||||
|
||||
_ => {
|
||||
let name = variable_id_info
|
||||
.iter_name()
|
||||
|
Loading…
Reference in New Issue
Block a user