glsl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(p *shaderir.Program, version GLSLVersion, projectionMatrixUniformIndex int) (vertexShader, fragmentShader string)

Compile compiles p into GLSL vertex and fragment shaders.

projectionMatrixUniformIndex is the index of the projection matrix uniform variable, or -1 for no adjustment. While the projection matrix's Y scale is negative, the fragment shader's position, Y derivatives, and facing are adjusted as if the window coordinates started at the top.

func Fragment

func Fragment(p *shaderir.Program, name string, o Options) string

Fragment returns p's fragment entry point as a function named name of GLSL 3.30 and GLSL ES 3.00, for a renderer's fragment shader to call, after the uniforms (U0, U1, ...), the textures (sampler2D T0, T1, ...) and the functions it reaches:

vec4 name(vec4 position, ...varyings)

The position counts its y from the top of the target, as the renderer passes it.

func FragmentPrelude

func FragmentPrelude(version GLSLVersion) string

func UniformLanes

func UniformLanes(p *shaderir.Program) (lanes []int, size int)

UniformLanes returns, for each lane of p's uniforms (in order, columns of matrices, elements of arrays: Type.DwordCount of each), its offset in bytes in the std140 uniform block of Fragment, and the block's size, a multiple of 16: a vector of 3 takes the room of 4, and an array's elements and a matrix's columns are 16 bytes apart at least.

func VertexPrelude

func VertexPrelude(version GLSLVersion) string

Types

type GLSLVersion

type GLSLVersion int
const (
	GLSLVersionDefault GLSLVersion = iota
	GLSLVersionES300
)

type Options

type Options struct {
	// FlipY is a boolean expression of the renderer's, true where GL's
	// window y counts up, as the position's does not, which negates dFdy;
	// "" where it never does.
	FlipY string
	// Block, unless empty, names a uniform block, laid out as std140
	// (UniformLanes says how), whose members the uniforms are.
	Block string
	// FlipRows, unless empty, names a uniform ivec4 that the renderer sets,
	// which gives, for each texture, the height of an image whose rows go
	// up, as GL's framebuffers draw them, or 0: texel reads flip those.
	FlipRows string
}

Options are how Fragment writes a program for a renderer.

Jump to

Keyboard shortcuts

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