util

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineUniformBlockSize

func DetermineUniformBlockSize(api render.API, blockSize int) int

DetermineUniformBlockSize returns the size of the uniform block in case multiple ones need to be aligned inside a buffer.

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 int) 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  int
	Size    int
}

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

type UniformType interface {
	Std140Plot(plotter *blob.Plotter)
	Std140Size() int
}

UniformType represents a type that can be written to a uniform buffer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL