Documentation
¶
Index ¶
- Variables
- func DownloadImage(d Device, f Framebuffer, r image.Rectangle) (*image.RGBA, error)
- func UploadImage(t Texture, offset image.Point, img *image.RGBA)
- type API
- type AccessBits
- type BlendFactor
- type Buffer
- type BufferBinding
- type Caps
- type DataType
- type DepthFunc
- type Device
- type Direct3D11
- type DrawMode
- type Features
- type Framebuffer
- type InputDesc
- type InputLayout
- type InputLocation
- type OpenGL
- type Program
- type ShaderSources
- type Texture
- type TextureBinding
- type TextureFilter
- type TextureFormat
- type Timer
- type UniformBlock
- type UniformLocation
- type UniformsReflection
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NewOpenGLDevice func(api OpenGL) (Device, error) NewDirect3D11Device func(api Direct3D11) (Device, error) )
API specific device constructors.
View Source
var ErrContentLost = errors.New("buffer content lost")
Functions ¶
func DownloadImage ¶
Types ¶
type BlendFactor ¶
type BlendFactor uint8
const ( BlendFactorOne BlendFactor = iota BlendFactorOneMinusSrcAlpha BlendFactorZero BlendFactorDstColor )
type BufferBinding ¶
type BufferBinding uint8
const ( BufferBindingIndices BufferBinding = 1 << iota BufferBindingVertices BufferBindingUniforms BufferBindingTexture BufferBindingFramebuffer BufferBindingShaderStorage )
type Device ¶
type Device interface {
BeginFrame() Framebuffer
EndFrame()
Caps() Caps
NewTimer() Timer
// IsContinuousTime reports whether all timer measurements
// are valid at the point of call.
IsTimeContinuous() bool
NewTexture(format TextureFormat, width, height int, minFilter, magFilter TextureFilter, bindings BufferBinding) (Texture, error)
NewFramebuffer(tex Texture, depthBits int) (Framebuffer, error)
NewImmutableBuffer(typ BufferBinding, data []byte) (Buffer, error)
NewBuffer(typ BufferBinding, size int) (Buffer, error)
NewComputeProgram(shader ShaderSources) (Program, error)
NewProgram(vertexShader, fragmentShader ShaderSources) (Program, error)
NewInputLayout(vertexShader ShaderSources, layout []InputDesc) (InputLayout, error)
DepthFunc(f DepthFunc)
ClearDepth(d float32)
Clear(r, g, b, a float32)
Viewport(x, y, width, height int)
DrawArrays(mode DrawMode, off, count int)
DrawElements(mode DrawMode, off, count int)
SetBlend(enable bool)
SetDepthTest(enable bool)
DepthMask(mask bool)
BlendFunc(sfactor, dfactor BlendFactor)
BindInputLayout(i InputLayout)
BindProgram(p Program)
BindFramebuffer(f Framebuffer)
BindTexture(unit int, t Texture)
BindVertexBuffer(b Buffer, stride, offset int)
BindIndexBuffer(b Buffer)
BindImageTexture(unit int, texture Texture, access AccessBits, format TextureFormat)
MemoryBarrier()
DispatchCompute(x, y, z int)
Release()
}
Device represents the abstraction of underlying GPU APIs such as OpenGL, Direct3D useful for rendering Gio operations.
type Direct3D11 ¶
type Framebuffer ¶
type InputLayout ¶
type InputLayout interface {
Release()
}
InputLayout is the driver specific representation of the mapping between Buffers and shader attributes.
type InputLocation ¶
type ShaderSources ¶
type ShaderSources struct {
Name string
GLSL100ES string
GLSL300ES string
GLSL310ES string
GLSL130 string
GLSL150 string
HLSL string
Uniforms UniformsReflection
Inputs []InputLocation
Textures []TextureBinding
}
type TextureBinding ¶
type TextureFilter ¶
type TextureFilter uint8
const ( FilterNearest TextureFilter = iota FilterLinear )
type TextureFormat ¶
type TextureFormat uint8
const ( TextureFormatSRGB TextureFormat = iota TextureFormatFloat TextureFormatRGBA8 )
type UniformBlock ¶
type UniformLocation ¶
type UniformsReflection ¶
type UniformsReflection struct {
Blocks []UniformBlock
Locations []UniformLocation
Size int
}
Click to show internal directories.
Click to hide internal directories.