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) )
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
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()
}
type Direct3D11 ¶
type Direct3D11RenderTarget ¶
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 uintptr
}
func (MetalRenderTarget) ImplementsRenderTarget ¶
func (MetalRenderTarget) ImplementsRenderTarget()
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 )
type VertexLayout ¶
type VertexShader ¶
type VertexShader interface {
Release()
}
type VulkanRenderTarget ¶
type VulkanRenderTarget struct {
WaitSem uint64
SignalSem uint64
Fence uint64
Image uint64
Framebuffer uint64
}
func (VulkanRenderTarget) ImplementsRenderTarget ¶
func (VulkanRenderTarget) ImplementsRenderTarget()
Click to show internal directories.
Click to hide internal directories.