diff --git a/vulkano-shaders/src/codegen.rs b/vulkano-shaders/src/codegen.rs index f77d64e727..f02cd787e0 100644 --- a/vulkano-shaders/src/codegen.rs +++ b/vulkano-shaders/src/codegen.rs @@ -736,12 +736,24 @@ fn storage_class_requirement(storage_class: &StorageClass) -> &'static [DeviceRe StorageClass::StorageBuffer => &[DeviceRequirement::Extension( "khr_storage_buffer_storage_class", )], - StorageClass::CallableDataKHR => todo!(), - StorageClass::IncomingCallableDataKHR => todo!(), - StorageClass::RayPayloadKHR => todo!(), - StorageClass::HitAttributeKHR => todo!(), - StorageClass::IncomingRayPayloadKHR => todo!(), - StorageClass::ShaderRecordBufferKHR => todo!(), + StorageClass::CallableDataKHR => &[DeviceRequirement::Extension( + "khr_ray_tracing", + )] + StorageClass::IncomingCallableDataKHR => &[DeviceRequirement::Extension( + "khr_ray_tracing", + )] + StorageClass::RayPayloadKHR => &[DeviceRequirement::Extension( + "khr_ray_tracing", + )] + StorageClass::HitAttributeKHR => &[DeviceRequirement::Extension( + "khr_ray_tracing", + )] + StorageClass::IncomingRayPayloadKHR => &[DeviceRequirement::Extension( + "khr_ray_tracing", + )] + StorageClass::ShaderRecordBufferKHR => &[DeviceRequirement::Extension( + "khr_ray_tracing", + )] StorageClass::PhysicalStorageBuffer => todo!(), StorageClass::CodeSectionINTEL => todo!(), } diff --git a/vulkano-shaders/src/entry_point.rs b/vulkano-shaders/src/entry_point.rs index faf9ecf3fc..a69b8a0c8a 100644 --- a/vulkano-shaders/src/entry_point.rs +++ b/vulkano-shaders/src/entry_point.rs @@ -107,17 +107,16 @@ pub(super) fn write_entry_point( }; let (ty, f_call) = { - if let ExecutionModel::GLCompute = *execution { - ( - quote! { ::vulkano::pipeline::shader::ComputeEntryPoint }, - quote! { compute_entry_point( - ::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), - #descriptor_set_layout_descs, - #push_constant_ranges, - <#spec_consts_struct>::descriptors(), - )}, - ) - } else { + if let ExecutionModel::Kernel = *execution { + panic!("Kernels are not supported"); + } else if match *execution { + ExecutionModel::Vertex => true, + ExecutionModel::TessellationControl => true, + ExecutionModel::TessellationEvaluation => true, + ExecutionModel::Geometry => true, + ExecutionModel::Fragment => true, + _ => false, + } { let entry_ty = match *execution { ExecutionModel::Vertex => { quote! { ::vulkano::pipeline::shader::GraphicsShaderType::Vertex } @@ -166,19 +165,7 @@ pub(super) fn write_entry_point( quote! { ::vulkano::pipeline::shader::GraphicsShaderType::Fragment } } - ExecutionModel::GLCompute => unreachable!(), - - ExecutionModel::Kernel - | ExecutionModel::TaskNV - | ExecutionModel::MeshNV - | ExecutionModel::RayGenerationKHR - | ExecutionModel::IntersectionKHR - | ExecutionModel::AnyHitKHR - | ExecutionModel::ClosestHitKHR - | ExecutionModel::MissKHR - | ExecutionModel::CallableKHR => { - panic!("Shaders with {:?} are not supported", execution) - } + _ => unreachable!(), }; let ty = quote! { ::vulkano::pipeline::shader::GraphicsEntryPoint }; @@ -195,6 +182,27 @@ pub(super) fn write_entry_point( }; (ty, f_call) + } else if let ExecutionModel::GLCompute = *execution { + ( + quote! { ::vulkano::pipeline::shader::ComputeEntryPoint }, + quote! { compute_entry_point( + ::std::ffi::CStr::from_ptr(NAME.as_ptr() as *const _), + #descriptor_set_layout_descs, + #push_constant_ranges, + <#spec_consts_struct>::descriptors(), + )}, + ) + } else if match *execution { + ExecutionModel::RayGenerationKHR => true, + ExecutionModel::IntersectionKHR => true, + ExecutionModel::AnyHitKHR => true, + ExecutionModel::ClosestHitKHR => true, + ExecutionModel::MissKHR => true, + ExecutionModel::CallableKHR => true, + } { + panic!("Raytracing Shaders are not supported") + } else { + panic!("Shaders with {:?} are not supported", execution) } }; diff --git a/vulkano-shaders/src/lib.rs b/vulkano-shaders/src/lib.rs index 5d0b7817b3..b49341d893 100644 --- a/vulkano-shaders/src/lib.rs +++ b/vulkano-shaders/src/lib.rs @@ -112,6 +112,12 @@ //! * `tess_ctrl` //! * `tess_eval` //! * `compute` +//! * `ray_generation` +//! * `intersection` +//! * `any_hit` +//! * `closest_hit` +//! * `miss` +//! * `callable` //! //! For details on what these shader types mean, [see Vulkano's documentation][pipeline]. //! @@ -410,7 +416,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") + "ray_generation" => ShaderKind::RayGeneration, + "intersection" => ShaderKind::Intersection, + "any_hit" => ShaderKind::AnyHit, + "closest_hit" => ShaderKind::ClosestHit, + "miss" => ShaderKind::Miss, + "callable" => ShaderKind::Callable, + _ => panic!("Unexpected shader type, valid values: vertex, fragment, geometry, tess_ctrl, tess_eval, compute, \ + ray_generation, intersection, any_hit, closest_hit, miss, callable") }; output.0 = Some(ty);