libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
surface.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include<libtransistor/types.h>
14 
19 typedef enum {
20  SURFACE_STATE_INVALID,
21  SURFACE_STATE_DEQUEUED,
22  SURFACE_STATE_QUEUED,
24 
25 
30 typedef struct {
31  uint64_t layer_id;
32  igbp_t igbp;
33  surface_state_t state;
34  bool has_requested[2];
35  uint32_t current_slot;
36 
37  gpu_buffer_t gpu_buffer;
38  uint32_t *gpu_buffer_memory;
39  uint32_t *gpu_buffer_memory_alloc;
40 
41  graphic_buffer_t graphic_buffers[3];
42 
43  fence_t current_fence;
44 } surface_t;
45 
53 result_t surface_create(surface_t *surface, uint64_t layer_id, igbp_t igbp);
54 
64 result_t surface_dequeue_buffer(surface_t *surface, uint32_t **image);
65 
70 
77 
84 
85 void surface_destroy(surface_t *surface);
86 
87 #ifdef __cplusplus
88 }
89 #endif
Various system types.
Represents conditions for the completion of an asynchronous graphics operation.
Definition: fence.h:18
A surface that can be drawn to.
Definition: surface.h:30
IGraphicBufferProducer object.
Definition: graphic_buffer_queue.h:24
result_t surface_queue_buffer(surface_t *surface)
Submit the current buffer to be displayed.
Graphics buffer.
Definition: graphic_buffer.h:19
uint32_t result_t
Function result.
Definition: types.h:51
handle_t revent_h
revent handle
Definition: types.h:47
surface_state_t
Keeps track of the internal state of a surface_t.
Definition: surface.h:19
Graphics buffer queues data structures and functions.
result_t surface_get_buffer_event(surface_t *surface, revent_h *out)
Gets a copy of the buffer event.
Buffer to be used for various GPU functions.
Definition: gpu.h:18
result_t surface_dequeue_buffer(surface_t *surface, uint32_t **image)
Acquire a buffer for rendering.
result_t surface_create(surface_t *surface, uint64_t layer_id, igbp_t igbp)
Create a new Surface.
result_t surface_wait_buffer(surface_t *surface)
Wait for any asynchronous operations on the current buffer to complete.