Help us shape the future of Go! Take the 2026 Go Developer Survey

entrypoint

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package entrypoint selects the entry point a backend writes, the meaning of every backend's Options.EntryPoint (backend.EntryPointSelector).

Index

Constants

View Source
const All = -1

All is the index Index returns for a nil selector in an output that holds every entry point.

Variables

This section is empty.

Functions

func Index

func Index(m *ir.Module, sel *backend.EntryPointSelector, single bool) (int, error)

Index returns the index in m.EntryPoints of the entry point sel names, or All when sel is nil. single is set for an output that holds one entry point (GLSL, a DXIL container): there nil is accepted only for a module with exactly one entry point, and Index returns 0. The errors wrap backend.ErrEntryPointNotFound.

A text backend writes the selected entry point but names identifiers over the whole module, as Rust naga does, so the output for one entry point does not depend on which others the module holds.

func Select

func Select(m *ir.Module, sel *backend.EntryPointSelector, single bool) (*ir.Module, error)

Select returns m with only the entry point sel names, or m itself when sel is nil, with Index's rules for single. The copy shares everything with m but its EntryPoints. It suits a backend whose output does not depend on the names of other entry points (DXIL); a text backend uses Index.

Types

type Filter

type Filter struct {
	// Globals[h] is set when the entry point references global h.
	Globals []bool
	// Functions[h] is set when function h is written.
	Functions []bool
}

Filter is what an output holding one entry point writes of the module: the globals that entry point uses and the functions that can serve it. It is Rust naga's SPIR-V writer with PipelineOptions (back/spv/writer.rs write_logical_layout):

  • a global the entry point and its callees never reference is left out;
  • a function that references a global the entry point does not, or that is unavailable in a stage the entry point is available in (Rust's FunctionInfo::available_stages), is left out.

Rust compares global uses as flag sets (read, write, query, atomic); Filter compares whether a global is referenced at all. The two differ only for a function the entry point does not call that uses a global the entry point uses, with more flags: Filter keeps it, Rust leaves it out. The output is valid either way.

func NewFilter

func NewFilter(m *ir.Module, ep int) Filter

NewFilter returns the filter for m.EntryPoints[ep].

Jump to

Keyboard shortcuts

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