Documentation ¶
Overview ¶
Package ubo provides uniform buffer object utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type UniformBlockBuffer ¶
type UniformBlockBuffer struct {
// contains filtered or unexported fields
}
UniformBlockBuffer represents a shared uniform buffer that can be used for storing multiple uniform block types.
func NewUniformBlockBuffer ¶
func NewUniformBlockBuffer(api render.API, capacity int) *UniformBlockBuffer
NewUniformBlockBuffer creates a new uniform block buffer that can be used to store multiple uniform block types.
NOTE: This does not do automatic resize so the proper capacity needs to be figured out beforehand.
func (*UniformBlockBuffer) Placement ¶
func (b *UniformBlockBuffer) Placement(uniformSize uint32) UniformPlacement
Placement returns a UniformPlacement that can be used to write a uniform of the specified size.
func (*UniformBlockBuffer) Release ¶
func (b *UniformBlockBuffer) Release()
Release releases the resources associated with the uniform block buffer.
func (*UniformBlockBuffer) Reset ¶
func (b *UniformBlockBuffer) Reset()
Reset resets the uniform block buffer so that it can be reused.
func (*UniformBlockBuffer) Upload ¶
func (b *UniformBlockBuffer) Upload()
Upload uploads the data that has been written to the uniform block buffer to the GPU.
type UniformPlacement ¶
type UniformPlacement struct { Buffer render.Buffer Plotter *blob.Plotter Offset uint32 Size uint32 }
UniformPlacement contains information on the positioning of a uniform within a uniform buffer.
func WriteUniform ¶
func WriteUniform[T UniformType](blockBuffer *UniformBlockBuffer, uniform T) UniformPlacement
WriteUniform writes the specified uniform to the specified uniform block buffer. The returned placement can be used to retrieve the uniform's position within the buffer.
type UniformType ¶
UniformType represents a type that can be written to a uniform buffer.