Skip to content

GPU Buffer usage with Tasks system #1076

@arnoldy

Description

@arnoldy

Plugin Version or Commit ID

v0.12.0

Unity Version

2021.3.8

Your Host OS

WIndows 10.

Target Platform

Android, iOS

Description

Hi, @homuler, thank you for your effort developing this plugin.

Is there a way to use GPUBuffer for Android/iOS (GPU) with tasks solutions to avoid copying texture back to CPU? As some mid-grade devices like Motorolla Edge having hard times preprocessing textures, mid-grade iOS devices having a delay in async mode because of async readback is not always finishing on same frame.

I understand its wrong but what i have tried it using gpubuffer ptr to make Image instance to be used in DetectAsync method from yours tasks implementation.

Thank you in advance for any guidance and tips.

Code to Reproduce the issue

Wrong solution i tried )

faceTextureFrame.ReadTextureOnGPU(faceTex);
var glContext = GlContext.GetCurrent(); 
var glTextureBuffer = new GlTextureBuffer(faceTextureFrame.GetTextureName(), faceTextureFrame.width, faceTextureFrame.height,
faceTextureFrame.gpuBufferformat, faceTextureFrame.onDeletion, glContext); 
var gpuBuffer = new GpuBuffer(glTextureBuffer); 
Image im = new Image(gpuBuffer.mpPtr);
_faceRunner.ProcessFrameAsyc(im);

where ProcessFrameAsyc is just a wrapper for DetectAsync

crash log
GLBufferCrashLog.txt

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions