ShaderStorageFormat

Represents the format specification for a shader storage buffer. Defines the structure, primitives, and memory layout for data used in GPU programming.

The ShaderStorageFormat class allows users to describe and organize shader storage elements, compute memory alignments, and manage offsets and paddings accordingly.

The format consists of multiple elements that can be primitives or nested structures, and it ensures that the overall memory layout adheres to GPU alignment and padding requirements.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
val size: Int

The size of the ShaderStorageFormat in bytes

Functions

Link copied to clipboard
fun commit()

Processes and updates the internal format size based on the alignment and size requirements of the elements within the shader storage format. The method ensures that the memory layout complies with the alignment constraints of each element, including primitives and structures, while accounting for array sizes and nested structures.

Link copied to clipboard

Generates a sequence of ShaderStorageElement objects by processing the elements defined in the ShaderStorageFormat. This function delegates the processing of individual elements to the processElements method.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
Link copied to clipboard
fun primitive(name: String, type: BufferPrimitiveType, arraySize: Int = 1)

Adds a primitive element to the shader storage format.

Link copied to clipboard
fun struct(structName: String, name: String, arraySize: Int = 1, builder: ShaderStorageFormat.() -> Unit)

Adds a struct definition to the shader storage format.

Link copied to clipboard
open override fun toString(): String