Zero-initialize id<MTLDevice> etc. members in Tensor
PiperOrigin-RevId: 488308585
This commit is contained in:
parent
6610ca72ba
commit
bc6240e989
|
@ -387,7 +387,9 @@ void Tensor::Move(Tensor* src) {
|
|||
src->cpu_buffer_ = nullptr;
|
||||
#if MEDIAPIPE_METAL_ENABLED
|
||||
device_ = src->device_;
|
||||
src->device_ = nil;
|
||||
command_buffer_ = src->command_buffer_;
|
||||
src->command_buffer_ = nil;
|
||||
metal_buffer_ = src->metal_buffer_;
|
||||
src->metal_buffer_ = nil;
|
||||
#endif // MEDIAPIPE_METAL_ENABLED
|
||||
|
@ -431,6 +433,8 @@ void Tensor::Invalidate() {
|
|||
DeallocateVirtualMemory(cpu_buffer_, AlignToPageSize(bytes()));
|
||||
}
|
||||
metal_buffer_ = nil;
|
||||
command_buffer_ = nil;
|
||||
device_ = nil;
|
||||
cpu_buffer_ = nullptr;
|
||||
#if MEDIAPIPE_OPENGL_ES_VERSION >= MEDIAPIPE_OPENGL_ES_30
|
||||
// Don't need to wait for the resource to be deleted bacause if will be
|
||||
|
|
|
@ -384,9 +384,9 @@ class Tensor {
|
|||
mutable void* cpu_buffer_ = nullptr;
|
||||
void AllocateCpuBuffer() const;
|
||||
#if MEDIAPIPE_METAL_ENABLED
|
||||
mutable id<MTLCommandBuffer> command_buffer_;
|
||||
mutable id<MTLDevice> device_;
|
||||
mutable id<MTLBuffer> metal_buffer_;
|
||||
mutable id<MTLCommandBuffer> command_buffer_ = nil;
|
||||
mutable id<MTLDevice> device_ = nil;
|
||||
mutable id<MTLBuffer> metal_buffer_ = nil;
|
||||
void AllocateMtlBuffer(id<MTLDevice> device) const;
|
||||
#endif // MEDIAPIPE_METAL_ENABLED
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user