gioui.org: gioui.org/gpu/backend Index | Files

package backend

import "gioui.org/gpu/backend"

Index

Package Files

backend.go

type BlendFactor Uses

type BlendFactor uint8
const (
    BlendFactorOne BlendFactor = iota
    BlendFactorOneMinusSrcAlpha
    BlendFactorZero
    BlendFactorDstColor
)

type Buffer Uses

type Buffer interface {
    Release()
    Upload(data []byte)
}

type BufferBinding Uses

type BufferBinding uint8
const (
    BufferBindingIndices BufferBinding = 1 << iota
    BufferBindingVertices
    BufferBindingUniforms
    BufferBindingTexture
    BufferBindingFramebuffer
)

type Caps Uses

type Caps struct {
    Features       Features
    MaxTextureSize int
}

type DataType Uses

type DataType uint8
const (
    DataTypeFloat DataType = iota
    DataTypeInt
    DataTypeShort
)

type DepthFunc Uses

type DepthFunc uint8
const (
    DepthFuncGreater DepthFunc = iota
    DepthFuncGreaterEqual
)

type Device Uses

type Device interface {
    BeginFrame()
    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)
    CurrentFramebuffer() Framebuffer
    NewFramebuffer(tex Texture, depthBits int) (Framebuffer, error)
    NewImmutableBuffer(typ BufferBinding, data []byte) (Buffer, error)
    NewBuffer(typ BufferBinding, size int) (Buffer, 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)
}

Device represents the abstraction of underlying GPU APIs such as OpenGL, Direct3D useful for rendering Gio operations.

type DrawMode Uses

type DrawMode uint8
const (
    DrawModeTriangleStrip DrawMode = iota
    DrawModeTriangles
)

type Features Uses

type Features uint
const (
    FeatureTimers Features = iota
)

func (Features) Has Uses

func (f Features) Has(feats Features) bool

type Framebuffer Uses

type Framebuffer interface {
    Invalidate()
    Release()
    ReadPixels(src image.Rectangle, pixels []byte) error
}

type InputDesc Uses

type InputDesc struct {
    Type DataType
    Size int

    Offset int
}

InputDesc describes a vertex attribute as laid out in a Buffer.

type InputLayout Uses

type InputLayout interface {
    Release()
}

InputLayout is the backend specific representation of the mapping between Buffers and shader attributes.

type InputLocation Uses

type InputLocation struct {
    // For GLSL.
    Name     string
    Location int
    // For HLSL.
    Semantic      string
    SemanticIndex int

    Type DataType
    Size int
}

type Program Uses

type Program interface {
    Release()
    SetVertexUniforms(buf Buffer)
    SetFragmentUniforms(buf Buffer)
}

type ShaderSources Uses

type ShaderSources struct {
    GLSL100ES string
    GLSL300ES string
    GLSL130   string
    GLSL150   string
    HLSL      []byte
    Uniforms  UniformsReflection
    Inputs    []InputLocation
    Textures  []TextureBinding
}

type Texture Uses

type Texture interface {
    Upload(img *image.RGBA)
    Release()
}

type TextureBinding Uses

type TextureBinding struct {
    Name    string
    Binding int
}

type TextureFilter Uses

type TextureFilter uint8
const (
    FilterNearest TextureFilter = iota
    FilterLinear
)

type TextureFormat Uses

type TextureFormat uint8
const (
    TextureFormatSRGB TextureFormat = iota
    TextureFormatFloat
)

type Timer Uses

type Timer interface {
    Begin()
    End()
    Duration() (time.Duration, bool)
    Release()
}

type UniformBlock Uses

type UniformBlock struct {
    Name    string
    Binding int
}

type UniformLocation Uses

type UniformLocation struct {
    Name   string
    Type   DataType
    Size   int
    Offset int
}

type UniformsReflection Uses

type UniformsReflection struct {
    Blocks    []UniformBlock
    Locations []UniformLocation
    Size      int
}

Package backend imports 2 packages (graph) and is imported by 12 packages. Updated 2020-09-29. Refresh now. Tools for package owners.