Documentation
¶
Overview ¶
Package internal holds helpers shared by the four backend shader emitters (emit/wgsl, emit/glsl, emit/metal, emit/gles). It is importable only by packages under emit/.
The emitters differ in stage scaffolding and surface spelling, but the IR->gputype mapping, the binding-name set, and the ir.Dialect Ref/TypeName/ Call/Sample plumbing are identical (or cleanly parameterizable) across them. This package is where that shared machinery lives so each emitter does not carry its own copy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Resolver ¶
type Resolver struct {
Dialect dialect.Dialect
Uniforms map[string]bool
Attributes map[string]bool
Varyings map[string]bool
Fragment bool
Qualified bool
// SceneSampleFn renders a SceneSample expression. When nil, SceneSample
// falls back to a dummy expression. Each post-emitter sets this.
SceneSampleFn func(name, uv string) string
}
Resolver implements ir.Dialect for one emitter stage by delegating the surface spelling (TypeName/Call/Sample) to a prism dialect.Dialect and resolving references per the backend's reference model:
- Qualified backends (WGSL, Metal) address a uniform as u.x and a stage input as in.x, falling back to a bare name for stage-locals.
- Bare backends (GLSL, GLES) address everything through bare globals, so Ref returns the name unchanged.
The name sets and Fragment flag drive the qualified case and are ignored when Qualified is false.
func NewQualified ¶
NewQualified builds a struct-qualified resolver (WGSL/Metal) for one stage.
func (Resolver) SceneSample ¶
SceneSample renders a post-pass engine scene texture sample.