Documentation
¶
Index ¶
- Constants
- func Compile(p *shaderir.Program) (vertexShader, pixelShader, vertexPrelude, pixelPrelude string)
- func Fragment(p *shaderir.Program, name string, cbuffer, texture int) string
- func UniformLanes(p *shaderir.Program) (lanes []int, size int)
- func UniformVariableOffsetsInDwords(program *shaderir.Program) []int
- type PipelineSource
- type RegisterBinding
Constants ¶
const UniformVariableBoundaryInDwords = 4
Variables ¶
This section is empty.
Functions ¶
func Fragment ¶
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 ¶
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 ¶
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.