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 ¶
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).
const QuadInstanceStride = 144
QuadInstanceStride is the size in bytes of shaders.Instance: one element of the per-instance vertex buffer.
Variables ¶
var QuadGLSLFragment string
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).
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).
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.
var QuadMSL string
QuadMSL is the Metal source of the quad shader (entry points vs_main and fs_main).
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 ¶
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>.