kiba-engine
surface.h
1 #pragma once
2 
3 #include <kiba/gpu/device.h>
4 #include <kiba/gpu/enums.h>
5 #include <kiba/gpu/types.h>
6 
7 KB_LOCAL b8 gpu_surface_create(gpu_surface surface, void *window_data);
8 KB_LOCAL void gpu_surface_destroy(gpu_surface surface);
9 
10 KB_LOCAL b8 gpu_backend_surface_create(struct gpu_backend_surface *surface, void *window_data);
11 KB_LOCAL void gpu_backend_surface_destroy(struct gpu_backend_surface *surface);
12 
13 static inline struct gpu_surface_configuration gpu_surface_default_config(const gpu_surface surface,
14  u32 width,
15  u32 height) {
16  UNUSED(surface);
17  return (struct gpu_surface_configuration){
18  .format = GPU_TEXTURE_FORMAT_BGRA8_UNORM,
19  .present_mode = GPU_PRESENT_MODE_FIFO,
20  .width = width,
21  .height = height,
22  };
23 }
24 
25 KB_API b8 gpu_surface_configure(gpu_surface surface, gpu_device device, struct gpu_surface_configuration config);
26 KB_API void gpu_surface_unconfigure(gpu_surface surface);
27 
28 KB_LOCAL b8 gpu_backend_surface_configure(struct gpu_backend_surface *surface,
29  struct gpu_backend_device *device,
30  struct gpu_surface_configuration config);
31 KB_LOCAL void gpu_backend_surface_unconfigure(struct gpu_backend_surface *surface, struct gpu_backend_device *device);
32 
33 KB_API b8 gpu_surface_get_current_texture(gpu_surface surface, gpu_texture *texture, b8 *suboptimal);
34 KB_API b8 gpu_surface_present(gpu_surface surface, b8 *suboptimal);
35 
36 KB_LOCAL b8 gpu_backend_surface_get_current_texture(struct gpu_backend_surface *surface,
37  struct gpu_backend_device *device,
38  struct gpu_backend_texture *texture,
39  b8 *suboptimal);
40 KB_LOCAL b8 gpu_backend_surface_present(struct gpu_backend_surface *surface,
41  struct gpu_backend_device *device,
42  struct gpu_backend_texture *texture,
43  b8 *suboptimal);
#define UNUSED(x)
Mark parameter as unused.
Definition: defines.h:21