diff --git a/lvk/LVK.h b/lvk/LVK.h index c82527a760..365051a2dc 100644 --- a/lvk/LVK.h +++ b/lvk/LVK.h @@ -514,6 +514,13 @@ enum ShaderStage : uint8_t { Stage_Comp, Stage_Task, Stage_Mesh, + // ray tracing + Stage_RayGen, + Stage_AnyHit, + Stage_ClosestHit, + Stage_Miss, + Stage_Intersection, + Stage_Collable, }; struct VertexInput final { diff --git a/lvk/vulkan/VulkanClasses.cpp b/lvk/vulkan/VulkanClasses.cpp index f16a6526a8..5a462c26b4 100644 --- a/lvk/vulkan/VulkanClasses.cpp +++ b/lvk/vulkan/VulkanClasses.cpp @@ -221,6 +221,18 @@ VkShaderStageFlagBits shaderStageToVkShaderStage(lvk::ShaderStage stage) { return VK_SHADER_STAGE_TASK_BIT_EXT; case lvk::Stage_Mesh: return VK_SHADER_STAGE_MESH_BIT_EXT; + case lvk::Stage_RayGen: + return VK_SHADER_STAGE_RAYGEN_BIT_KHR; + case lvk::Stage_AnyHit: + return VK_SHADER_STAGE_ANY_HIT_BIT_KHR; + case lvk::Stage_ClosestHit: + return VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR; + case lvk::Stage_Miss: + return VK_SHADER_STAGE_MISS_BIT_KHR; + case lvk::Stage_Intersection: + return VK_SHADER_STAGE_INTERSECTION_BIT_KHR; + case lvk::Stage_Collable: + return VK_SHADER_STAGE_CALLABLE_BIT_KHR; }; LVK_ASSERT(false); return VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM; diff --git a/lvk/vulkan/VulkanUtils.cpp b/lvk/vulkan/VulkanUtils.cpp index c19efba7fa..f12d306ece 100644 --- a/lvk/vulkan/VulkanUtils.cpp +++ b/lvk/vulkan/VulkanUtils.cpp @@ -586,6 +586,20 @@ static glslang_stage_t getGLSLangShaderStage(VkShaderStageFlagBits stage) { return GLSLANG_STAGE_TASK; case VK_SHADER_STAGE_MESH_BIT_EXT: return GLSLANG_STAGE_MESH; + + // ray tracing + case VK_SHADER_STAGE_RAYGEN_BIT_KHR: + return GLSLANG_STAGE_RAYGEN; + case VK_SHADER_STAGE_ANY_HIT_BIT_KHR: + return GLSLANG_STAGE_ANYHIT; + case VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR: + return GLSLANG_STAGE_CLOSESTHIT; + case VK_SHADER_STAGE_MISS_BIT_KHR: + return GLSLANG_STAGE_MISS; + case VK_SHADER_STAGE_INTERSECTION_BIT_KHR: + return GLSLANG_STAGE_INTERSECT; + case VK_SHADER_STAGE_CALLABLE_BIT_KHR: + return GLSLANG_STAGE_CALLABLE; default: assert(false); };