summaryrefslogtreecommitdiff
path: root/src/atlas.h
blob: be10c3bcbb80250bbe5579961a5f600f4ee575a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include "sokol_gfx.h"
#include "utils.h"

enum atlas_error_e : u8 {
  ATLAS_ERROR_NONE = 0,
  ATLAS_ERROR_GPU_ATLAS,
  ATLAS_ERROR_ATLAS_FULL,
  ATLAS_ERROR_UPLOAD_FAILED,
};

struct atlas_s {
  u32 width, height;
  struct sg_image gpu_atlas;
  u8* cpu_atlas;
  bool cpu_dirty;
};

enum atlas_error_e wayc_atlas_init(struct atlas_s* atlas, u32 width, u32 height,
                                   enum sg_pixel_format format);
enum atlas_error_e wayc_atlas_flush(struct atlas_s* atlas);
void wayc_atlas_deinit(struct atlas_s* atlas);