libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Enumerations | Functions
surface.h File Reference

Display surface data structures and functions. More...

#include <libtransistor/types.h>
#include <libtransistor/display/graphic_buffer_queue.h>
Include dependency graph for surface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  surface_t
 A surface that can be drawn to. More...
 

Enumerations

enum  surface_state_t { SURFACE_STATE_INVALID, SURFACE_STATE_DEQUEUED, SURFACE_STATE_QUEUED }
 Keeps track of the internal state of a surface_t.
 

Functions

result_t surface_create (surface_t *surface, uint64_t layer_id, igbp_t igbp)
 Create a new Surface. More...
 
result_t surface_dequeue_buffer (surface_t *surface, uint32_t **image)
 Acquire a buffer for rendering. More...
 
result_t surface_get_buffer_event (surface_t *surface, revent_h *out)
 Gets a copy of the buffer event.
 
result_t surface_wait_buffer (surface_t *surface)
 Wait for any asynchronous operations on the current buffer to complete. More...
 
result_t surface_queue_buffer (surface_t *surface)
 Submit the current buffer to be displayed. More...
 
void surface_destroy (surface_t *surface)
 

Detailed Description

Display surface data structures and functions.

Function Documentation

result_t surface_create ( surface_t surface,
uint64_t  layer_id,
igbp_t  igbp 
)

Create a new Surface.

Parameters
surfaceStructure to initialize
layer_idID of the existing layer
igbpIGraphicBufferProducer to use for submitting buffers
result_t surface_dequeue_buffer ( surface_t surface,
uint32_t **  image 
)

Acquire a buffer for rendering.

Parameters
surfaceSurface to dequeue buffer from
imageReturns a pointer to the swizzled pixel data buffer to render to.

Using gfx_slow_swizzling_blit is recommended. Call surface_queue_buffer when you're done rendering to submit it to be displayed.

result_t surface_queue_buffer ( surface_t surface)

Submit the current buffer to be displayed.

Parameters
surfaceSurface to submit buffer for
result_t surface_wait_buffer ( surface_t surface)

Wait for any asynchronous operations on the current buffer to complete.

Parameters
surfaceSurface