| 504 | } |
| 505 | |
| 506 | inline hipError_t ihipGetTextureAlignmentOffset(size_t* offset, const void* devPtr) { |
| 507 | amd::Device* device = hip::getCurrentDevice()->devices()[0]; |
| 508 | const device::Info& info = device->info(); |
| 509 | if (!info.imageSupport_) { |
| 510 | LogPrintfError("Texture not supported on the device %s", info.name_); |
| 511 | return hipErrorNotSupported; |
| 512 | } |
| 513 | |
| 514 | const char* alignedDevPtr = |
| 515 | amd::alignUp(static_cast<const char*>(devPtr), info.imageBaseAddressAlignment_); |
| 516 | const size_t alignedOffset = alignedDevPtr - static_cast<const char*>(devPtr); |
| 517 | |
| 518 | // If the device memory pointer was returned from hipMalloc(), |
| 519 | // the offset is guaranteed to be 0 and NULL may be passed as the offset parameter. |
| 520 | if ((alignedOffset != 0) && (offset == nullptr)) { |
| 521 | LogPrintfError("Texture object not aligned with offset %u", alignedOffset); |
| 522 | return hipErrorInvalidValue; |
| 523 | } |
| 524 | |
| 525 | if (offset != nullptr) { |
| 526 | *offset = alignedOffset; |
| 527 | } |
| 528 | |
| 529 | return hipSuccess; |
| 530 | } |
| 531 | |
| 532 | hipError_t ihipBindTexture(size_t* offset, const textureReference* texref, const void* devPtr, |
| 533 | const hipChannelFormatDesc* desc, size_t size) { |
no test coverage detected