Documentation
¶
Overview ¶
Package shaders implements the `glutter-gen shaders` subcommand: it compiles the WGSL shaders of the explicit renderer to SPIR-V with naga, and writes the Go file that holds them (D20).
Flutter: no counterpart.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate reads srcDir/shaders/*.wgsl and writes outDir/shaders/*.spv and outDir/shaders_gen.go. The files are the same for the same shaders and the same naga, so a test can generate into a temporary directory and compare.
Types ¶
type Compiler ¶
type Compiler interface {
// Version is naga's version, such as "30.0.1".
Version() (string, error)
// Compile validates the WGSL file and writes its SPIR-V to the second file.
Compile(wgsl, spirv string) error
}
Compiler is naga, or a stand-in for it in tests.
type Module ¶
Module is what the generator reads from a WGSL file.
func Parse ¶
Parse reads the bindings and the entry points of a WGSL module: the declarations `@group(g) @binding(b) var<uniform> x: T;`, `var t: texture_2d<f32>;` and `var s: sampler;`, and the functions marked @vertex or @fragment. An entry point reads a binding when its name is in the body of the entry point or of a function it calls. A binding of another kind (a storage buffer, a texture of another type), a compute entry point, or two declarations of one group and binding, is an error.
type Naga ¶
type Naga struct {
// Path is the command; "naga" when empty.
Path string
}
Naga runs the naga command.