shader

package
v0.0.0-...-8e5a076 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var ErrCompileFailed = errors.New("shader compilation error")

Functions

func Compile

func Compile(assets fs.Filesystem, path string, stage ShaderStage) ([]byte, error)

func LoadOrCompile

func LoadOrCompile(assets fs.Filesystem, path string, stage ShaderStage) ([]byte, error)

func LoadSource

func LoadSource(assets fs.Filesystem, path string, includePaths []string) ([]byte, error)

func Ref

func Ref(name string) *ref

Types

type Bindings

type Bindings map[string]int

func (Bindings) Descriptor

func (d Bindings) Descriptor(name string) (int, bool)

Descriptor returns the index of a descriptor by name, and a bool indicating wheter its valid.

type Details

type Details struct {
	Inputs   map[string]InputDetails
	Bindings map[string]int
	Textures []texture.Slot
}

func ReadDetails

func ReadDetails(assets fs.Filesystem, path string) (*Details, error)

func (*Details) ParseInputs

func (d *Details) ParseInputs() (Inputs, error)

type Input

type Input struct {
	Index int
	Type  types.Type
}

type InputDetails

type InputDetails struct {
	Index int
	Type  string
}

type Inputs

type Inputs map[string]Input

func (Inputs) Input

func (i Inputs) Input(name string) (int, types.Type, bool)

Input returns the index and type of a shader input by name, and a bool indicating wheter its valid.

type Module

type Module interface {
	device.Resource[core1_0.ShaderModule]

	Entrypoint() string
	Stage() ShaderStage
}

func NewModule

func NewModule(device *device.Device, assets fs.Filesystem, path string, stage ShaderStage) Module

type Shader

type Shader struct {
	// contains filtered or unexported fields
}

func New

func New(device *device.Device, assets fs.Filesystem, path string) *Shader

func (*Shader) Descriptor

func (s *Shader) Descriptor(name string) (int, bool)

func (*Shader) Destroy

func (s *Shader) Destroy()

Destroy the shader and its modules.

func (*Shader) Input

func (s *Shader) Input(name string) (int, types.Type, bool)

func (*Shader) Modules

func (s *Shader) Modules() []Module

func (*Shader) Name

func (s *Shader) Name() string

Name returns the file name of the shader

func (*Shader) Textures

func (s *Shader) Textures() []texture.Slot

type ShaderStage

type ShaderStage core1_0.ShaderStageFlags

func (ShaderStage) String

func (s ShaderStage) String() string

Jump to

Keyboard shortcuts

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