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

package gpu

import "gioui.org/gpu"

Package gpu implements the rendering of Gio drawing operations. It is used by package app and package app/headless and is otherwise not useful except for integrating with external window implementations.

Index

Package Files

backend.go caches.go gpu.go pack.go path.go timer.go

type Backend Uses

type Backend interface {
    BeginFrame()
    EndFrame()
    Caps() Caps
    NewTimer() Timer
    // IsContinuousTime reports whether all timer measurements
    // are valid at the point of call.
    IsTimeContinuous() bool
    NewTexture(minFilter, magFilter TextureFilter) Texture
    DefaultFramebuffer() Framebuffer
    NilTexture() Texture
    NewFramebuffer() Framebuffer
    NewBuffer(typ BufferType) Buffer
    NewProgram(vertexShader, fragmentShader string, attribMap []string) (Program, error)
    SetupVertexArray(slot int, size int, dataType DataType, stride, offset int)

    DepthFunc(f DepthFunc)
    ClearColor(r, g, b, a float32)
    ClearDepth(d float32)
    Clear(buffers BufferAttachments)
    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)
}

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

type BlendFactor Uses

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

type Buffer Uses

type Buffer interface {
    Bind()
    Upload(usage BufferUsage, data []byte)
    Release()
}

type BufferAttachments Uses

type BufferAttachments uint
const (
    BufferAttachmentColor BufferAttachments = 1 << iota
    BufferAttachmentDepth
)

type BufferType Uses

type BufferType uint8
const (
    BufferTypeIndices BufferType = iota
    BufferTypeData
)

type BufferUsage Uses

type BufferUsage uint8
const (
    BufferUsageStaticDraw BufferUsage = iota
)

type Caps Uses

type Caps struct {
    Features       Features
    MaxTextureSize int
}

type DataType Uses

type DataType uint8
const (
    DataTypeFloat DataType = iota
    DataTypeShort
)

type DepthFunc Uses

type DepthFunc uint8
const (
    DepthFuncGreater DepthFunc = iota
)

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 {
    Bind()
    BindTexture(t Texture)
    Invalidate()
    Release()
    IsComplete() error
}

type GPU Uses

type GPU struct {
    // contains filtered or unexported fields
}

func New Uses

func New(ctx Backend) (*GPU, error)

func (*GPU) BeginFrame Uses

func (g *GPU) BeginFrame()

func (*GPU) Collect Uses

func (g *GPU) Collect(viewport image.Point, frameOps *op.Ops)

func (*GPU) EndFrame Uses

func (g *GPU) EndFrame()

func (*GPU) Profile Uses

func (g *GPU) Profile() string

func (*GPU) Release Uses

func (g *GPU) Release()

type Program Uses

type Program interface {
    Bind()
    Release()
    UniformFor(uniform string) Uniform
    Uniform1i(u Uniform, v int)
    Uniform1f(u Uniform, v float32)
    Uniform2f(u Uniform, v0, v1 float32)
    Uniform4f(u Uniform, v0, v1, v2, v3 float32)
}

type Texture Uses

type Texture interface {
    Upload(img *image.RGBA)
    Release()
    Bind(unit int)
    Resize(format TextureFormat, width, height 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 Uniform Uses

type Uniform interface{}

Directories

PathSynopsis
gl

Package gpu imports 15 packages (graph) and is imported by 4 packages. Updated 2020-02-22. Refresh now. Tools for package owners.