Skip to main content

onProcessCpu()

onProcessCpu: ({ framework, frameStartResult, processGpuResult })

Description

onProcessCpu() is called to read results of GPU processing and return usable data. Called with { frameStartResult, processGpuResult }. Data returned by modules in onProcessGpu will be present as processGpu.modulename where the name is given by module.name = "modulename".

ParameterDescription
frameworkThe framework bindings for this module for dispatching events.
frameStartResultThe data that was provided at the beginning of a frame.
processGpuResultData returned by all installed modules during onProcessGpu.

Returns

Any data that you wish to provide to onUpdate should be returned. It will be provided to that method as processCpuResult.modulename

Example

XR8.addCameraPipelineModule({
name: 'mycamerapipelinemodule',
onProcessCpu: ({ frameStartResult, processGpuResult }) => {
const GLctx = frameStartResult.GLctx
const { cameraTexture } = frameStartResult
const { camerapixelarray, mycamerapipelinemodule } = processGpuResult

// Do something interesting with mycamerapipelinemodule.gpuDataA and mycamerapipelinemodule.gpuDataB
...

// These fields will be provided to onUpdate
return {cpuDataA, cpuDataB}
},
})