| 22 | class NegativeGpuAVRayHitObject : public GpuAVRayHitObjectTest {}; |
| 23 | |
| 24 | TEST_F(NegativeGpuAVRayHitObject, NegativeTmin) { |
| 25 | TEST_DESCRIPTION("hitObjectTraceRayEXT with negative tmin"); |
| 26 | RETURN_IF_SKIP(InitHitObjectTest()); |
| 27 | |
| 28 | vkt::rt::Pipeline pipeline(*this, m_device); |
| 29 | |
| 30 | const char* ray_gen = R"glsl( |
| 31 | #version 460 |
| 32 | #extension GL_EXT_ray_tracing : require |
| 33 | #extension GL_EXT_shader_invocation_reorder : require |
| 34 | layout(binding = 0, set = 0) uniform accelerationStructureEXT tlas; |
| 35 | layout(binding = 1, set = 0) uniform Params { float tmin; } params; |
| 36 | layout(location = 0) rayPayloadEXT vec3 payload; |
| 37 | layout(location = 0) hitObjectAttributeEXT vec2 attr; |
| 38 | |
| 39 | void main() { |
| 40 | hitObjectEXT hObj; |
| 41 | hitObjectTraceRayEXT(hObj, tlas, gl_RayFlagsOpaqueEXT, 0xff, 0, 0, 0, |
| 42 | vec3(0,0,0), params.tmin, vec3(0,0,1), 100.0, 0); |
| 43 | } |
| 44 | )glsl"; |
| 45 | pipeline.SetGlslRayGenShader(ray_gen); |
| 46 | pipeline.AddGlslMissShader(kRayTracingPayloadMinimalGlsl); |
| 47 | pipeline.AddGlslClosestHitShader(kRayTracingPayloadMinimalGlsl); |
| 48 | |
| 49 | pipeline.AddBinding(VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 0); |
| 50 | pipeline.AddBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1); |
| 51 | pipeline.CreateDescriptorSet(); |
| 52 | |
| 53 | vkt::as::BuildGeometryInfoKHR tlas(vkt::as::blueprint::BuildOnDeviceTopLevel(*m_device, *m_default_queue, m_command_buffer)); |
| 54 | pipeline.GetDescriptorSet().WriteDescriptorAccelStruct(0, 1, &tlas.GetDstAS()->handle()); |
| 55 | |
| 56 | vkt::Buffer uniform_buffer(*m_device, 4096, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, kHostVisibleMemProps); |
| 57 | auto* ptr = static_cast<float*>(uniform_buffer.Memory().Map()); |
| 58 | ptr[0] = -1.0f; // negative tmin |
| 59 | pipeline.GetDescriptorSet().WriteDescriptorBufferInfo(1, uniform_buffer, 0, VK_WHOLE_SIZE); |
| 60 | pipeline.GetDescriptorSet().UpdateDescriptorSets(); |
| 61 | |
| 62 | pipeline.Build(); |
| 63 | |
| 64 | m_command_buffer.Begin(); |
| 65 | vk::CmdBindDescriptorSets(m_command_buffer, VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, pipeline.GetPipelineLayout(), 0, 1, |
| 66 | &pipeline.GetDescriptorSet().set_, 0, nullptr); |
| 67 | vk::CmdBindPipeline(m_command_buffer, VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, pipeline); |
| 68 | vkt::rt::TraceRaysSbt trace_rays_sbt = pipeline.GetTraceRaysSbt(); |
| 69 | vk::CmdTraceRaysKHR(m_command_buffer, &trace_rays_sbt.ray_gen_sbt, &trace_rays_sbt.miss_sbt, &trace_rays_sbt.hit_sbt, |
| 70 | &trace_rays_sbt.callable_sbt, 1, 1, 1); |
| 71 | m_command_buffer.End(); |
| 72 | |
| 73 | m_errorMonitor->SetDesiredError("VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11879"); |
| 74 | m_default_queue->Submit(m_command_buffer); |
| 75 | m_device->Wait(); |
| 76 | m_errorMonitor->VerifyFound(); |
| 77 | } |
| 78 | |
| 79 | TEST_F(NegativeGpuAVRayHitObject, TmaxLessThanTmin) { |
| 80 | TEST_DESCRIPTION("hitObjectTraceRayEXT with tmax < tmin"); |
nothing calls this directly
no test coverage detected