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

Function ValidateBufferPointerEXT

source/val/validate_memory.cpp:2733–2752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2731}
2732
2733spv_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.

Callers 1

MemoryPassFunction · 0.85

Calls 6

FindDefMethod · 0.80
diagMethod · 0.80
IsBuiltinMethod · 0.80
opcodeMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected