Package-level declarations
Types
The default playback device, fed with 32-bit float stereo frames at sampleRate by an AudioRenderer. SDL converts to whatever the hardware wants and follows changes of the default device by itself.
Thrown when audio data cannot be decoded or a sound file cannot be opened. The message gives the decoder's reason, or names the file when a loader wraps an earlier AudioException as cause.
Produces audio for an AudioDevice. klyph's mixer implements it.
Decoded audio: frameCount frames of 32-bit float samples, each frame holding one value per channel, played at sampleRate frames per second. Samples are nominally in -1..1.
What a GpuBuffer is bound as.
One frame's recorded GPU work. Acquire with GpuDevice.acquireCommandBuffer and finish with submit.
One shader compiled for every backend: MSL source for Metal, SPIR-V for Vulkan and DXIL for Direct3D 12, with the resource counts SDL needs. Produced by the compileShaders build task from HLSL; create the backend's shader with GpuDevice.createShader.
Whether the mouse cursor is drawn over a Window.
Drains SDL's event queue. Owns one native event record, so polling allocates nothing beyond the returned PlatformEvent. close it when the pump is no longer needed, before Sdl.quit.
Thrown when a file cannot be read or written. The message names the file and repeats the reason SDL gives.
A frame read back from the GPU for the captures queued with Window.capture. Recorded by CommandBuffer.recordCaptureOrNull into the frame's command buffer; once that buffer has been submitted and its fence waited on, save writes the PNG files and frees the read-back memory.
A gamepad axis in SDL's standard layout: the two sticks and the two analog triggers.
A gamepad button in SDL's standard layout, named by position rather than by label: SOUTH is the bottom face button, A on an Xbox pad and cross on a PlayStation pad.
A buffer in GPU memory. Fill it through a TransferBuffer and a CopyPass.
Signals when submitted GPU work completes. Obtain from CommandBuffer.submitAndAcquireFence.
A texture owned by the GPU. Swapchain textures are valid only for the frame they were acquired in; created textures live until GpuDevice.release.
Whether the GPU backend runs its validation layer. Validation reports API misuse at a large performance cost, so enable it in development builds only.
A graphics pipeline: shaders plus fixed-function state, for triangle lists without vertex buffers. Vertex data is pulled from storage buffers by vertex index.
Thrown when image data cannot be decoded or encoded. The message gives the decoder's reason, or names the file when a loader wraps an earlier ImageException as cause.
Marks the platform plumbing that the klyph engine is built on: the SDL_GPU wrappers, the event pump, the audio device and its renderer, SDL start-up and shutdown, window creation, compiled shaders and frame capture.
Mapped transfer-buffer memory, addressed as 32-bit floats. Valid until GpuDevice.unmap. The setters inline to plain stores, so filling a buffer allocates nothing.
An event taken from the platform's event queue by EventPump.pollOrNull.
How frames are handed to the display.
A render pass that is being recorded. Call end before recording anything else.
How a sampler reads a texture at texture coordinates outside the range from 0 to 1, where 0 is the texture's left or top edge and 1 its right or bottom edge, on both axes. A sprite meets such coordinates when it repeats one texture across an area larger than the texture.
How a sampler picks texels when a texture is scaled.
Thrown when an SDL call fails. The message names the call and repeats SDL's own error text.
Compiled shader formats a GpuDevice can consume. Which one is used depends on the backend SDL picks: SPIR-V for Vulkan, DXIL for Direct3D 12, MSL for Metal.
Pipeline stage a GpuShader runs in.
Pixel format of a GPU texture, as chosen by SDL for a swapchain or requested for a created texture.
What a created texture is used for.
CPU-visible staging memory used to move data to the GPU. Map it, write, unmap, then upload in a CopyPass.
Decodes an Ogg Vorbis file held in memory a block at a time, for music that is too long to decode up front. Open one with VorbisStream.open, pull interleaved float frames with read, start over with rewind, and close it to free the decoder.
Options a Window is created with.
How a Window takes up the screen.
Functions
Waits for the next swapchain texture of window and returns it, or null when the window cannot be drawn to right now, such as while it is minimized. The texture is valid until this command buffer is submitted.
Begins a copy pass for uploads.
Begins a render pass that clears target to clearColor and keeps whatever is drawn into it.
Makes pipeline current for the draws that follow.
Copies image, or the rectangle of it sourceWidth pixels wide and sourceHeight pixels tall whose top-left corner is at column sourceX and row sourceY, into this image with that corner at column x and row y. Texels are written as given, alpha included and nothing blended, so a transparent or half-transparent pixel replaces the one under it; draw is the call that blends.
Creates a buffer of sizeInBytes bytes for usage.
Creates a pipeline drawing triangle lists with vertex and fragment into a single color target of colorFormat, blended with blend. No vertex buffers: vertex data is pulled from storage buffers by vertex index.
Creates the backend's shader from shader, picking the format this device supports.
Creates an upload staging buffer of sizeInBytes bytes.
Draws vertexCount vertices starting at firstVertex with the bound pipeline. Pass the Int parameters by name.
Draws image, or the rectangle of it sourceWidth pixels wide and sourceHeight pixels tall whose top-left corner is at column sourceX and row sourceY, over this image with that corner at column x and row y, blending each of its pixels by its alpha.
Creates a GPU device that accepts shaders in any of shaderFormats. Pass every format you ship so SDL can pick a backend on each platform.
Writes message and a line break to the standard error stream and flushes it, for warnings that should not mix with a program's normal output on standard output.
Records a read-back of texture into this command buffer if window has captures queued with Window.capture, and returns it, or returns null and records nothing when none is queued. Takes the queued captures off window either way.
Returns the scancode of the key that types this key code under the current keyboard layout, or Scancode.UNKNOWN when no key on the layout produces it.
Ends a mapping started with map. The MappedFloats handed out is invalid afterwards.
Copies sizeInBytes bytes from source at sourceOffset into destination at destinationOffset. Pass the Int parameters by name.
Copies the pixels of image into texture as given, alpha included and nothing blended, with the image's top-left corner at texel x, y, and leaves the rest of texture as it was. The image must lie inside texture, an RGBA8 texture; SDL does not check it.
Copies tightly packed texels for a width by height rectangle from source at sourceOffset into destination, with the rectangle's top-left corner at texel x, y of destination. With x and y at 0 and the texture's own size it fills the whole texture. The rectangle must lie inside destination; SDL does not check it. Pass the Int parameters after the first pair by name.