Shader

Library for running GPU shaders.


Source: pkg/lua/lib/shader.go | Import: shader

Functions


device

device() -> int<collection.CRATE_SHADER>

Return Values

  • int<collection.CRATE_SHADER>
release

release(device)

After a device is released, it and any associated buffers and kernels cannot be used.

Arguments

  • id int<collection.CRATE_SHADER>
add_program

add_program(device, program)

Arguments

  • id int<collection.CRATE_SHADER>
  • program string
add_program_file

add_program_file(device, path)

Arguments

  • device int<collection.CRATE_SHADER>
  • path string
kernel

kernel(device, name, []globals, []locals) -> int<shader.KERNEL>

Arguments

  • device int<collection.CRATE_SHADER>
  • name string
  • globals []int - List of the global work sizes to use.
  • locals []int - List of the local work sizes to use.
Return Values

  • int<shader.KERNEL>
run

run(device, kernel, buffers...)

Arguments

  • device int<collection.CRATE_SHADER>
  • kernel int<shader.KERNEL>
  • buffers struct<shader.Buffer>...
buffer_image

buffer_image(device, type, width, height) -> struct<shader.BufferImage>

Arguments

  • device int<collection.CRATE_SHADER>
  • type int<shader.ImageType>
  • width int
  • height int
Return Values

  • struct<shader.BufferImage>
buffer_image_ext

buffer_image_ext(device, type, p1, p2) -> struct<shader.BufferImage>

Arguments

  • device int<collection.CRATE_SHADER>
  • type int<shader.ImageType>
  • p1 struct<image.Point>
  • p2 struct<image.Point>
Return Values

  • struct<shader.BufferImage>
buffer_image_ext_xy

buffer_image_ext_xy(device, type, x1, y1, x2, y2) -> struct<shader.BufferImage>

Arguments

  • device int<collection.CRATE_SHADER>
  • type int<shader.ImageType>
  • x1 int
  • y1 int
  • x2 int
  • y2 int
Return Values

  • struct<shader.BufferImage>
buffer_image_from

buffer_image_from(device, id) -> struct<shader.BufferImage>

@blocking
Arguments

  • device int<collection.CRATE_SHADER>
  • id int<collection.IMAGE>
Return Values

  • struct<shader.BufferImage>
buffer_vector

buffer_vector(device, length) -> struct<shader.BufferVector>

Arguments

  • device int<collection.CRATE_SHADER>
  • length int
Return Values

  • struct<shader.BufferVector>
buffer_bytes

buffer_bytes(device, size) -> struct<shader.BufferBytes>

Arguments

  • device int<collection.CRATE_SHADER>
  • size int
Return Values

  • struct<shader.BufferBytes>

Constants


BufferType
  • BUFFER_IMAGE
  • BUFFER_VECTOR
  • BUFFER_BYTES
ImageType
  • IMAGE_RGBA
  • IMAGE_GRAY
ID
  • KERNEL

Structs


BufferImage

Properties

  • type int<shader.BufferType>
  • device int<collection.CRATE_SHADER>
  • id int
Methods

bounds

bounds() -> int, int

copy

copy(self, int<collection.IMAGE>) -> self

data

data(name string, int<image.Encoding>) -> int<collection.IMAGE>

data_into

data_into(self, int<collection.IMAGE>) -> self

BufferVector

Properties

  • type int<shader.BufferType>
  • device int<collection.CRATE_SHADER>
  • id int
Methods

copy

copy(self, []float) -> self

data

data() -> []float

length

length() -> int

BufferBytes

Properties

  • type int<shader.BufferType>
  • device int<collection.CRATE_SHADER>
  • id int
Methods

copy

copy(self, []int) -> self

data

data() -> []int

size

size() -> int

Interfaces


Buffer

Properties

  • type int<shader.BufferType>
  • device int<collection.CRATE_SHADER>
  • id int