Skip to content

Commit

Permalink
Added shader stages for VK_KHR_ray_tracing_pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Sep 5, 2024
1 parent 6dc4b2f commit 60ef63f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lvk/LVK.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions lvk/vulkan/VulkanClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions lvk/vulkan/VulkanUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 60ef63f

Please sign in to comment.