| 35 | } |
| 36 | |
| 37 | spv_result_t ValidateRayQueryPointer(ValidationState_t& _, |
| 38 | const Instruction* inst, |
| 39 | uint32_t ray_query_index) { |
| 40 | const uint32_t ray_query_id = inst->GetOperandAs<uint32_t>(ray_query_index); |
| 41 | auto variable = _.FindDef(ray_query_id); |
| 42 | const auto var_opcode = variable->opcode(); |
| 43 | if (!variable || (var_opcode != spv::Op::OpVariable && |
| 44 | var_opcode != spv::Op::OpFunctionParameter && |
| 45 | var_opcode != spv::Op::OpAccessChain)) { |
| 46 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 47 | << "Ray Query must be a memory object declaration"; |
| 48 | } |
| 49 | auto pointer = _.FindDef(variable->GetOperandAs<uint32_t>(0)); |
| 50 | if (!pointer || pointer->opcode() != spv::Op::OpTypePointer) { |
| 51 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 52 | << "Ray Query must be a pointer"; |
| 53 | } |
| 54 | auto type = _.FindDef(pointer->GetOperandAs<uint32_t>(2)); |
| 55 | if (!type || type->opcode() != spv::Op::OpTypeRayQueryKHR) { |
| 56 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 57 | << "Ray Query must be a pointer to OpTypeRayQueryKHR"; |
| 58 | } |
| 59 | return SPV_SUCCESS; |
| 60 | } |
| 61 | |
| 62 | spv_result_t ValidateIntersectionId(ValidationState_t& _, |
| 63 | const Instruction* inst, |
no test coverage detected