Skip to content

Commit

Permalink
Added flags isAccelerationStructureEnabled_ and isRayTracingEnabled_
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Sep 9, 2024
1 parent 6f84591 commit 56f790a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lvk/vulkan/VulkanClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3298,6 +3298,11 @@ lvk::Holder<lvk::QueryPoolHandle> lvk::VulkanContext::createQueryPool(uint32_t n
lvk::Holder<lvk::AccelStructHandle> lvk::VulkanContext::createAccelerationStructure(const AccelStructDesc& desc, Result* outResult) {
LVK_PROFILER_FUNCTION();

if (!LVK_VERIFY(isAccelerationStructureEnabled_)) {
Result::setResult(outResult, Result(Result::Code::RuntimeError, "VK_KHR_acceleration_structure is not enabled"));
return {};
}

Result result;

AccelStructHandle handle;
Expand Down Expand Up @@ -4201,7 +4206,6 @@ VkPipeline lvk::VulkanContext::getVkPipeline(ComputePipelineHandle handle) {
.basePipelineHandle = VK_NULL_HANDLE,
.basePipelineIndex = -1,
};
VkPipeline pipeline = VK_NULL_HANDLE;
VK_ASSERT(vkCreateComputePipelines(vkDevice_, pipelineCache_, 1, &ci, nullptr, &cps->pipeline_));
VK_ASSERT(lvk::setDebugObjectName(vkDevice_, VK_OBJECT_TYPE_PIPELINE, (uint64_t)cps->pipeline_, cps->desc_.debugName));
}
Expand Down Expand Up @@ -5144,9 +5148,11 @@ lvk::Result lvk::VulkanContext::initContext(const HWDeviceDesc& desc) {

if (isRequestedCustomDeviceExtension(VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME)) {
addNextPhysicalDeviceProperties(&accelerationStructureProperties_);
isAccelerationStructureEnabled_ = true;
}
if (isRequestedCustomDeviceExtension(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME)) {
addNextPhysicalDeviceProperties(&rayTracingPipelineProperties_);
isRayTracingEnabled_ = true;
}

vkGetPhysicalDeviceFeatures2(vkPhysicalDevice_, &vkFeatures10_);
Expand Down
3 changes: 3 additions & 0 deletions lvk/vulkan/VulkanClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,14 @@ class VulkanContext final : public IContext {
std::unique_ptr<lvk::VulkanStagingDevice> stagingDevice_;
uint32_t currentMaxTextures_ = 16;
uint32_t currentMaxSamplers_ = 16;
uint32_t currentMaxAccelStructs_ = 1;
VkDescriptorSetLayout vkDSL_ = VK_NULL_HANDLE;
VkDescriptorPool vkDPool_ = VK_NULL_HANDLE;
VkDescriptorSet vkDSet_ = VK_NULL_HANDLE;
// don't use staging on devices with shared host-visible memory
bool useStaging_ = true;
bool isAccelerationStructureEnabled_ = false;
bool isRayTracingEnabled_ = false;

std::unique_ptr<struct VulkanContextImpl> pimpl_;

Expand Down

0 comments on commit 56f790a

Please sign in to comment.