MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / TEST_F

Function TEST_F

tests/unit/debug_printf_ray_tracing.cpp:47–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45};
46
47TEST_F(NegativeDebugPrintfRayTracing, Raygen) {
48 TEST_DESCRIPTION("Test debug printf in raygen shader.");
49 SetTargetApiVersion(VK_API_VERSION_1_2);
50 AddRequiredExtensions(VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME);
51 AddRequiredFeature(vkt::Feature::rayTracingPipeline);
52 AddRequiredFeature(vkt::Feature::accelerationStructure);
53 AddRequiredFeature(vkt::Feature::bufferDeviceAddress);
54 RETURN_IF_SKIP(InitDebugPrintfFramework());
55 RETURN_IF_SKIP(InitState());
56
57 vkt::rt::Pipeline pipeline(*this, m_device);
58
59 const char* ray_gen = R"glsl(
60 #version 460
61 #extension GL_EXT_ray_tracing : require
62 #extension GL_EXT_debug_printf : enable
63 layout(binding = 0, set = 0) uniform accelerationStructureEXT tlas;
64 layout(location = 0) rayPayloadEXT vec3 hit;
65
66 void main() {
67 debugPrintfEXT("In Raygen\n");
68 traceRayEXT(tlas, gl_RayFlagsOpaqueEXT, 0xff, 0, 0, 0, vec3(0,0,1), 0.1, vec3(0,0,1), 1000.0, 0);
69 }
70 )glsl";
71 pipeline.SetGlslRayGenShader(ray_gen);
72
73 pipeline.AddGlslMissShader(kRayTracingPayloadMinimalGlsl);
74 pipeline.AddGlslClosestHitShader(kRayTracingPayloadMinimalGlsl);
75
76 pipeline.AddBinding(VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 0);
77 pipeline.CreateDescriptorSet();
78 vkt::as::BuildGeometryInfoKHR tlas(vkt::as::blueprint::BuildOnDeviceTopLevel(*m_device, *m_default_queue, m_command_buffer));
79 pipeline.GetDescriptorSet().WriteDescriptorAccelStruct(0, 1, &tlas.GetDstAS()->handle());
80 pipeline.GetDescriptorSet().UpdateDescriptorSets();
81
82 pipeline.Build();
83
84 m_command_buffer.Begin();
85 vk::CmdBindDescriptorSets(m_command_buffer, VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, pipeline.GetPipelineLayout(), 0, 1,
86 &pipeline.GetDescriptorSet().set_, 0, nullptr);
87 vk::CmdBindPipeline(m_command_buffer, VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, pipeline);
88 vkt::rt::TraceRaysSbt trace_rays_sbt = pipeline.GetTraceRaysSbt();
89 vk::CmdTraceRaysKHR(m_command_buffer, &trace_rays_sbt.ray_gen_sbt, &trace_rays_sbt.miss_sbt, &trace_rays_sbt.hit_sbt,
90 &trace_rays_sbt.callable_sbt, 1, 1, 1);
91 m_command_buffer.End();
92 m_errorMonitor->SetDesiredInfo("In Raygen");
93 m_default_queue->SubmitAndWait(m_command_buffer);
94 m_errorMonitor->VerifyFound();
95}
96
97TEST_F(NegativeDebugPrintfRayTracing, RaygenShaderRecord) {
98 TEST_DESCRIPTION("Test debug printf in raygen shader. Use shader records.");

Callers

nothing calls this directly

Calls 15

BuildOnDeviceTopLevelFunction · 0.85
CmdBindDescriptorSetsFunction · 0.85
CmdBindPipelineFunction · 0.85
CmdTraceRaysKHRFunction · 0.85
MakeSetAndBindingMappingFunction · 0.85
CmdFillBufferFunction · 0.85
CheckSlangSupportFunction · 0.85
GetCubesTLASFunction · 0.85
CmdTraceRaysIndirect2KHRFunction · 0.85

Tested by

no test coverage detected