gen

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 3 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

Overview

Package gen holds the shader sources generated from internal/render/gpu/shaders. The files are committed so that normal builds need no shader compiler; run go generate ./ui/gpu/gen/ after changing a shader (internal/render/gpu/shaders TestGeneratedUpToDate checks this).

Index

Constants

View Source
const (
	QuadVSEntry = "vs_main"
	QuadPSEntry = "ps_main"

	// Shader model 5.0, for feature level 11_0 and above.
	QuadVSTarget = "vs_5_0"
	QuadPSTarget = "ps_5_0"
	// Shader model 4.0, for feature levels 10_0 and 10_1.
	QuadVSTargetSM4 = "vs_4_0"
	QuadPSTargetSM4 = "ps_4_0"
)

Entry points and compile targets of QuadHLSL, for the Direct3D 11 device. They repeat internal/render/shader/hlsl's VertexEntry, FragmentEntry, VertexTarget, FragmentTarget, VertexTargetSM4 and FragmentTargetSM4 (hand-written here so the device does not link the generator; internal/render/gpu/d3d11's TestProfilesMatchGenerator keeps them equal).

View Source
const QuadInstanceStride = 144

QuadInstanceStride is the size in bytes of shaders.Instance: one element of the per-instance vertex buffer.

Variables

View Source
var QuadGLSLFragment string
View Source
var QuadGLSLVertex string

QuadGLSLVertex and QuadGLSLFragment are the GLSL 330 core sources of the quad shader's vertex and fragment stages (entry point main in each; see internal/render/shader/glsl for the attribute, uniform-block and sampler bindings).

View Source
var QuadHLSL string

QuadHLSL is the HLSL source of the quad shader (shader model 5.0, also SM4-compatible; entry points vs_main and ps_main, compiled as vs_5_0 and ps_5_0, or vs_4_0 and ps_4_0 on a feature level 10_x device).

View Source
var QuadInstanceAttrs = [...]struct {
	Location, Offset int
	Kind             string
	N                int
}{
	{0, 0, "f32", 4},
	{1, 16, "f32", 4},
	{2, 32, "f32", 4},
	{3, 48, "f32", 4},
	{4, 64, "f32", 4},
	{5, 80, "f32", 4},
	{6, 96, "f32", 4},
	{7, 112, "f32", 4},
	{8, 128, "f32", 4},
}

QuadInstanceAttrs are the vertex attributes of shaders.Instance by location: byte offset in the struct, scalar kind ("f32", "i32", "u32") and component count.

View Source
var QuadMSL string

QuadMSL is the Metal source of the quad shader (entry points vs_main and fs_main).

View Source
var QuadTextures = []TextureDesc{
	{Binding: 0, Filter: "nearest"},
	{Binding: 1, Filter: "nearest"},
	{Binding: 2, Filter: "linear"},
	{Binding: 3, Filter: "nearest"},
	{Binding: 4, Filter: "nearest"},
}

QuadTextures are the textures of quad.hlsl by binding.

Functions

This section is empty.

Types

type TextureDesc

type TextureDesc struct {
	Binding int
	Filter  string
}

TextureDesc describes a texture binding of the shader: the Direct3D 11 device binds a clamp-to-edge sampler with this filter ("nearest" or "linear") at register s<Binding> next to the texture at t<Binding>.

Jump to

Keyboard shortcuts

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