MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ValidateRayQueryPointer

Function ValidateRayQueryPointer

source/val/validate_ray_query.cpp:37–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37spv_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
62spv_result_t ValidateIntersectionId(ValidationState_t& _,
63 const Instruction* inst,

Callers 1

RayQueryPassFunction · 0.70

Calls 3

FindDefMethod · 0.80
diagMethod · 0.80
opcodeMethod · 0.45

Tested by

no test coverage detected