Added in API level 17
Deprecated in API level 31

ScriptGroup


class ScriptGroup : BaseObj
kotlin.Any
   ↳ android.renderscript.BaseObj
   ↳ android.renderscript.ScriptGroup

A group of kernels that are executed together with one execution call as if they were a single kernel

In addition to kernels, a script group may contain invocable functions as well. A script group may take inputs and generate outputs, which are consumed and produced by its member kernels. Inside a script group, outputs from one kernel can be passed to another kernel as inputs. The API disallows cyclic dependencies among kernels in a script group, effectively making it a directed acyclic graph (DAG) of kernels.

Grouping kernels together allows for more efficient execution. For example, runtime and compiler optimization can be applied to reduce computation and communication overhead, and to make better use of the CPU and the GPU.

Summary

Nested classes

Represents a binding of a value to a global variable in a kernel or invocable function.

Helper class to build a ScriptGroup.

The builder class for creating script groups

An opaque class for closures

An opaque class for futures

An opaque class for script group inputs

Public methods
Unit

Destroy this ScriptGroup and all Closures in it

Unit

Execute the ScriptGroup.

Array<Any!>!
execute(vararg inputs: Any!)

Executes a script group

Unit

Sets an input of the ScriptGroup.

Unit

Sets an output of the ScriptGroup.

Inherited functions

Public methods

destroy

Added in API level 17
fun destroy(): Unit

Deprecated: Deprecated in Java.

Destroy this ScriptGroup and all Closures in it

execute

Added in API level 17
Deprecated in API level 23
fun execute(): Unit

Deprecated: Use #execute instead.

Execute the ScriptGroup. This will run all the kernels in the ScriptGroup. No internal connection results will be visible after execution of the ScriptGroup.

execute

Added in API level 23
Deprecated in API level 31
fun execute(vararg inputs: Any!): Array<Any!>!

Deprecated: Deprecated in Java.

Executes a script group

Parameters
inputs Any!: Values for inputs to the script group, in the order as the inputs are added via Builder2.addInput.
Return
Array<Any!>! Outputs of the script group as an array of objects, in the order as futures are passed to Builder2.create.

setInput

Added in API level 17
Deprecated in API level 23
fun setInput(
    s: Script.KernelID!,
    a: Allocation!
): Unit

Deprecated: Set arguments to execute(java.lang.Object...) instead.

Sets an input of the ScriptGroup. This specifies an Allocation to be used for kernels that require an input Allocation provided from outside of the ScriptGroup.

Parameters
s Script.KernelID!: The ID of the kernel where the allocation should be connected.
a Allocation!: The allocation to connect.

setOutput

Added in API level 17
Deprecated in API level 23
fun setOutput(
    s: Script.KernelID!,
    a: Allocation!
): Unit

Deprecated: Use return value of execute(java.lang.Object...) instead.

Sets an output of the ScriptGroup. This specifies an Allocation to be used for the kernels that require an output Allocation visible after the ScriptGroup is executed.

Parameters
s Script.KernelID!: The ID of the kernel where the allocation should be connected.
a Allocation!: The allocation to connect.