pipeconst

package
v0.34.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pipeconst checks the pipeline-overridable constants of a pipeline stage (WebGPU GPUProgrammableStage.constants) before any backend sees them.

It is the one check every build path shares: the native backends, -tags rust (wgpu-native) and js/wasm (the browser). It has no dependencies, so the browser build does not link naga for it.

What it checks is what a value can be wrong about without the shader:

  • a key is never empty: webgpu.h refuses a null or empty key string (NonNullInputString), and no WGSL override has an empty identifier;
  • a value is finite: GPUPipelineConstantValue is a WebIDL double, which refuses NaN and the infinities with a TypeError, and webgpu.h reports NonFiniteFloatValueError. This holds for a bool override too, where naga's own conversion would read NaN as false.

Unknown keys, values out of the override's range and overrides without a value or a default need the shader; naga.ProcessOverrides reports them.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyKey is the reason for a constant whose key is "".
	ErrEmptyKey = errors.New("key must not be empty")
	// ErrNotFinite is the reason for a constant whose value is NaN or an
	// infinity.
	ErrNotFinite = errors.New("value must be finite")
)

Functions

func Validate

func Validate(constants map[string]float64) error

Validate returns an *Error for the first invalid constant, keys in sorted order so the same input reports the same key, or nil.

Types

type Error

type Error struct {
	Key   string
	Value float64
	Err   error
}

Error is a pipeline constant that cannot be used. Err is ErrEmptyKey or ErrNotFinite.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns Err, for errors.Is.

Jump to

Keyboard shortcuts

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