Documentation
¶
Overview ¶
Package d3d11 draws scenes with Direct3D 11 into a window through a DXGI flip model swap chain, called through syscall like the rest of the Windows backend (no cgo). Every op of a scene is an instanced quad drawn by a shader of its batch's classes (classes.hlsl) or the general one (shader.hlsl), compiled ahead of time into shaders.go; clips are scissor rectangles, with the innermost rounded clip computed in the shader. The swap chain is the window's, opaque, or with NewComposed shown on it through DirectComposition, with its alpha.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileEffect ¶
CompileEffect compiles the pixel shader of an effect whose shader is src, with the compiler Windows has, as go generate does for code compiled ahead of time.
func EffectSource ¶
EffectSource returns the source of an effect's pixel shader: shader.hlsl with EFFECT defined, the head of effect.hlsl, the effect's shader (see scene.Effect), and the tail, which draws its instances with it (effectps). Effects compile it ahead of time with CompileEffect.
func PrecompileEffect ¶
func PrecompileEffect(src string)
PrecompileEffect starts compiling the pixel shader of an effect whose shader is src, which nothing compiled ahead of time, on a goroutine of its own: the renderers then draw it with that code, waiting for the compilation if it has not finished, rather than each compiling it on its first draw. The code is kept on disk too, for the next launches. Package ui/shader calls it as it compiles a shader, which links the cache into apps that draw shaders only.
Types ¶
type Offscreen ¶ added in v0.1.17
type Offscreen struct {
// contains filtered or unexported fields
}
Offscreen draws scenes into a window that never shows, timing each on the GPU, for measurements (BenchmarkStressFrameGPU).
func NewOffscreen ¶ added in v0.1.17
NewOffscreen returns an Offscreen drawing frames of w×h pixels.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer draws scenes into a window.
func New ¶
New creates a renderer drawing into the window hwnd, on the GPU or, when there is none, with Windows' software rasterizer (WARP). Its frames are opaque: what they leave transparent shows black.
func NewComposed ¶
NewComposed creates a renderer whose frames show on the window hwnd through DirectComposition, premultiplied by their alpha, over what is behind the window's content: in a window without a redirection bitmap (WS_EX_NOREDIRECTIONBITMAP), its system backdrop, as Mica.
func (*Renderer) Composed ¶
Composed reports whether the frames show through DirectComposition, with their alpha (NewComposed).
func (*Renderer) Ready ¶
Ready reports whether a frame following the last one can draw at once, as none waits to present (latency.go); otherwise wake runs, on the main thread, once it has.
func (*Renderer) SetPost ¶
func (r *Renderer) SetPost(post func(func()))
SetPost gives the renderer post, which runs a function on the main thread from any goroutine: a frame drawn while the screen has no room for it presents once it has, through post, rather than block in Present. Without it, frames block.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package device creates Direct3D 11 devices: the device of package d3d11's renderer, and that of the Windows backend, which shows the controls of windows with a material through DirectComposition without the renderer.
|
Package device creates Direct3D 11 devices: the device of package d3d11's renderer, and that of the Windows backend, which shows the controls of windows with a material through DirectComposition without the renderer. |