hlsl

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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

View Source
const UniformVariableBoundaryInDwords = 4

Variables

This section is empty.

Functions

func Compile

func Compile(p *shaderir.Program) (vertexShader, pixelShader, vertexPrelude, pixelPrelude string)

func Fragment

func Fragment(p *shaderir.Program, name string, cbuffer, texture int) string

Fragment returns p's fragment entry point as an HLSL (shader model 5) function named name, for a renderer's pixel shader to call, after the helpers, the uniforms (a cbuffer in register b<cbuffer>, laid out as UniformVariableOffsetsInDwords says), the textures (Texture2D T0, T1, ... in registers t<texture> on) and the functions it reaches:

float4 name(float4 position, ...varyings)

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 cbuffer of Fragment, and the cbuffer's size, a multiple of 16: an array's elements and a matrix's rows start at a register each, and the backend keeps matrices transposed (rows of HLSL are columns of GLSL).

func UniformVariableOffsetsInDwords

func UniformVariableOffsetsInDwords(program *shaderir.Program) []int

UniformVariableOffsetsInDwords returns the offsets of the uniform variables in DWORD units in the HLSL layout.

Types

type PipelineSource

type PipelineSource struct {
	VertexSource  string
	PixelSource   string
	ComputeSource string
	VertexEntry   string
	PixelEntry    string
	ComputeEntry  string
	WorkgroupSize [3]uint32
	Registers     []RegisterBinding
}

PipelineSource holds HLSL Shader Model 5.0 vertex, pixel, and/or compute shader sources and register bindings compiled from a GPU pipeline shaderir.Program.

func CompilePipeline

func CompilePipeline(p *shaderir.Program) (PipelineSource, error)

CompilePipeline emits HLSL SM 5.0 vertex, pixel, and/or compute shaders for a 3D GPU pipeline program.

type RegisterBinding

type RegisterBinding struct {
	Group    uint32
	Binding  uint32
	Kind     shaderir.BindingKind
	Register uint32
}

RegisterBinding records the HLSL register (bN, tN, or sN) assigned to a WGSL @group(G) @binding(B) resource.

Jump to

Keyboard shortcuts

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