Documentation
¶
Overview ¶
Package session coordinates Wayland ownership, Vulkan submissions, DRM release points and the application frame loop behind nefergui.Run.
Index ¶
- type AppHooks
- type Session
- func (s *Session) Close() (err error)
- func (s *Session) Run(ctx context.Context, frames int, draw func(int) vkdevice.Rect) (int, error)
- func (s *Session) RunApp(ctx context.Context, app AppHooks) error
- func (s *Session) RunListWithCommit(ctx context.Context, frames int, draw func(int) []vkdevice.Instance, ...) (int, error)
- func (s *Session) RunPreparedListWithCommit(ctx context.Context, frames int, draw func(int) (render.Frame, error), ...) (int, error)
- func (s *Session) RunWithCommit(ctx context.Context, frames int, draw func(int) vkdevice.Rect, ...) (int, error)
- func (s *Session) Tick(rect vkdevice.Rect) (bool, error)
- func (s *Session) TickList(instances []vkdevice.Instance, uploads []text.Upload) (bool, error)
- type Slot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppHooks ¶
type AppHooks struct {
Wake <-chan struct{}
Input func([]wayland.Input) error
Event func(wayland.Event) error
Draw func() (render.Frame, bool, error)
Committed func(uint64) error
}
AppHooks runs entirely on the session owner loop. Draw returns dirty=false when there is no new display list; the session retries a dirty frame until committed without waiting for GPU completion on the loop.
type Session ¶
type Session struct {
Window *wayland.Window
Device *vkdevice.Device
Node *syncobj.Node
Pool *buffers.Pool
Pipeline *vkdevice.Pipeline
ListPipeline *vkdevice.Pipeline
Preparer *render.Preparer
Slots map[uint64]*Slot
Acquire uint32
AcquireTimeline *drmsyncobj.WpLinuxDrmSyncobjTimeline
Width, Height int32
Transparent bool
// contains filtered or unexported fields
}
func OpenWithOptions ¶ added in v0.2.0
func OpenWithOptions(ctx context.Context, name string, width, height int32, transparent bool, opts wayland.SurfaceOptions) (_ *Session, err error)
OpenWithOptions opens a session whose surface role and initial input region are selected by opts; the zero value is identical to Open. Wayland startup is abandoned when ctx is cancelled; ctx is not retained after it returns.
func (*Session) Close ¶
Close detaches and destroys the explicit-sync surface, traces release points for at most 200 ms, waits for our GPU, then frees every client allocation. Compositor imports keep independent DMA-BUF kernel references. It returns errors from writing requested debug artifacts; allocations are freed regardless.
func (*Session) RunApp ¶
RunApp drives a UI until close or cancellation. Wayland input is batched after Apply, and wake tokens, repeat deadlines and release points share one select.
func (*Session) RunListWithCommit ¶
func (s *Session) RunListWithCommit(ctx context.Context, frames int, draw func(int) []vkdevice.Instance, committed func(int) error) (int, error)
RunListWithCommit drives the list renderer using the existing frame loop.
func (*Session) RunPreparedListWithCommit ¶
func (s *Session) RunPreparedListWithCommit(ctx context.Context, frames int, draw func(int) (render.Frame, error), committed func(int) error) (int, error)
RunPreparedListWithCommit prepares uploads on every attempt. Preparer keeps them owed until a submission, so a skipped attempt is resent by the next one.
func (*Session) RunWithCommit ¶
func (s *Session) RunWithCommit(ctx context.Context, frames int, draw func(int) vkdevice.Rect, committed func(int) error) (int, error)
RunWithCommit calls committed after each successfully committed frame. The optional hook is for the example's capture request; it never gates reuse.
type Slot ¶
type Slot struct {
Buffer *buffers.Buffer
Image *vkdevice.Image
Frame *vkdevice.Frame
First bool
Wait *vkdevice.BinaryFence
PendingWait *vkdevice.BinaryFence
WaitInFlight bool
ReadbackFrame uint64
ReadbackPending bool
ReleaseHandle uint32
ReleaseTimeline *drmsyncobj.WpLinuxDrmSyncobjTimeline
}