Documentation
¶
Overview ¶
Package gles is the OpenGL ES 3.0 renderer. It calls EGL and GLES through purego.
Flutter: Impeller's GLES backend (engine/src/flutter/impeller/renderer/backend/gles).
Index ¶
- func Open(h gpu.SurfaceHandle) (*Context, *Surface, error)
- func ShaderNames() ([]string, error)
- func ShaderSource(name, stage string) (string, error)
- func Software(renderer string) bool
- func X11Visual(display uintptr) (uint32, error)
- type Buffer
- type Caps
- type Context
- func (c *Context) CanSwapWithDamage() bool
- func (c *Context) Clear(r, g, b, a float32)
- func (c *Context) Close()
- func (c *Context) Device() *Device
- func (c *Context) Lost() bool
- func (c *Context) MakeCurrent(s *Surface) error
- func (c *Context) MakeCurrentSurfaceless() error
- func (c *Context) NewSurface(h gpu.SurfaceHandle) (*Surface, error)
- func (c *Context) ReadPixels(width, height int) (*image.RGBA, error)
- func (c *Context) ResizeSurface(s *Surface, width, height int)
- func (c *Context) SwapBuffers(s *Surface) error
- func (c *Context) SwapBuffersWithDamage(s *Surface, height int, rects []image.Rectangle) error
- func (c *Context) Version() string
- func (c *Context) Viewport(width, height int)
- type Device
- func (d *Device) AcquireBuffer(target uint32, size int) (*Buffer, error)
- func (d *Device) AcquireFramebuffer(w, h int, stencil bool) (*Framebuffer, error)
- func (d *Device) AcquireTexture(w, h int, format TextureFormat) (*Texture, error)
- func (d *Device) BindArrayBuffer(b *Buffer)
- func (d *Device) BindFramebuffer(f *Framebuffer)
- func (d *Device) BindTexture(unit int, t *Texture)
- func (d *Device) BindVertexArray(vao uint32)
- func (d *Device) BlendEquation(mode uint32)
- func (d *Device) BlendFunc(srcRGB, dstRGB, srcAlpha, dstAlpha uint32)
- func (d *Device) Caps() Caps
- func (d *Device) ClearColor(r, g, b, a float32)
- func (d *Device) Close()
- func (d *Device) ColorMask(r, g, b, a bool)
- func (d *Device) CompileAll() error
- func (d *Device) CopyFramebuffer(unit int, t *Texture, x, y, w, h int) error
- func (d *Device) EndFrame()
- func (d *Device) GenerateMipmaps(t *Texture)
- func (d *Device) NewProgram(name, vertexSource, fragmentSource string) (*Program, error)
- func (d *Device) Program(name string) (*Program, error)
- func (d *Device) ProgramStats() ProgramStats
- func (d *Device) ReleaseBuffer(b *Buffer)
- func (d *Device) ReleaseFramebuffer(f *Framebuffer)
- func (d *Device) ReleaseTexture(t *Texture)
- func (d *Device) ResetState()
- func (d *Device) SetBlend(on bool)
- func (d *Device) SetProgramCache(c ProgramCache)
- func (d *Device) SetScissor(on bool, x, y, w, h int)
- func (d *Device) SetStencil(on bool)
- func (d *Device) SetTextureParams(t *Texture, minFilter, magFilter, wrapS, wrapT int32)
- func (d *Device) Stats() Stats
- func (d *Device) StencilFunc(fn uint32, ref int32, mask uint32)
- func (d *Device) StencilMask(mask uint32)
- func (d *Device) StencilOp(fail, zfail, zpass uint32)
- func (d *Device) Trim(maxIdle uint64)
- func (d *Device) UploadBuffer(b *Buffer, data []byte) error
- func (d *Device) UploadTexture(t *Texture, x, y, w, h int, pixels []byte) error
- func (d *Device) UseProgram(p *Program)
- func (d *Device) VertexArray(name string, setup func(vao uint32)) uint32
- func (d *Device) Viewport(x, y, w, h int)
- type FrameStats
- type Framebuffer
- type Program
- func (p *Program) Attrib(name string) int32
- func (p *Program) Name() string
- func (p *Program) SetFloat(name string, v float32)
- func (p *Program) SetFloats(name string, values []float32)
- func (p *Program) SetInt(name string, v int32)
- func (p *Program) SetVec2(name string, x, y float32)
- func (p *Program) SetVec4(name string, x, y, z, w float32)
- func (p *Program) SetVec4s(name string, values []float32)
- func (p *Program) Uniform(name string) int32
- type ProgramCache
- type ProgramStats
- type Renderer
- func (r *Renderer) Attach(h gpu.SurfaceHandle) (gpu.Surface, error)
- func (r *Renderer) Close() error
- func (r *Renderer) DeviceName() string
- func (r *Renderer) Invalidate(s gpu.Surface)
- func (r *Renderer) LastFrame() FrameStats
- func (r *Renderer) RasterizeScene(scene *ui.Scene, width, height int) (*ui.Image, error)
- func (r *Renderer) Render(s gpu.Surface, scene *ui.Scene, size ui.Size, dpr float32) error
- func (r *Renderer) RenderCapture(s gpu.Surface, scene *ui.Scene, size ui.Size, dpr float32) (*image.RGBA, error)
- func (r *Renderer) Snapshot(scene *ui.Scene, size ui.Size) (*image.RGBA, error)
- func (r *Renderer) StartupReport() gpu.StartupReport
- type RendererOpts
- type Stats
- type Surface
- type Texture
- type TextureFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
func Open(h gpu.SurfaceHandle) (*Context, *Surface, error)
Open loads EGL and GLES, creates an OpenGL ES 3.0 context on the display of h, creates the first window surface for h, makes it current, and turns vsync off (eglSwapInterval 0: frames are paced by the compositor's frame callbacks, SPEC §8.11). It fails with
- EGLLoadFailed when libEGL or libGLESv2 cannot be loaded
- EGLInitFailed when there is no EGL display or it will not initialize
- EGLNoConfig when no config has RGBA8 and OpenGL ES 3 window surfaces
- GLES3Unsupported when no ES 3.0 context can be created or the driver reports an older GL_VERSION
Close releases everything.
Flutter: no counterpart
func ShaderNames ¶
ShaderNames returns the names of the shader programs in the executable, in alphabetical order: each has a <name>.vert.glsl and a <name>.frag.glsl.
Flutter: no counterpart
func ShaderSource ¶
ShaderSource returns the GLSL source of a stage ("vert" or "frag") of a program. A line of the form //#include "name.glsl" is replaced by the contents of that file of the shaders directory, so that shaders share code.
Flutter: no counterpart
func Software ¶
Software says whether a GL_RENDERER string names a rasterizer that runs on the CPU, such as llvmpipe, which is what OpenGL is in a virtual machine with no GPU. The software renderer of Glutter (package shmwindow) redraws only what changed, while OpenGL on a CPU rasterizes the whole window for every frame, so the engine prefers it there (RendererOpts.RejectSoftware).
Flutter: no counterpart
func X11Visual ¶
X11Visual returns the ID of the X visual that windows must use to be drawn with OpenGL ES through EGL on the Xlib display: the visual of the EGL config that Open chooses. Create the X window with this visual (and a colormap made for it), or eglCreateWindowSurface fails with BadMatch. It fails with
- EGLLoadFailed, EGLInitFailed and EGLNoConfig as Open does
- EGLConfigQueryFailed when the config has no native visual
Flutter: no counterpart
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a GL buffer whose capacity is a power of two, so that buffers of similar sizes are interchangeable. Get one from Device.AcquireBuffer.
Flutter: no counterpart
type Caps ¶
type Caps struct {
// Version, Vendor and Renderer are the GL strings.
Version, Vendor, Renderer string
// MaxTextureSize is the largest width or height of a texture.
MaxTextureSize int
// MaxRenderbufferSize is the largest width or height of a renderbuffer.
MaxRenderbufferSize int
// MaxTextureUnits is the number of texture units a fragment shader can use.
MaxTextureUnits int
// Extensions are the names of the supported extensions.
Extensions map[string]bool
}
Caps are what the driver reports about itself.
Flutter: no counterpart
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is an EGL display with an OpenGL ES 3.0 context, shared by every window surface (SPEC §9.1). Use it only on the UI thread.
Flutter: no counterpart
func (*Context) CanSwapWithDamage ¶
CanSwapWithDamage says whether the display has EGL_KHR_swap_buffers_with_damage (or the EXT extension), so that SwapBuffersWithDamage tells the compositor what changed.
Flutter: no counterpart
func (*Context) Clear ¶
Clear fills the current framebuffer with the color, given as premultiplied components between 0 and 1.
Flutter: no counterpart
func (*Context) Close ¶
func (c *Context) Close()
Close destroys the surfaces, the context and the display. Closing twice does nothing.
Flutter: no counterpart
func (*Context) Device ¶
Device returns the GL device of the context: its programs, pools and state cache.
Flutter: no counterpart
func (*Context) Lost ¶
Lost says that the browser took the context away (WebGL's webglcontextlost): nothing can be drawn until it is restored. It is always false for an EGL context.
Flutter: no counterpart
func (*Context) MakeCurrent ¶
MakeCurrent makes the context current for drawing into s. It fails with EGLMakeCurrentFailed.
Flutter: no counterpart
func (*Context) MakeCurrentSurfaceless ¶
MakeCurrentSurfaceless makes the context current without any surface, for drawing into framebuffer objects only (EGL_KHR_surfaceless_context, which every OpenGL ES 3 driver has). It fails with EGLMakeCurrentSurfacelessFailed.
Flutter: no counterpart
func (*Context) NewSurface ¶
func (c *Context) NewSurface(h gpu.SurfaceHandle) (*Surface, error)
NewSurface creates a window surface for the native window of h. It fails with EGLSurfaceFailed.
Flutter: no counterpart
func (*Context) ReadPixels ¶
ReadPixels reads the width x height pixels at the origin of the current framebuffer, top row first. Read before SwapBuffers: a framebuffer's content is undefined after the swap. It fails with GLReadPixelsFailed.
Flutter: no counterpart
func (*Context) ResizeSurface ¶
ResizeSurface makes the surface width x height pixels when it is not that size already, for a surface that is not resized by its window (the web's canvas, whose pixels are cleared when its size is set, so call it before drawing the frame). EGL surfaces follow their native window, so it does nothing for them.
Flutter: no counterpart
func (*Context) SwapBuffers ¶
SwapBuffers presents the frame drawn into s. On Wayland this is the commit of the wl_surface, so the frame callback must be requested before it. It fails with EGLSwapFailed.
Flutter: no counterpart
func (*Context) SwapBuffersWithDamage ¶
SwapBuffersWithDamage presents the frame drawn into s as SwapBuffers does, and tells the compositor that only the rectangles changed from the frame before it: pixels from the top left of a surface that is height pixels high. The whole frame is drawn in the buffer anyway, so a compositor or driver that ignores the damage shows the same window. Without the extension it is SwapBuffers. It fails with EGLSwapFailed.
Flutter: no counterpart
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device owns the GL objects of the renderer: the shader programs, and pools of buffers, textures and framebuffers that are reused instead of created again. It remembers the GL state it has set, so that setting it again costs nothing. Use it only on the UI thread, with its context current.
Flutter: no counterpart
func (*Device) AcquireBuffer ¶
AcquireBuffer returns a buffer for target (glArrayBuffer or glElementArrayBuffer) of at least size bytes, reusing a free one of the same capacity class if there is one.
Flutter: no counterpart
func (*Device) AcquireFramebuffer ¶
func (d *Device) AcquireFramebuffer(w, h int, stencil bool) (*Framebuffer, error)
AcquireFramebuffer returns an offscreen framebuffer of the size, with a stencil buffer if asked, reusing a free one of the same size. It fails with TextureSizeInvalid for a bad size and FramebufferIncomplete when the driver cannot make it.
Flutter: no counterpart
func (*Device) AcquireTexture ¶
func (d *Device) AcquireTexture(w, h int, format TextureFormat) (*Texture, error)
AcquireTexture returns a texture of the size and format, reusing a free one of the same size and format if there is one. Its contents are undefined. Its sampling is linear with clamping to the edge. It fails with TextureSizeInvalid for a size that is not positive or larger than the driver allows, and GLError when the driver cannot allocate it.
Flutter: no counterpart
func (*Device) BindArrayBuffer ¶
BindArrayBuffer binds a buffer as the source of vertex attributes; nil unbinds.
Flutter: no counterpart
func (*Device) BindFramebuffer ¶
func (d *Device) BindFramebuffer(f *Framebuffer)
BindFramebuffer makes a framebuffer the target of drawing and reading; nil is the window's.
Flutter: no counterpart
func (*Device) BindTexture ¶
BindTexture binds a 2D texture to a texture unit, and makes the unit active.
Flutter: no counterpart
func (*Device) BindVertexArray ¶
BindVertexArray makes a vertex array current; 0 is none.
Flutter: no counterpart
func (*Device) BlendEquation ¶
BlendEquation sets how the source and the destination are combined.
Flutter: no counterpart
func (*Device) BlendFunc ¶
BlendFunc sets the blend factors for color and alpha.
Flutter: no counterpart
func (*Device) ClearColor ¶
ClearColor sets the color that Clear fills with, as premultiplied components.
Flutter: no counterpart
func (*Device) Close ¶
func (d *Device) Close()
Close deletes every GL object the device made that is pooled or a program. Objects still in use by the caller are the caller's to release first. Closing twice does nothing. The context must still be current.
Flutter: no counterpart
func (*Device) CompileAll ¶
CompileAll compiles every shader program now, so that a broken shader shows here and not in the middle of a frame. It fails with ShaderCompileFailed when a shader does not build, and ShaderSourceMissing when the sources are not in the executable.
Flutter: no counterpart
func (*Device) CopyFramebuffer ¶
CopyFramebuffer copies the w x h pixels at x, y (counted from the bottom left) of the bound framebuffer into the corner of the texture where its first row starts, after binding the texture to the unit. The texture must be at least that big and RGBA8.
Flutter: no counterpart
func (*Device) EndFrame ¶
func (d *Device) EndFrame()
EndFrame marks the end of a frame and frees the pooled objects that have not been used for a long time.
Flutter: no counterpart
func (*Device) GenerateMipmaps ¶
GenerateMipmaps builds the mipmap chain of a texture from its level 0.
Flutter: no counterpart
func (*Device) NewProgram ¶
NewProgram compiles and links a program from GLSL ES 3.00 sources. It fails with ShaderCompileFailed, whose metadata has the program, the stage ("vertex shader", "fragment shader" or "link") and the driver's log.
Flutter: no counterpart
func (*Device) Program ¶
Program returns the program of the named shader files, compiling it the first time. It fails with ShaderSourceMissing when there are no such files, and ShaderCompileFailed, with the driver's log in its metadata, when a stage does not compile or the program does not link.
Flutter: no counterpart
func (*Device) ProgramStats ¶
func (d *Device) ProgramStats() ProgramStats
ProgramStats says how the programs made so far were made.
Flutter: no counterpart
func (*Device) ReleaseBuffer ¶
ReleaseBuffer gives a buffer back to the pool; releasing it twice panics with the tag BufferReleased.
Flutter: no counterpart
func (*Device) ReleaseFramebuffer ¶
func (d *Device) ReleaseFramebuffer(f *Framebuffer)
ReleaseFramebuffer gives a framebuffer back to the pool; releasing it twice panics with the tag FramebufferReleased.
Flutter: no counterpart
func (*Device) ReleaseTexture ¶
ReleaseTexture gives a texture back to the pool. Using it afterwards is a programmer error; releasing it twice panics with the tag TextureReleased.
Flutter: no counterpart
func (*Device) ResetState ¶
func (d *Device) ResetState()
ResetState sets the GL state to the starting point again. Call it after code that is not the device has used the GL context.
Flutter: no counterpart
func (*Device) SetProgramCache ¶
func (d *Device) SetProgramCache(c ProgramCache)
SetProgramCache gives the device the cache that its programs are loaded from and stored in. Without one (the default, and always on the web), or when the driver has no program binary formats, every program is compiled.
Flutter: no counterpart
func (*Device) SetScissor ¶
SetScissor turns the scissor test on with a rectangle, or off. The rectangle is in the GL's pixels, from the bottom left.
Flutter: no counterpart
func (*Device) SetTextureParams ¶
SetTextureParams sets the filters and the wrapping of a texture, skipping what is already set. The min filter may be one of the mipmap filters when the texture has mipmaps.
Flutter: no counterpart
func (*Device) StencilMask ¶
StencilMask sets which stencil bits are written.
Flutter: no counterpart
func (*Device) StencilOp ¶
StencilOp sets what happens to the stencil value on each outcome of the tests.
Flutter: no counterpart
func (*Device) Trim ¶
Trim deletes the pooled objects that have been free for more than maxIdle frames; 0 deletes all of them.
Flutter: no counterpart
func (*Device) UploadBuffer ¶
UploadBuffer writes data at the start of the buffer. The old contents are orphaned first, so that the driver need not wait for draws that still read them. It fails with BufferTooSmall when data is longer than the capacity.
Flutter: no counterpart
func (*Device) UploadTexture ¶
UploadTexture writes the w x h pixels at x, y of the texture. The pixels are tightly packed, in the texture's format. It fails with TextureUploadInvalid when the rectangle is outside the texture or the data has the wrong length.
Flutter: no counterpart
func (*Device) VertexArray ¶
VertexArray returns the vertex array of the name, creating it the first time and calling setup with it (bound) to describe its attributes. The device deletes it when it is closed.
Flutter: no counterpart
type FrameStats ¶
type FrameStats struct {
// Commands is the number of drawing commands the frame walked. The commands inside a layer
// whose pixels the raster cache has are not walked (gpu.FlattenOpts.Retained), and the lines of a
// paragraph that lie outside the clip are not expanded into commands, so neither is counted.
Commands int
// Drawn is the number of commands drawn.
Drawn int
// Culled is the number of commands that were left out, counted in Drawn, because they
// lie outside the part of the surface their clip reaches (SPEC §9.1, "Culling").
Culled int
// Skipped is the number of commands left out because the renderer cannot draw
// them yet; only a renderer with SkipUnsupported skips.
Skipped int
// Instances is the number of instanced primitives sent to the GPU (shapes,
// coverage tiles and image rectangles), Vertices the number of vertices, and
// Batches the number of draw calls that drew them.
Instances, Vertices, Batches int
// TilesRasterized, ClipMasksBuilt and ImagesUploaded count the work the frame
// did that an earlier frame's cache could have saved: coverage tiles
// rasterized, clip masks made and images uploaded.
TilesRasterized, ClipMasksBuilt, ImagesUploaded int
// AtlasRequests is the number of times the frame asked the coverage atlas for the tiles of a
// shape; a shape that culling leaves out asks for none.
AtlasRequests int
// CachedLayersDrawn is the number of retained layers drawn from the raster
// cache's textures, and CachedLayersMade the number drawn into them.
CachedLayersDrawn, CachedLayersMade int
// DamagedPixels is the number of pixels the frame told the compositor to
// update, and DamageRects the number of rectangles they were in: the whole
// window and 0 when the frame was presented whole. Both are 0 unless
// RendererOpts.Damage is set and the display can swap with damage.
DamagedPixels, DamageRects int
// Unsupported lists the features that caused skipped commands, once each.
Unsupported []string
}
FrameStats says what the last frame did.
Flutter: no counterpart
type Framebuffer ¶
type Framebuffer struct {
// contains filtered or unexported fields
}
Framebuffer is an offscreen render target: an RGBA8 texture, and optionally a stencil buffer. Get one from Device.AcquireFramebuffer.
Flutter: no counterpart
func (*Framebuffer) Height ¶
func (f *Framebuffer) Height() int
Height is the height in pixels.
Flutter: no counterpart
func (*Framebuffer) ID ¶
func (f *Framebuffer) ID() uint32
ID is the GL name of the framebuffer.
Flutter: no counterpart
func (*Framebuffer) Texture ¶
func (f *Framebuffer) Texture() *Texture
Texture is the color attachment, which can be sampled once drawing is done.
Flutter: no counterpart
func (*Framebuffer) Width ¶
func (f *Framebuffer) Width() int
Width is the width in pixels.
Flutter: no counterpart
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is a linked shader program, with its uniform and attribute locations remembered after the first lookup.
Flutter: no counterpart
func (*Program) Attrib ¶
Attrib returns the location of a vertex attribute, or -1.
Flutter: no counterpart
func (*Program) Name ¶
Name is the name of the program: the name of its shader files.
Flutter: no counterpart
func (*Program) SetInt ¶
SetInt sets an int (or sampler, or bool) uniform. A name the program does not have is ignored, as GL ignores location -1.
Flutter: no counterpart
type ProgramCache ¶
ProgramCache keeps the binaries of linked programs between runs: shadercache.Cache is one. The key says which program on which driver; a value is the format and the bytes the driver gave. A Store that fails is the cache's business (it reports it once); the device goes on.
Flutter: no counterpart
type ProgramStats ¶
type ProgramStats struct {
// Compiled and Loaded are the programs made from source and from a cached binary.
Compiled, Loaded int
// Refused is the binaries that the driver did not accept (the program was then compiled), and Stored the
// binaries given to the cache.
Refused, Stored int
// CompileTime and LoadTime are the time the two took, together.
CompileTime, LoadTime time.Duration
}
ProgramStats says how the shader programs of the device were made: from their sources, or from the binaries of the program cache.
Flutter: no counterpart
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer is the GPU renderer: a gpu.Renderer that draws with OpenGL ES 3.0. This is its skeleton (step 3.1): Render clears the surface to the background color and presents it; the drawing of scenes arrives in steps 3.2 to 3.5.
Flutter: no counterpart (flutter::Rasterizer)
func NewRenderer ¶
func NewRenderer(opts ...RendererOpts) *Renderer
NewRenderer returns a renderer that has no GL context yet: the first Attach creates it. Passing more than one RendererOpts panics with MultipleOptions.
Flutter: no counterpart
func (*Renderer) Attach ¶
Attach starts drawing into the native window of h. The first call opens the GL context (see Open for its failures) and so creates the device; later calls add a surface to the same context. It fails with RendererClosed after Close, and with SoftwareRenderer, with the context closed, when RendererOpts.RejectSoftware is set and GL_RENDERER names a rasterizer on the CPU.
Flutter: no counterpart
func (*Renderer) Close ¶
Close destroys every surface, the device and the context. Closing twice does nothing.
Flutter: no counterpart
func (*Renderer) DeviceName ¶
DeviceName returns GL_RENDERER, the name of the GPU (or of the software rasterizer) that draws, or "" before the first Attach has opened the context.
Flutter: no counterpart
func (*Renderer) Invalidate ¶
Invalidate says that the window of the surface lost its content (it was exposed), so that its next frame reports the whole window as changed.
Flutter: no counterpart
func (*Renderer) LastFrame ¶
func (r *Renderer) LastFrame() FrameStats
LastFrame says what the last call of Render drew and left out.
Flutter: no counterpart
func (*Renderer) RasterizeScene ¶
RasterizeScene draws the scene into a new image of width x height pixels, as Snapshot does: the ui.Rasterizer of the GPU renderer, for Picture.ToImage and Scene.ToImage.
Flutter: no counterpart
func (*Renderer) Render ¶
Render makes the surface current, clears it to the background color, draws the scene over it and presents it. A nil scene is an empty one. It fails with RendererSurfaceInvalid when s is not a surface of this renderer or was destroyed, RendererSizeInvalid when the size is not positive, GLNotImplemented when the scene has something the renderer cannot draw yet (unless SkipUnsupported is set), and the errors of MakeCurrent and SwapBuffers. Nothing is presented when it fails.
Flutter: no counterpart
func (*Renderer) RenderCapture ¶
func (r *Renderer) RenderCapture(s gpu.Surface, scene *ui.Scene, size ui.Size, dpr float32) (*image.RGBA, error)
RenderCapture is Render that also returns the frame it drew, top row first, read back before it was presented (the content of a window is undefined after the swap). It also fails with GLReadPixelsFailed.
Flutter: no counterpart
func (*Renderer) Snapshot ¶
Snapshot draws the scene into a new image of the size, without a window: the work of Picture.ToImage and Scene.ToImage. The scene is drawn over transparent pixels into a pooled framebuffer, which is read back; the pixels are premultiplied, top row first. The context must exist, so a surface has to have been attached at some point; it is made current with one of the live surfaces, or without any. It fails with RendererClosed, RendererNotAttached, RendererSizeInvalid, GLNotImplemented as Render does, and the errors of MakeCurrent, of the framebuffer's pool and of reading the pixels back.
Flutter: no counterpart
func (*Renderer) StartupReport ¶
func (r *Renderer) StartupReport() gpu.StartupReport
StartupReport says how the start went: how long the context took to open and how the shader programs made so far were made.
Flutter: no counterpart
type RendererOpts ¶
type RendererOpts struct {
// Background is the color every frame is cleared to before the scene is drawn.
// The default is opaque white.
Background ui.Color
// HasBackground says that Background was set, so that a transparent black
// background can be asked for.
HasBackground bool
// RasterCacheAfter turns on the raster cache: a layer that a scene retains (it is
// in this many consecutive scenes) is drawn into a texture that later frames draw
// instead of its contents. Zero, the default, keeps nothing. The engine sets 3: the
// layer of a RepaintBoundary that the framework did not repaint for three frames.
RasterCacheAfter int
// Damage makes Render tell the compositor which part of the window changed from
// the frame before it, when the display has EGL_KHR_swap_buffers_with_damage (or
// the EXT extension): the scene is compared with the last one of the window, and
// the frame is still drawn whole. It costs a walk of the scene's layers for each
// frame.
Damage bool
// SkipUnsupported makes Render leave out what the renderer cannot draw yet,
// and count it in LastFrame, instead of failing with GLNotImplemented. The
// development examples use it to show what works.
SkipUnsupported bool
// OnContextRestored is called when the browser gives a lost WebGL context back (the web
// only; an EGL context is never lost), from a goroutine of the browser's event: it must
// hand over to the UI thread and ask for a frame, which draws whole after the renderer made
// its resources again.
OnContextRestored func()
// ProgramCache keeps the binaries of the shader programs between runs (SPEC §9.7); none compiles every
// program of every run. The web has no program binaries and ignores it.
ProgramCache ProgramCache
// RejectSoftware makes the first Attach fail with SoftwareRenderer, after it closes the context,
// when GL_RENDERER names a rasterizer on the CPU (Software): the engine's auto then goes on to the
// software renderer, which redraws only what changed (SPEC §9.6, step 32.3). A renderer that was
// asked for by name does not set it.
RejectSoftware bool
}
RendererOpts are the optional parameters of NewRenderer.
Flutter: no counterpart
type Stats ¶
type Stats struct {
// Live objects: made and not deleted, whether in use or pooled.
Textures, Buffers, Framebuffers, Renderbuffers, Programs int
// Pooled objects: free, waiting to be reused.
FreeTextures, FreeBuffers, FreeFramebuffers int
// StateSkipped is how many state changes (viewport, scissor, blend, color mask,
// stencil, program, texture, framebuffer, vertex array and buffer bindings, clear
// color) were not sent to GL because it had the value already. UniformsSet and
// UniformsSkipped are the same for the uniforms of the programs.
StateSkipped, UniformsSet, UniformsSkipped uint64
}
Stats says how many GL objects the device has, for tests and diagnostics.
Flutter: no counterpart
type Surface ¶
type Surface struct {
// contains filtered or unexported fields
}
Surface is an EGL window surface of a Context.
Flutter: no counterpart
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture is a 2D texture. Get one from Device.AcquireTexture and give it back with Device.ReleaseTexture.
Flutter: no counterpart
func (*Texture) Format ¶
func (t *Texture) Format() TextureFormat
Format is the pixel format.
Flutter: no counterpart
type TextureFormat ¶
type TextureFormat int
TextureFormat is the pixel format of a texture.
Flutter: no counterpart
const ( // TextureFormatUnspecified is the zero value: TextureFormatRGBA8. // // Flutter: no counterpart TextureFormatUnspecified TextureFormat = iota // TextureFormatRGBA8 is 8 bits per channel, premultiplied alpha. // // Flutter: no counterpart TextureFormatRGBA8 // TextureFormatR8 is one 8-bit channel: coverage masks. // // Flutter: no counterpart TextureFormatR8 )
The texture formats.