| 2731 | } |
| 2732 | |
| 2733 | spv_result_t ValidateBufferPointerEXT(ValidationState_t& _, |
| 2734 | const Instruction* inst) { |
| 2735 | const auto storage_class_ptr = _.FindDef(inst->GetOperandAs<uint32_t>(0)); |
| 2736 | if (storage_class_ptr->opcode() != spv::Op::OpTypeUntypedPointerKHR && |
| 2737 | storage_class_ptr->opcode() != spv::Op::OpTypePointer) { |
| 2738 | return _.diag(SPV_ERROR_INVALID_ID, inst) |
| 2739 | << "OpBufferPointerEXT's Result Type should be " |
| 2740 | << "a pointer type."; |
| 2741 | } else { |
| 2742 | // Buffer operand |
| 2743 | auto buffer = |
| 2744 | _.FindUntypedBaseVariable(_.FindDef(inst->GetOperandAs<uint32_t>(2))); |
| 2745 | if (!_.IsBuiltin(buffer->id(), spv::BuiltIn::ResourceHeapEXT)) { |
| 2746 | return _.diag(SPV_ERROR_INVALID_ID, inst) |
| 2747 | << "OpBufferPointerEXT's buffer must be an untyped pointer" |
| 2748 | << " into a variable declared with the ResourceHeapEXT built-in"; |
| 2749 | } |
| 2750 | } |
| 2751 | return SPV_SUCCESS; |
| 2752 | } |
| 2753 | |
| 2754 | // Returns the number of instruction words taken up by a tensor addressing |
| 2755 | // operands argument and its implied operands. |
no test coverage detected