Internal change.

PiperOrigin-RevId: 532474319
This commit is contained in:
MediaPipe Team 2023-05-16 08:53:33 -07:00 committed by Copybara-Service
parent e0eef9791e
commit d7fa4b95b5

View File

@ -117,8 +117,8 @@ MtlBufferView MtlBufferView::GetReadView(const Tensor& tensor,
<< "Tensor must be written prior to read from."; << "Tensor must be written prior to read from.";
LOG_IF(FATAL, LOG_IF(FATAL,
!(tensor.valid_ & (Tensor::kValidCpu | Tensor::kValidMetalBuffer))) !(tensor.valid_ & (Tensor::kValidCpu | Tensor::kValidMetalBuffer)))
<< "Tensor conversion between different GPU resources is not supported " << "Tensor conversion between different GPU backing formats is not "
"yet."; "supported yet.";
auto lock(absl::make_unique<absl::MutexLock>(&tensor.view_mutex_)); auto lock(absl::make_unique<absl::MutexLock>(&tensor.view_mutex_));
tensor.valid_ |= Tensor::kValidMetalBuffer; tensor.valid_ |= Tensor::kValidMetalBuffer;
AllocateMtlBuffer(tensor, [command_buffer device]); AllocateMtlBuffer(tensor, [command_buffer device]);
@ -164,8 +164,8 @@ Tensor::OpenGlTexture2dView Tensor::GetOpenGlTexture2dReadView() const {
LOG_IF(FATAL, valid_ == kValidNone) LOG_IF(FATAL, valid_ == kValidNone)
<< "Tensor must be written prior to read from."; << "Tensor must be written prior to read from.";
LOG_IF(FATAL, !(valid_ & (kValidCpu | kValidOpenGlTexture2d))) LOG_IF(FATAL, !(valid_ & (kValidCpu | kValidOpenGlTexture2d)))
<< "Tensor conversion between different GPU resources is not supported " << "Tensor conversion between different GPU backing formats is not "
"yet."; "supported yet.";
auto lock = absl::make_unique<absl::MutexLock>(&view_mutex_); auto lock = absl::make_unique<absl::MutexLock>(&view_mutex_);
AllocateOpenGlTexture2d(); AllocateOpenGlTexture2d();
if (!(valid_ & kValidOpenGlTexture2d)) { if (!(valid_ & kValidOpenGlTexture2d)) {
@ -335,7 +335,8 @@ Tensor::OpenGlBufferView Tensor::GetOpenGlBufferReadView() const {
kValidAHardwareBuffer | kValidAHardwareBuffer |
#endif // MEDIAPIPE_TENSOR_USE_AHWB #endif // MEDIAPIPE_TENSOR_USE_AHWB
kValidOpenGlBuffer))) kValidOpenGlBuffer)))
<< "Tensor conversion between different GPU resources is not supported."; << "Tensor conversion between different GPU backing formats is not "
"supported yet.";
auto lock(absl::make_unique<absl::MutexLock>(&view_mutex_)); auto lock(absl::make_unique<absl::MutexLock>(&view_mutex_));
AllocateOpenGlBuffer(); AllocateOpenGlBuffer();
if (!(valid_ & kValidOpenGlBuffer)) { if (!(valid_ & kValidOpenGlBuffer)) {