-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbonsai_stdlib.h
170 lines (133 loc) · 4.16 KB
/
bonsai_stdlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#define poof(...)
// NOTE(Jesse): This is strictly present to hack around some deficiencies in
// poof. It should be removed in the future.
#include <bonsai_stdlib/src/poof_crutches.h>
#include <bonsai_stdlib/src/poof_functions.h>
#include <bonsai_stdlib/src/iterators.h>
#include <bonsai_stdlib/src/assert.h>
#include <bonsai_stdlib/src/primitives.h>
#include <intrin.h>
#include <immintrin.h>
#include <smmintrin.h>
/* #include <ymmintrin.h> */
#include <bonsai_stdlib/src/simd_sse.h>
#include <bonsai_stdlib/src/simd_avx2.h>
#include <bonsai_stdlib/src/avx2_v3.h>
#include <bonsai_stdlib/src/console_macros.h>
#include <bonsai_stdlib/src/globals.h>
#include <bonsai_stdlib/src/platform.h>
#include <bonsai_stdlib/src/bit_tricks.h>
#include <bonsai_stdlib/src/atomic.h>
#include <bonsai_stdlib/src/thread.h>
#include <bonsai_stdlib/src/costable.h>
#include <bonsai_stdlib/src/arccostable.h>
#include <bonsai_stdlib/src/maff.h>
#include <bonsai_stdlib/src/memory_arena.h>
#include <bonsai_stdlib/src/primitive_containers.h>
#include <bonsai_stdlib/src/file.h>
#include <bonsai_stdlib/src/filesystem.h>
#include <bonsai_stdlib/src/vector.h>
#include <bonsai_stdlib/src/matrix.h>
#include <bonsai_stdlib/src/colors.h>
#include <bonsai_stdlib/src/gl.h>
#include <bonsai_stdlib/src/ui/gl.h>
#include <bonsai_stdlib/src/texture.h>
#include <bonsai_stdlib/src/shader.h>
#include <bonsai_stdlib/src/random.h>
#include <bonsai_stdlib/src/noise.h>
#include <bonsai_stdlib/src/perlin.h>
#include <bonsai_stdlib/src/simplex.h>
#include <bonsai_stdlib/src/input.h>
#include <bonsai_stdlib/src/mutex.h>
#include <bonsai_stdlib/src/work_queue.h>
#include <bonsai_stdlib/src/mesh.h>
enum gpu_element_buffer_flags
{
};
struct gpu_element_buffer_handles
{
// NOTE(Jesse): VertexHandle has to come first because it's the one that gets passed to GL.DeleteBuffers
// @vertex_handle_primal
u32 VertexHandle;
u32 NormalHandle;
u32 MatHandle;
u32 ElementCount;
data_type ElementType;
b8 Mapped;
b8 Pad;
u16 Flags; // (gpu_element_buffer_flags)
};
//{ This is a buffer we ask for and directly copy into
struct gpu_mapped_element_buffer
{
gpu_element_buffer_handles Handles;
untextured_3d_geometry_buffer Buffer;
};
// TODO(Jesse): Remove this typedef by changing the name everywhere.
typedef gpu_mapped_element_buffer gpu_mapped_untextured_3d_geometry_buffer;
// }
/* struct gpu_mapped_jorld_chunk_geometry_buffer */
/* { */
/* gpu_element_buffer_handles Handles; */
/* world_chunk_geometry_buffer Buffer; */
/* }; */
struct framebuffer
{
u32 ID;
u32 Attachments;
};
struct texture_ptr_block_array;
struct render_entity_to_texture_group
{
framebuffer FBO;
shader Shader;
gpu_mapped_element_buffer GeoBuffer;
m4 ViewProjection;
};
#include <bonsai_stdlib/src/platform_struct.h>
#include <bonsai_stdlib/src/heap_allocator.h>
#include <bonsai_stdlib/src/stream.h>
#include <bonsai_stdlib/src/counted_string.h>
#include <bonsai_stdlib/src/sort.h>
#include <bonsai_stdlib/src/console_io.h>
#include <bonsai_stdlib/src/line.h>
#include <bonsai_stdlib/src/quaternion.h>
#include <bonsai_stdlib/src/string_builder.h>
#include <bonsai_stdlib/src/ansi_stream.h>
#include <bonsai_stdlib/src/binary_parser.h>
#include <bonsai_stdlib/src/rect.h>
#include <bonsai_stdlib/src/xml.h>
#include <bonsai_stdlib/src/geometry_buffer.h>
struct light;
struct camera;
#include <bonsai_stdlib/src/ui/interactable.h>
#include <bonsai_stdlib/src/ui/ui.h>
#include <bonsai_stdlib/src/c_token.h>
#include <bonsai_stdlib/src/c_parser.h>
#include <bonsai_stdlib/src/debug_ui.h>
struct bonsai_stdlib;
struct debug_state;
link_weak bonsai_stdlib *GetStdlib();
link_internal debug_state *GetDebugState();
#include <bonsai_debug/debug.h>
#include <bonsai_debug/src/api.h>
#define UNPACK_STDLIB(Stdlib) \
os *Os = &(Stdlib)->Os; \
platform *Plat = &(Stdlib)->Plat;
struct bonsai_stdlib
{
os Os;
platform Plat;
thread_local_state *ThreadStates;
//
// Debug
//
// TODO(Jesse): Move into debug_state?
texture_block_array AllTextures;
shader_ptr_block_array AllShaders;
#if BONSAI_DEBUG_SYSTEM_API
debug_state DebugState;
#else
void *DebugState;
#endif
};