ComputeLua
Main module for ComputeLua, holds all the functions to manage ComputeBuffers, Dispatchers, threads, and more.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ComputeLua = require(ReplicatedStorage.ComputeLua)
Types
BufferDataType
type
BufferDataType =
Vector2
|
Vector3
|
CFrame
|
Color3
|
UDim
|
UDim2
|
number
|
boolean
|
string
The only data types allowed in buffers, Compute or Variable
ComputeBufferDataType
Type for the data of a ComputeBuffer
VariableBufferDataType
Type for the data of the VariableBuffer
Functions
CreateDispatcher
Parallel UnsafeComputeLua.
CreateDispatcher
(
numWorkers:
number
,
--
How many workers to use, balanced this with performance and speed
) →
Dispatcher
Create a Dispatcher to run a bunch of workers in parallel
CreateComputeBuffer
Parallel UnsafeCreate a ComputeBuffer to store vital information that is then sent to each worker.
GetComputeBufferData
Serial UnsafeComputeLua.
GetComputeBufferData
(
bufferName:
string
--
The name of the buffer.
) →
ComputeBufferDataType
--
The data of the ComputeBuffer
Get the ComputeBuffer data
CreateThread
Serial UnsafeComputeLua.
CreateThread
(
actor:
Actor
,
--
The Actor to bind the thread to, this should be the same actor as the parent of the worker.
threadName:
string
,
--
The unique name of the thread.
callback:
(
dispatchId:
number
,
variableBuffer:
VariableBufferDataType
)
→
(
)
--
The function that will be executed when the thread is called
) →
(
)
Create a thread for the Dispatcher to execute