TryDispose() public static method

public static TryDispose ( ComputeBuffer buf ) : void
buf ComputeBuffer
return void
Ejemplo n.º 1
0
        private void ToTensorGPU(RenderTexture texture)
        {
            int width  = texture.width;
            int height = texture.height;

            if (tensorBuffer == null || tensorBuffer.count != width * height)
            {
                DisposeUtil.TryDispose(tensorBuffer);
                tensorBuffer = new ComputeBuffer(width * height, sizeof(float) * 3);
            }
            int kernel = compute.FindKernel("TextureToFloatTensor");

            compute.SetTexture(kernel, InputTexture, texture);
            compute.SetBuffer(kernel, OutputFloatTensor, tensorBuffer);
            compute.SetInt(TextureWidth, width);
            compute.SetInt(TextureHeight, height);

            compute.Dispatch(kernel, width / 8, height / 8, 1);
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     DisposeUtil.TryDispose(fetchTexture);
     DisposeUtil.TryDispose(tensorBuffer);
 }