Divooka Reference

GPU Kernel

7 nodes

On this page 7

Element

Function

The element this evaluation of the kernel computes - its column and row - and the size of the grid it belongs to.

Signature
Element() -> (X: Integer, y: Integer, width: Integer, height: Integer)
int Element(out int y, out int width, out int height)

Returns

XInteger
yInteger
widthInteger
heightInteger
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels

Sample

Function

The value of a field at this element.

Signature
Sample(field: Scalar Field) -> Number
double Sample(ScalarField2D field)

Parameters

nametypedefaultdescription
fieldScalar Field—An input of the kernel: a field the size of the grid.

Returns

ValueNumber
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels

Sample Image

Function

The colour of a picture at this element, each channel from 0 to 1.

Signature
SampleImage(image: Pixel Image) -> Hdr Color Element
HdrColorElement SampleImage(PixelImage image)

Parameters

nametypedefaultdescription
imagePixel Image—An input of the kernel: a picture the size of the grid.

Returns

ColorHdr Color Element
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels

Sample Image Offset

Function

The colour of a picture at an offset from this element, each channel from 0 to 1: (1, 0) is its neighbour on the right, (0, 1) the one below. Past an edge, the nearest pixel on the edge is read.

Signature
SampleImageOffset -> Hdr Color Element
    image: Pixel Image
    offsetX: Integer
    offsetY: Integer
HdrColorElement SampleImageOffset(
    PixelImage image,
    int offsetX,
    int offsetY)

Parameters

nametypedefaultdescription
imagePixel Image—An input of the kernel: a picture the size of the grid.
offsetXInteger—How many columns to the right; negative is to the left.
offsetYInteger—How many rows down; negative is up.

Returns

ColorHdr Color Element
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels

Sample Offset

Function

The value of a field at an offset from this element: (1, 0) is its neighbour on the right, (0, 1) the one below. Past an edge, the nearest element on the edge is read, as though the field went on at its edge's values.

Signature
SampleOffset -> Number
    field: Scalar Field
    offsetX: Integer
    offsetY: Integer
double SampleOffset(
    ScalarField2D field,
    int offsetX,
    int offsetY)

Parameters

nametypedefaultdescription
fieldScalar Field—An input of the kernel: a field the size of the grid.
offsetXInteger—How many columns to the right; negative is to the left.
offsetYInteger—How many rows down; negative is up.

Returns

ValueNumber
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels

Time

Function

The time the kernel is drawn at, in seconds, for a picture that moves: whatever plays the kernel frame by frame gives it the seconds since it started, and a run draws the first moment, 0, so it draws the same picture every time. For a moment of your own choosing in a run, declare a number input and use that instead.

Signature
Time() -> Number
double Time()

Returns

SecondsNumber
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels

UV

Function

The element's position in shader coordinates: centred on the grid, the shorter side spanning -1 to 1, up being up - what the shapes and coordinate nodes take.

Signature
UV() -> Vector 2D
Vector2D UV()

Returns

UVVector 2D
Ships with
Divooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
GPU Kernel
Package
GPU Kernels