sdlgpu

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

meui-render-sdlgpu

SDL3 GPU backend for MeUI. Uses SDL's native GPU abstraction, so the same device code targets Vulkan, Metal and Direct3D 12.

Current state:

  • creates a real SDL GPU device;
  • selects the native driver (Vulkan on Linux, Metal on macOS, D3D12 on Windows);
  • creates/claims windows;
  • acquires swapchains, clears them and submits real frames.

Verified on Linux with SDL 3.4.20 + Vulkan (lavapipe): device creation and window clear/present pass.

Not yet implemented:

  • shader compilation/loading into SDL_GPUShader;
  • vertex/index buffers;
  • the MeUI SDF/text/image pipelines;
  • graphics.Device integration.

The WGSL-generated artifacts in meui-shaders are the intended shader source.

Documentation

Overview

Package sdlgpu is the SDL3 GPU backend for MeUI. It creates a native GPU device through SDL (Vulkan, Metal or D3D12) and presents frames through a claimed window.

This is deliberately a separate module from meui-render-gl: it does not use OpenGL or EGL, and it selects its shaders from the generated artifacts in meui-shaders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device owns one SDL GPU device and the windows claimed for presentation.

func New

func New(debug bool) (*Device, error)

New creates a GPU device, trying every shader format SDL can provide. SDL picks the native backend (Vulkan/Metal/D3D12) from the platform.

func (*Device) Claim

func (d *Device) Claim(window unsafe.Pointer) error

Claim makes a window presentable through this device.

func (*Device) Clear

func (d *Device) Clear(window unsafe.Pointer, c FColor) error

Clear acquires a swapchain, clears it and submits. It is the smallest real frame and is used to validate the device/window path before the full batch renderer lands.

func (*Device) Close

func (d *Device) Close()

Close waits for the GPU and destroys the device.

func (*Device) CreateWindow

func (d *Device) CreateWindow(title string, w, h int32) unsafe.Pointer

CreateWindow creates a plain SDL window for GPU presentation. Unlike meui-sdl's InitWindow it creates no OpenGL context.

func (*Device) DestroyWindow

func (d *Device) DestroyWindow(win unsafe.Pointer)

DestroyWindow destroys a window from CreateWindow.

func (*Device) Driver

func (d *Device) Driver() string

Driver reports the native backend ("vulkan", "metal", "d3d12").

func (*Device) ReleaseWindow

func (d *Device) ReleaseWindow(window unsafe.Pointer)

ReleaseWindow releases a claimed window.

type FColor

type FColor struct{ R, G, B, A float32 }

FColor is a linear RGBA colour.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL