Documentation ¶
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
Constants ¶
This section is empty.
Variables ¶
View Source
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.
View Source
var ErrContentLost = errors.New("buffer content lost")
View Source
var ErrDeviceLost = errors.New("GPU device lost")
Functions ¶
Types ¶
type BlendDesc ¶
type BlendDesc struct { Enable bool SrcFactor, DstFactor BlendFactor }
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 BufferBindingShaderStorageRead BufferBindingShaderStorageWrite )
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.
type Direct3D11 ¶
type Direct3D11RenderTarget ¶
type Direct3D11RenderTarget struct { // RenderTarget is a *ID3D11RenderTargetView. RenderTarget unsafe.Pointer }
func (Direct3D11RenderTarget) ImplementsRenderTarget ¶
func (Direct3D11RenderTarget) ImplementsRenderTarget()
type FragmentShader ¶
type FragmentShader interface {
Release()
}
type LoadAction ¶
type LoadAction uint8
const ( LoadActionKeep LoadAction = iota LoadActionClear LoadActionInvalidate )
type LoadDesc ¶
type LoadDesc struct { Action LoadAction ClearColor f32color.RGBA }
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 // use. Shared bool }
type OpenGLRenderTarget ¶
type OpenGLRenderTarget gl.Framebuffer
func (OpenGLRenderTarget) ImplementsRenderTarget ¶
func (OpenGLRenderTarget) ImplementsRenderTarget()
type PipelineDesc ¶
type PipelineDesc struct { VertexShader VertexShader FragmentShader FragmentShader VertexLayout VertexLayout BlendDesc BlendDesc PixelFormat TextureFormat Topology Topology }
type RenderTarget ¶
type RenderTarget interface {
ImplementsRenderTarget()
}
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 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()
Click to show internal directories.
Click to hide internal directories.