| 33 | class PositiveGpuAVRayQuery : public GpuAVRayQueryTest {}; |
| 34 | |
| 35 | TEST_F(PositiveGpuAVRayQuery, ComputeBasic) { |
| 36 | TEST_DESCRIPTION("Ray query in a compute shader"); |
| 37 | RETURN_IF_SKIP(InitGpuAVRayQuery()); |
| 38 | |
| 39 | const char* shader_source = R"glsl( |
| 40 | #version 460 |
| 41 | #extension GL_EXT_ray_query : require |
| 42 | |
| 43 | layout(set = 0, binding = 0) uniform accelerationStructureEXT tlas; |
| 44 | |
| 45 | void main() { |
| 46 | rayQueryEXT query; |
| 47 | rayQueryInitializeEXT(query, tlas, gl_RayFlagsTerminateOnFirstHitEXT, 0xff, vec3(0), 0.1, vec3(0,0,1), 1000.0); |
| 48 | rayQueryProceedEXT(query); |
| 49 | } |
| 50 | )glsl"; |
| 51 | |
| 52 | CreateComputePipelineHelper pipeline(*this); |
| 53 | pipeline.cs_ = VkShaderObj(*m_device, shader_source, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_2); |
| 54 | pipeline.dsl_bindings_[0] = {0, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}; |
| 55 | pipeline.CreateComputePipeline(); |
| 56 | |
| 57 | // Add TLAS binding |
| 58 | vkt::as::BuildGeometryInfoKHR tlas = vkt::as::blueprint::BuildOnDeviceTopLevel(*m_device, *m_default_queue, m_command_buffer); |
| 59 | pipeline.descriptor_set_.WriteDescriptorAccelStruct(0, 1, &tlas.GetDstAS()->handle()); |
| 60 | pipeline.descriptor_set_.UpdateDescriptorSets(); |
| 61 | |
| 62 | m_command_buffer.Begin(); |
| 63 | vk::CmdBindPipeline(m_command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline); |
| 64 | vk::CmdBindDescriptorSets(m_command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline.pipeline_layout_, 0, 1, |
| 65 | &pipeline.descriptor_set_.set_, 0, nullptr); |
| 66 | vk::CmdDispatch(m_command_buffer, 1, 1, 1); |
| 67 | m_command_buffer.End(); |
| 68 | |
| 69 | m_default_queue->Submit(m_command_buffer); |
| 70 | m_device->Wait(); |
| 71 | } |
| 72 | |
| 73 | TEST_F(PositiveGpuAVRayQuery, ComputeDynamicTminTmax) { |
| 74 | TEST_DESCRIPTION("Ray query in a compute shader, with dynamically set t_min and t_max"); |
nothing calls this directly
no test coverage detected