Skip to content

Commit 4350541

Browse files
Fixed ray-tracing tests on Vulkan
1 parent 2de861f commit 4350541

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Graphics/GraphicsEngine/interface/PipelineState.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -510,8 +510,11 @@ struct RayTracingPipelineDesc
510510
/// Shader record size plus shader group size (32 bytes) must not exceed 4096 bytes.
511511
Uint16 ShaderRecordSize DEFAULT_INITIALIZER(0);
512512

513-
/// Number of recursive calls of TraceRay() in HLSL or traceRay() in GLSL.
514-
/// Zero means no tracing of rays at all, only ray-gen shader will be executed.
513+
/// Number of recursive calls of TraceRay() in HLSL or traceRayEXT() in GLSL.
514+
/// Shaders directly invoked from the API always have a recursion depth of 0; each
515+
/// shader executed by the trace ray instruction has a recursion depth one higher than
516+
/// the recursion depth of the shader which invoked it. Applications must not invoke a
517+
/// shader with a recursion depth greater than the value of MaxRecursionDepth.
515518
/// See DeviceProperties::MaxRayTracingRecursionDepth.
516519
Uint8 MaxRecursionDepth DEFAULT_INITIALIZER(0);
517520

Tests/DiligentCoreAPITest/src/RayTracingTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1634,6 +1634,7 @@ TEST_P(RT5, InlineRayTracing_RayTracingPSO)
16341634
PSOCreateInfo.pGeneralShaders = GeneralShaders;
16351635
PSOCreateInfo.GeneralShaderCount = _countof(GeneralShaders);
16361636

1637+
// The hardware does not need a recursion stack to jump among separate programs - everything is inlined in the same shader invocation.
16371638
PSOCreateInfo.RayTracingPipeline.MaxRecursionDepth = 0;
16381639
PSOCreateInfo.PSODesc.ResourceLayout.DefaultVariableType = SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE;
16391640

Tests/DiligentCoreAPITest/src/Vulkan/RayTracingReferenceVk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -274,7 +274,7 @@ void InitializeRTContext(RTContext& Ctx, ISwapChain* pSwapChain, PSOCtorType&& P
274274
PipelineCI.pStages = Helper.Stages.data();
275275
PipelineCI.groupCount = static_cast<Uint32>(Helper.Groups.size());
276276
PipelineCI.pGroups = Helper.Groups.data();
277-
PipelineCI.maxPipelineRayRecursionDepth = 0;
277+
PipelineCI.maxPipelineRayRecursionDepth = 1;
278278
PipelineCI.layout = Ctx.vkLayout;
279279

280280
res = vkCreateRayTracingPipelinesKHR(Ctx.vkDevice, VK_NULL_HANDLE, VK_NULL_HANDLE, 1, &PipelineCI, nullptr, &Ctx.vkPipeline);

0 commit comments

Comments
 (0)