Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterGraphics(g Graphics)
- func RegisterPlatform(platform Platform)
- func Run(cfg Config) error
- type Application
- func (a *Application) CreateBuffer(descriptor BufferDescriptor) (Buffer, error)
- func (a *Application) CreateCommandEncoder() (CommandEncoder, error)
- func (a *Application) CreateImage(descriptor ImageDescriptor) (Image, error)
- func (a *Application) CreateRenderPipeline(descriptor RenderPipelineDescriptor) (RenderPipeline, error)
- func (a *Application) CreateSampler(descriptor SamplerDescriptor) (Sampler, error)
- func (a *Application) CreateShader(config ShaderConfig) (Shader, error)
- func (a *Application) FrameCount() int
- func (a *Application) SurfaceFormat() Format
- type Buffer
- type BufferDescriptor
- type BufferUsage
- type Color
- type CommandEncoder
- type Config
- type CullMode
- type Format
- type Frame
- type Graphics
- type GraphicsInit
- type Image
- type ImageDescriptor
- type ImageType
- type ImageUsage
- type ImageView
- type LogicalSize
- type MetalSurfaceHandle
- type PhysicalSize
- type Platform
- type PlatformInit
- type RenderPassColorAttachment
- type RenderPassDescriptor
- type RenderPassEncoder
- type RenderPipeline
- type RenderPipelineColorAttachment
- type RenderPipelineDescriptor
- type Sampler
- type SamplerDescriptor
- type Shader
- type ShaderConfig
- type ShaderFunction
- type Surface
- type SurfaceFrame
- type SurfaceHandle
- type SurfaceHandleType
- type VertexAttribute
- type VertexBinding
- type VertexRate
- type VulkanPlatform
- type VulkanSurfaceHandle
- type Win32SurfaceHandle
Constants ¶
View Source
const ( VulkanSurfaceHandleType = "vulkan" MetalSurfaceHandleType = "metal" Win32SurfaceHandleType = "win32" )
Variables ¶
View Source
var ( ErrInvalidDescriptor = errors.New("invalid descriptor") ErrUnexpectedSystemResponse = errors.New("unexpected system response") ErrUnexpectedStatus = errors.New("unexpected status") ErrAlreadyRunning = errors.New("already running") ErrNotMainThread = errors.New("not on main thread") ErrUnsupportedSurfaceHandle = errors.New("unsupported surface handle") ErrIncompatibleSurface = errors.New("incompatible surface") ErrFunctionNotFound = errors.New("function not found") ErrIncompatibleDriver = errors.New("incompatible driver") ErrNoSuitableDevice = errors.New("could not find a suitable device") ErrMissingFeature = errors.New("feature missing") ErrInitializationFailed = errors.New("initialization failed") )
View Source
var ( ErrNoGraphics = errors.New("no graphics registered") ErrNoGraphicsAvailable = errors.New("no graphics available") )
Functions ¶
func RegisterGraphics ¶
func RegisterGraphics(g Graphics)
func RegisterPlatform ¶
func RegisterPlatform(platform Platform)
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func (*Application) CreateBuffer ¶
func (a *Application) CreateBuffer(descriptor BufferDescriptor) (Buffer, error)
func (*Application) CreateCommandEncoder ¶
func (a *Application) CreateCommandEncoder() (CommandEncoder, error)
func (*Application) CreateImage ¶
func (a *Application) CreateImage(descriptor ImageDescriptor) (Image, error)
func (*Application) CreateRenderPipeline ¶
func (a *Application) CreateRenderPipeline(descriptor RenderPipelineDescriptor) (RenderPipeline, error)
func (*Application) CreateSampler ¶
func (a *Application) CreateSampler(descriptor SamplerDescriptor) (Sampler, error)
func (*Application) CreateShader ¶
func (a *Application) CreateShader(config ShaderConfig) (Shader, error)
func (*Application) FrameCount ¶
func (a *Application) FrameCount() int
func (*Application) SurfaceFormat ¶
func (a *Application) SurfaceFormat() Format
type BufferDescriptor ¶
type BufferDescriptor struct { Size int Usage BufferUsage }
type BufferUsage ¶
type BufferUsage int
const ( BufferUsageHostRandomAccess BufferUsage = 1 << iota BufferUsageHostUpload BufferUsagePersistentMap )
type CommandEncoder ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
func (*Frame) BeginRenderPass ¶
func (f *Frame) BeginRenderPass(descriptor RenderPassDescriptor) RenderPassEncoder
func (*Frame) Size ¶
func (f *Frame) Size() LogicalSize
type Graphics ¶
type Graphics interface { Name() string Priority() int Available(plt Platform) bool Init(init GraphicsInit) error CreateSurface(handle SurfaceHandle, size PhysicalSize) (Surface, error) CreateShader(cfg ShaderConfig) (Shader, error) CreateRenderPipeline(descriptor RenderPipelineDescriptor) (RenderPipeline, error) CreateImage(descriptor ImageDescriptor) (Image, error) CreateBuffer(descriptor BufferDescriptor) (Buffer, error) CreateCommandEncoder() (CommandEncoder, error) CreateSampler(descriptor SamplerDescriptor) (Sampler, error) }
type GraphicsInit ¶
type ImageDescriptor ¶
type ImageUsage ¶
type ImageUsage int
const ( ImageUsageAttachment ImageUsage = 1 << iota ImageUsageSampled ImageUsageCopySrc ImageUsageCopyDst )
type LogicalSize ¶
func (LogicalSize) PhysicalSize ¶
func (l LogicalSize) PhysicalSize() PhysicalSize
type MetalSurfaceHandle ¶
type MetalSurfaceHandle interface { SurfaceHandle MetalLayer() unsafe.Pointer }
type PhysicalSize ¶
type Platform ¶
type Platform interface { Name() string Priority() int Available() bool Run(init PlatformInit) error PrimarySurface() SurfaceHandle }
type PlatformInit ¶
type RenderPassDescriptor ¶
type RenderPassDescriptor struct {
ColorAttachments []RenderPassColorAttachment
}
type RenderPassEncoder ¶
type RenderPassEncoder interface { SetRenderPipeline(pipeline RenderPipeline) SetVertexBuffer(binding int, buffer Buffer, offset int) SetIndexBuffer(buffer Buffer, offset int) SetPushConstants(offset int, size int, data unsafe.Pointer) Draw(start int, count int) DrawIndexed(start int, count int, vertexOffset int) End() }
type RenderPipeline ¶
type RenderPipeline interface{}
type RenderPipelineColorAttachment ¶
type RenderPipelineColorAttachment struct {
Format Format
}
type RenderPipelineDescriptor ¶
type RenderPipelineDescriptor struct { VertexFunction ShaderFunction VertexBindings []VertexBinding FragmentFunction ShaderFunction ColorAttachments []RenderPipelineColorAttachment CullMode CullMode FrontFaceClockwise bool }
type SamplerDescriptor ¶
type SamplerDescriptor struct { }
type Shader ¶
type Shader interface {
Function(name string) (ShaderFunction, error)
}
type ShaderConfig ¶
type ShaderConfig struct {
SPIRV []byte
}
type ShaderFunction ¶
type ShaderFunction interface{}
type Surface ¶
type Surface interface { Resize(size PhysicalSize) error Acquire() (SurfaceFrame, error) Format() Format FrameCount() int }
type SurfaceFrame ¶
type SurfaceFrame interface { View() ImageView Index() int BeginRenderPass(descriptor RenderPassDescriptor) RenderPassEncoder Present() error }
type SurfaceHandle ¶
type SurfaceHandle interface { SurfaceHandleType() SurfaceHandleType Size() LogicalSize }
type SurfaceHandleType ¶
type SurfaceHandleType string
type VertexAttribute ¶
type VertexBinding ¶
type VertexBinding struct { Binding int Stride int Rate VertexRate Attributes []VertexAttribute }
type VertexRate ¶
type VertexRate int
const VertexRateInstance VertexRate = 1
const VertexRateVertex VertexRate = 0
type VulkanPlatform ¶
type VulkanSurfaceHandle ¶
type Win32SurfaceHandle ¶
type Win32SurfaceHandle interface { SurfaceHandle Win32Instance() unsafe.Pointer Win32Handle() unsafe.Pointer }
Click to show internal directories.
Click to hide internal directories.