package driver
import "gioui.org/gpu/internal/driver"
Index ¶
- Variables
- func DownloadImage(d Device, t Texture, img *image.RGBA) error
- func UploadImage(t Texture, offset image.Point, img *image.RGBA)
- type API
- type BlendDesc
- type BlendFactor
- type Buffer
- type BufferBinding
- type Caps
- type Device
- type Direct3D11
- type Direct3D11RenderTarget
- type Features
- type FragmentShader
- type InputDesc
- type LoadAction
- type LoadDesc
- type Metal
- type MetalRenderTarget
- type OpenGL
- type OpenGLRenderTarget
- type Pipeline
- type PipelineDesc
- type Program
- type RenderTarget
- type Texture
- type TextureFilter
- type TextureFormat
- type Timer
- type Topology
- type VertexLayout
- type VertexShader
- type Vulkan
- type VulkanRenderTarget
Variables ¶
var ( NewOpenGLDevice func(api OpenGL) (Device, error) NewDirect3D11Device func(api Direct3D11) (Device, error) NewMetalDevice func(api Metal) (Device, error) NewVulkanDevice func(api Vulkan) (Device, error) )
API specific device constructors.
Functions ¶
func DownloadImage ¶
func UploadImage ¶
Types ¶
type API ¶
type API interface {
// contains filtered or unexported methods
}
type BlendDesc ¶
type BlendDesc struct { Enable bool SrcFactor, DstFactor BlendFactor }
type BlendFactor ¶
type BlendFactor uint8
const ( BlendFactorOne BlendFactor = iota BlendFactorOneMinusSrcAlpha BlendFactorZero BlendFactorDstColor )
type Buffer ¶
type BufferBinding ¶
type BufferBinding uint8
const ( BufferBindingIndices BufferBinding = 1 << iota BufferBindingVertices BufferBindingUniforms BufferBindingTexture BufferBindingFramebuffer BufferBindingShaderStorageRead BufferBindingShaderStorageWrite )
type Caps ¶
type Caps struct { // BottomLeftOrigin is true if the driver has the origin in the lower left // corner. The OpenGL driver returns true. BottomLeftOrigin bool Features Features MaxTextureSize int }
type Device ¶
type Device interface { BeginFrame(target RenderTarget, clear bool, viewport image.Point) Texture 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) NewImmutableBuffer(typ BufferBinding, data []byte) (Buffer, error) NewBuffer(typ BufferBinding, size int) (Buffer, error) NewComputeProgram(shader shader.Sources) (Program, error) NewVertexShader(src shader.Sources) (VertexShader, error) NewFragmentShader(src shader.Sources) (FragmentShader, error) NewPipeline(desc PipelineDesc) (Pipeline, error) Viewport(x, y, width, height int) DrawArrays(off, count int) DrawElements(off, count int) BeginRenderPass(t Texture, desc LoadDesc) EndRenderPass() PrepareTexture(t Texture) BindProgram(p Program) BindPipeline(p Pipeline) BindTexture(unit int, t Texture) BindVertexBuffer(b Buffer, offset int) BindIndexBuffer(b Buffer) BindImageTexture(unit int, texture Texture) BindUniforms(buf Buffer) BindStorageBuffer(binding int, buf Buffer) BeginCompute() EndCompute() CopyTexture(dst Texture, dstOrigin image.Point, src Texture, srcRect image.Rectangle) DispatchCompute(x, y, z int) Release() }
Device represents the abstraction of underlying GPU APIs such as OpenGL, Direct3D useful for rendering Gio operations.
func NewDevice ¶
NewDevice creates a new Device given the api.
Note that the device does not assume ownership of the resources contained in api; the caller must ensure the resources are valid until the device is released.
type Direct3D11 ¶
type Direct3D11RenderTarget ¶
type Direct3D11RenderTarget struct { // RenderTarget is a *ID3D11RenderTargetView. RenderTarget unsafe.Pointer }
func (Direct3D11RenderTarget) ImplementsRenderTarget ¶
func (Direct3D11RenderTarget) ImplementsRenderTarget()
type Features ¶
type Features uint
func (Features) Has ¶
type FragmentShader ¶
type FragmentShader interface {
Release()
}
type InputDesc ¶
InputDesc describes a vertex attribute as laid out in a Buffer.
type LoadAction ¶
type LoadAction uint8
const ( LoadActionKeep LoadAction = iota LoadActionClear LoadActionInvalidate )
type LoadDesc ¶
type LoadDesc struct { Action LoadAction ClearColor f32color.RGBA }
type Metal ¶
type Metal struct { // Device is an MTLDevice. Device uintptr // Queue is a MTLCommandQueue. Queue uintptr // PixelFormat is the MTLPixelFormat of the default framebuffer. PixelFormat int }
type MetalRenderTarget ¶
type MetalRenderTarget struct { // Texture is a MTLTexture. Texture uintptr }
func (MetalRenderTarget) ImplementsRenderTarget ¶
func (MetalRenderTarget) ImplementsRenderTarget()
type OpenGL ¶
type OpenGL struct { // ES forces the use of ANGLE OpenGL ES libraries on macOS. It is // ignored on all other platforms. ES bool // Context contains the WebGL context for WebAssembly platforms. It is // empty for all other platforms; an OpenGL context is assumed current when // calling NewDevice. Context gl.Context // Shared instructs users of the context to restore the GL state after // use. bool }
type OpenGLRenderTarget ¶
type OpenGLRenderTarget gl.Framebuffer
func (OpenGLRenderTarget) ImplementsRenderTarget ¶
func (OpenGLRenderTarget) ImplementsRenderTarget()
type Pipeline ¶
type Pipeline interface {
Release()
}
type PipelineDesc ¶
type PipelineDesc struct { VertexShader VertexShader FragmentShader FragmentShader VertexLayout VertexLayout BlendDesc BlendDesc PixelFormat TextureFormat Topology Topology }
type Program ¶
type Program interface {
Release()
}
type RenderTarget ¶
type RenderTarget interface {
ImplementsRenderTarget()
}
type Texture ¶
type Texture interface { RenderTarget Upload(offset, size image.Point, pixels []byte, stride int) ReadPixels(src image.Rectangle, pixels []byte, stride int) error Release() }
type TextureFilter ¶
type TextureFilter uint8
const ( FilterNearest TextureFilter = iota FilterLinear FilterLinearMipmapLinear )
type TextureFormat ¶
type TextureFormat uint8
const ( TextureFormatSRGBA TextureFormat = iota TextureFormatFloat TextureFormatRGBA8 // TextureFormatOutput denotes the format used by the output framebuffer. TextureFormatOutput )
type Timer ¶
type Topology ¶
type Topology uint8
type VertexLayout ¶
type VertexShader ¶
type VertexShader interface {
Release()
}
type Vulkan ¶
type Vulkan struct { // PhysDevice is a VkPhysicalDevice. PhysDevice unsafe.Pointer // Device is a VkDevice. Device unsafe.Pointer // QueueFamily is the queue familily index of the queue. QueueFamily int // QueueIndex is the logical queue index of the queue. QueueIndex int // Format is a VkFormat that matches render targets. Format int }
type VulkanRenderTarget ¶
type VulkanRenderTarget struct { // WaitSem is a VkSemaphore that must signaled before accessing Framebuffer. WaitSem uint64 // SignalSem is a VkSemaphore that signal access to Framebuffer is complete. SignalSem uint64 // Fence is a VkFence that is set when all commands to Framebuffer has completed. Fence uint64 // Image is the VkImage to render into. Image uint64 // Framebuffer is a VkFramebuffer for Image. Framebuffer uint64 }
func (VulkanRenderTarget) ImplementsRenderTarget ¶
func (VulkanRenderTarget) ImplementsRenderTarget()
Source Files ¶
api.go driver.go
- Version
- v0.8.0 (latest)
- Published
- Jan 14, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 9 hours ago –
Tools for package owners.